Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to enable Powershell remoting (Enable-PSRemoting) during an unattended Windows Server 2008 R2 installation? Is there a setting in unattend.xml for this?

share|improve this question
untested: can you not run that command at the end of unattend.xml in the run script option (or whatever it is called, I am not at work no so I cannot check our unattend.xml syntax, sorry) ? – natxo asenjo Aug 13 '10 at 14:48
I tried to add a RunSynchronousCommand (under "Microsoft-Windows-Deployment", pass "4 specialize") to execute "powershell.exe Enable-PSRemoting -force", that didn't work. – Max Aug 13 '10 at 16:26
After monitoring it more closely, I could see a powershell window opening up during the "Setup is applying system settings" screen. However, it seems to run powershell 1.0 (c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe) for some reason. The output in the window is "WinRM has been updated to receive requests. WinRM service started.", then after a few seconds some red lines with an apparent error message appear (wasn't able to capture it) and the window disappears. – Max Aug 13 '10 at 16:47
yeah but you need to logon first before the script is run. That's something we don't want. We want to access the server through powershell without needed to explicitely logon to the server. – user79676 Apr 27 '11 at 16:15
showing v1.0 in the path to powershell.exe is a false hope. 1.0 and 2.0 use the exact same path. – Bret Fisher Feb 20 '12 at 18:16

If your on a AD Domain, the prefered way would be via GPO:

  1. Enable Computer Configuration\Policies\Administrative Templates\Windows Components\Windows Remote Management\WinRM Service\Allow automatic configuration of listeners
  2. Create firewall rule inbound for Windows Remote Management
share|improve this answer

You could run a script from the unattend.xml, here you wil find an example how to do that: Example 3: Run a script

I haven't tested it, but you can run for example this script there: Enable-PSRemoting

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.