Good Day All
I want to set up a common script where I can pass the server name from a .bat script when calling the .ps1
In my bat script I have this statement:
set setver_name=our2008server
powershell -ExecutionPolicy RemoteSigned
-NonInteractive
-NoProfile
-command
"& '\\serverd1\d$\Program Files\%run_dir%\Dcls\PS\Stop_Bkgnd_%run_env%_01.ps1' "
-server_name %server_name%
in my ps1 script I have:
gwmi win32_service -Computername $server_name -filter "name = 'BackgroundQueue'" |
% {$_.StopService()}
If I replace the $server_name with the actual server name it works fine. Just cannot get the variable from the .bat file to be recognized in the .ps1.
Any help would be greatly appreciated.
BobZ