I'm having a little problem with a script (thanks for the script, sir Jubjub Bandersnatch) that is not running as intended. The script is intended to define an execution policy for the OS and, after setting it, executing a .ps1 script wich intalls IIS 7.0.
cls
Powershell -noexit -command "& {Set-ExecutionPolicy remotesigned -Force}"
Powershell -File c:\ScriptsIIS\IISInstallation.ps1
The problem is, it sets an Execution policy with success but after it, the script won't open the .ps1 file. And, another thing that I thought of, people in the company will download this script to different locations, and how do I set a generalized desktop? Like, I'll put a guide together with the files asking to extract the files on desktop, but how can I tell the script the files will be on their desktop (read: diferent users will need this) without having to modify the script?
EDIT1: The first problem was solved with a simple " Start " in front of each line. And I think I might solve the second problem just putting:
powershell -file c:\Users\%Username%\Desktop\ScriptsIIS\IISInstallation.ps1
EDIT2: I was right, the " %USERNAME% solved it.
%homepath%\Desktop
instead ofC:\Users\%username%\Desktop
. That will work across different versions of Windows. Microsoft has changed the default location of user profiles a couple of times.