Modified files to use single quotes rather than double for file path. Powershell does not process $ variables in strings that are single quoted. Powershell DOES process $ variables that are in double quoted strings.

Using single quotes enables ansible to  handle file paths that contain folders that start with $. (i.e. C:/Users/$admin/...)
pull/14930/head
root 9 years ago
parent 286d91d722
commit 2aba1c211d

@ -274,7 +274,7 @@ class Connection(ConnectionBase):
script_template = u''' script_template = u'''
begin {{ begin {{
$path = "{0}" $path = '{0}'
$DebugPreference = "Continue" $DebugPreference = "Continue"
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"

@ -52,7 +52,7 @@ class ShellModule(object):
path = '\\'.join(parts) path = '\\'.join(parts)
if path.startswith('~'): if path.startswith('~'):
return path return path
return '"%s"' % path return '\'%s\'' % path
# powershell requires that script files end with .ps1 # powershell requires that script files end with .ps1
def get_remote_filename(self, base_name): def get_remote_filename(self, base_name):

Loading…
Cancel
Save