Link to home
Start Free TrialLog in
Avatar of Joe Schmoe
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:
import-module RemoteDesktop
New-SessionDeployment -ConnectionBroker "$env:computername.$env:userdnsdomain" -WebAccessServer "$env:computername.$env:userdnsdomain" -SessionHost "$env:computername.$env:userdnsdomain"

Open in new window


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:userdnsdomain" - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-SessionDeployment

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

Open in new window

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
Avatar of Joe Schmoe
Joe Schmoe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial