How to run a Powershell command...
as a post installation script? I have a .ps1 file that has:
set-executionpolicy remotesigned -force
add-computer -domain mnb.local
Now I need to know how to get this to run. I can't just create a BAT Script as it will attempt to run these in a DOS windows. Do I upload my .ps1 and add it as an application?
set-executionpolicy remotesigned -force
add-computer -domain mnb.local
Now I need to know how to get this to run. I can't just create a BAT Script as it will attempt to run these in a DOS windows. Do I upload my .ps1 and add it as an application?
0 Comments
[ + ] Show comments
Answers (11)
Please log in to answer
Posted by:
dchristian
13 years ago
Posted by:
cserrins
13 years ago
Posted by:
jmcelvoy
13 years ago
Posted by:
cserrins
13 years ago
Posted by:
dchristian
13 years ago
Posted by:
jmcelvoy
13 years ago
I created a batch file that says:
powershell.exe -command add-computer -domain domainname
pause
Named this JoinDomain.bat, saved to C:\ and added a RunOnce entry that called this file. It ran no problems. For some reason I didn't have to modify the executionpolicy calling the command from a batch file.
powershell.exe -command add-computer -domain domainname
pause
Named this JoinDomain.bat, saved to C:\ and added a RunOnce entry that called this file. It ran no problems. For some reason I didn't have to modify the executionpolicy calling the command from a batch file.
Posted by:
cserrins
13 years ago
Posted by:
jmcelvoy
13 years ago
I thought that at first so I removed the pc from the domain, ran set-executionpolicy restricted to set the policy back to restricted, then fired up powershell and tried running a ps1 script and it gave the message about scripts being disabled blah blah blah. I then added the RunOnce key and rebooted and it ran again no problem. It really is odd that I don't have to set the executionpolicy when doing this from a .bat file but I do have to set it before I can run it from a .ps1 file.
Posted by:
ncsutmf
13 years ago
Posted by:
ronfalkoff
9 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.