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/...)
This commit is contained in:
root 2016-03-11 14:00:28 -05:00
parent 286d91d722
commit 2aba1c211d
2 changed files with 2 additions and 2 deletions

View file

@ -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"

View file

@ -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):