Joe Schmoe
asked on
Windows Server 2012 R2 - Single Server Session Based deployment
I have a single server running on Windows Server 2012 R2. I have no problem creating a new session based deployment to this single server via the Server Manager UI - however, when I try to automate the process in a Powershell script it doesn't work.
Here is my script:
It yields the error:
I tried all the proposed solutions for this problem available online, including running the script as Administrator, setting my execution policy to unrestricted, remoting into the local server via
All I'm trying to do is automate what I can already do via the Server Manager UI.
Here is my script:
import-module RemoteDesktop
New-SessionDeployment -ConnectionBroker "$env:computername.$env:userdnsdomain" -WebAccessServer "$env:computername.$env:userdnsdomain" -SessionHost "$env:computername.$env:userdnsdomain"
It yields the error:
New-SessionDeployment : Validation failed for the "RD Session Host" parameter.
MY.OMMITTED.FQDN You cannot restart the local server.
At line:1 char:1
+ New-SessionDeployment -ConnectionBroker "$env:computername.$env:userdnsdomai n" - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteE rrorExcept ion,New-Se ssionDeplo yment
I tried all the proposed solutions for this problem available online, including running the script as Administrator, setting my execution policy to unrestricted, remoting into the local server via
Enter-PSSession $env:computername
and then running the script. But all of these proposed solutions yield the same error message.All I'm trying to do is automate what I can already do via the Server Manager UI.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.