3

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?

Max
  • 365
  • 2
  • 5
  • 17
  • 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) ? http://technet.microsoft.com/en-us/library/dd819498.aspx – 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. –  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

2 Answers2

1

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
Bret Fisher
  • 3,963
  • 2
  • 20
  • 25
0

You could run a script from the unattend.xml, here you wil find an example how to do that: Example 3: Run a script http://technet.microsoft.com/en-us/library/cc732280%28WS.10%29.aspx#ImageOlder3

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

Guido van Brakel
  • 942
  • 5
  • 10