Hello all. I am creating deployment scripts for AWS Windows 2016 servers. I have added a script in my packerfile.json that is executed as part of the WinRM provisioner and is supposed to create a series of folders and then create an SMB share for each folder.
When I run the script from the server while logged on it runs perfectly, no issues.
When I run the script as part of the AMI provisioner, WinRM, it creates share names with a prefix and suffix which then causes errors later on when a script must use the share name to finish a task.
Example same code run from Server and WinRM:
New-SMBShare –Name “WFInstall” –Path “D:\TEMPINSTALL” -FullAccess “everyone”
Output when run from the server:
Name = WFInstall
Output when run from WinRM during the AMI bake:
Name = â€Name WFInstall â€Path
It’s not an error and provisioning finishes as expected but the share names are wrong. I don’t believe it’s a problem with elevated privilege because the script also adds local groups and this works fine. Any ideas?