windows - Executing Powershell script via CMD -
i have powershell script called change.ps1, here content of script:
param([string]$username, [string]$password) import-module activedirectory $newpwd = convertto-securestring -string "$password" -asplaintext –force set-adaccountpassword $username -newpassword $newpwd –reset
i try run script via cmd.exe, here command use (note pass 2 parameters used in script above):
powershell.exe c:\inetpub\htdocs\school_panel\scripts\change.ps1 -username "test" -password "elgoog321"
now, when run command can tell script found , executed second line works. know because can see module being imported. however, after error message: http://puu.sh/axuh3/b8db154625.png
i grateful if offer on this.
regards
your image seems indicate encoding pb. maybe have paste command file wrong encoding. try open file in notepad++ , convert ansi encoding
Comments
Post a Comment