« Back to myAirWatch

Remote Management Server Installation PowerShell Scripts

Simplify the installation of the Remote Management server with PowerShell scripts designed to provide shortcuts in the process. These scripts gather information or create settings on the server.

Prior to running Powershell scripts, you must disable User Access Control (UAC) and execute all Powershell commands in an Administrator Powershell window.

PowerShell Commands for enabling PowerShell script execution on the local machine

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force
Set-ExecutionPolicy Unrestricted -Scope Process -Force

PowerShell Script for Application and Web Server Roles and Features

Install Features

Install-WindowsFeature AD-Domain-Services, DNS, Application-Server, AS-NET-Framework, AS-TCP-Port-Sharing, AS-Web-Support, AS-WAS-Support, AS-HTTP-Activation, AS-MSMQ-Activation, AS-TCP-Activation, FileAndStorage-Services, File-Services, FS-FileServer, Storage-Services, Web-Server, Web-WebServer, Web-Common-Http, Web-Default-Doc, Web-Dir-Browsing, Web-Http-Errors, Web-Static-Content, Web-Http-Redirect, Web-DAV-Publishing, Web-Health, Web-Http-Logging, Web-Custom-Logging, Web-Log-Libraries, Web-ODBC-Logging, Web-Request-Monitor, Web-Performance, Web-Stat-Compression, Web-Dyn-Compression, Web-Security, Web-Filtering, Web-Basic-Auth, Web-CertProvider, Web-Client-Auth, Web-Digest-Auth, Web-Cert-Auth, Web-IP-Security, Web-Url-Auth, Web-Windows-Auth, Web-App-Dev, Web-Net-Ext45, Web-AppInit, Web-ASP, Web-Asp-Net45, Web-CGI, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Mgmt-Tools, Web-Mgmt-Console, Web-Scripting-Tools
Install-WindowsFeature NET-Framework-Features, NET-Framework-Core, NET-Framework-45-Features, NET-Framework-45-Core, NET-Framework-45-ASPNET, NET-WCF-Services45, NET-WCF-HTTP-Activation45, NET-WCF-MSMQ-Activation45, NET-WCF-Pipe-Activation45, NET-WCF-TCP-Activation45, NET-WCF-TCP-PortSharing45, GPMC, MSMQ, MSMQ-Services, MSMQ-Server, RSAT, RSAT-Role-Tools, RSAT-AD-Tools, RSAT-AD-PowerShell, RSAT-ADDS, RSAT-AD-AdminCenter, RSAT-ADDS-Tools, RSAT-DNS-Server, FS-SMB1, Telnet-Client, User-Interfaces-Infra, Server-Gui-Mgmt-Infra, Desktop-Experience, Server-Gui-Shell, PowerShellRoot, PowerShell, PowerShell-V2, PowerShell-ISE, WAS, WAS-Process-Model, WAS-Config-APIs, WoW64-Support

Remove Features

Remove-WindowsFeature AD-Domain-Services, DNS, Application-Server, AS-NET-Framework, AS-TCP-Port-Sharing, AS-Web-Support, AS-WAS-Support, AS-HTTP-Activation, AS-MSMQ-Activation, AS-TCP-Activation, FileAndStorage-Services, File-Services, FS-FileServer, Storage-Services, Web-Server, Web-WebServer, Web-Common-Http, Web-Default-Doc, Web-Dir-Browsing, Web-Http-Errors, Web-Static-Content, Web-Http-Redirect, Web-DAV-Publishing, Web-Health, Web-Http-Logging, Web-Custom-Logging, Web-Log-Libraries, Web-ODBC-Logging, Web-Request-Monitor, Web-Performance, Web-Stat-Compression, Web-Dyn-Compression, Web-Security, Web-Filtering, Web-Basic-Auth, Web-CertProvider, Web-Client-Auth, Web-Digest-Auth, Web-Cert-Auth, Web-IP-Security, Web-Url-Auth, Web-Windows-Auth, Web-App-Dev, Web-Net-Ext45, Web-AppInit, Web-ASP, Web-Asp-Net45, Web-CGI, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Mgmt-Tools, Web-Mgmt-Console, Web-Scripting-Tools
Remove-WindowsFeature NET-Framework-Features, NET-Framework-Core, NET-Framework-45-Features, NET-Framework-45-Core, NET-Framework-45-ASPNET, NET-WCF-Services45, NET-WCF-HTTP-Activation45, NET-WCF-MSMQ-Activation45, NET-WCF-Pipe-Activation45, NET-WCF-TCP-Activation45, NET-WCF-TCP-PortSharing45, GPMC, MSMQ, MSMQ-Services, MSMQ-Server, RSAT, RSAT-Role-Tools, RSAT-AD-Tools, RSAT-AD-PowerShell, RSAT-ADDS, RSAT-AD-AdminCenter, RSAT-ADDS-Tools, RSAT-DNS-Server, FS-SMB1, Telnet-Client, User-Interfaces-Infra, Server-Gui-Mgmt-Infra, Desktop-Experience, Server-Gui-Shell, WAS, WAS-Process-Model, WAS-Config-APIs, WoW64-Support

PowerShell Script for creating Active Directory Objects

Import-Module ActiveDirectory

$DomainName = Get-ADDomain | Select Forest -ExpandProperty Forest

$GroupName = "RMAdminGroup"

$PUDN = "Portal Admin"
$PUFN = "Portal"
$PULN = "Admin"
$PUSAM = "PortalAdmin"
$PUUPN = $PUSAM + "@" + $DomainName
Write-Host "Enter Password for Portal Admin User: " -ForegroundColor White -BackgroundColor Black
"`n"
$PUPassword1 = Read-Host -AsSecureString

New-ADGroup -Name $GroupName -SamAccountName $GroupName -GroupCategory Security -GroupScope Global -DisplayName $GroupName

New-ADUser -Name $PUDN -AccountPassword $PUPassword1 -DisplayName $PUDN -Enabled $True -GivenName $PUFN -Surname $PULN -SamAccountName $PUSAM -PasswordNeverExpires $True -UserPrincipalName $PUUPN

Add-ADGroupMember $GroupName $PUSAM

PowerShell Script for creating controlplane Forward Lookup Zone

Write-Host "Please select the correct default zone" -ForeGroundColor Yellow -BackGroundColor Black
Write-Host "Example: 4" -ForeGroundColor Yellow -BackGroundColor Black
$DNSZones = Get-DnsServerZone | Select ZoneName -ExpandProperty ZoneName
$Count1 = 0
ForEach ($DNSZone in $DNSZones) { $Count1++; Write-Host $Count1")" $DNSZone }
$Selection1 = Read-Host
$GetRootZone = $DNSZones[$Selection1-1]

"`n`n`n"

$ARecord = "Admin"
$DTPRecord = "_dtp._tcp"
$SVCRecord = "_svc._tcp"
$Priority = "0"
$Weight = "0"
$DTPPort = "8865"
$SVCPort = "8870"
$FLZoneName = "controlplane.aetherpal.internal"
$FLZoneName1 = "admin.controlplane.aetherpal.internal"

Write-Host "Please enter the IP address of the Admin/Anchor/APP Server." -ForeGroundColor Cyan -BackGroundColor Black
Write-Host "If each server is seperate please enter the IP Address of the APP Server" -ForeGroundColor Cyan -BackGroundColor Black
Write-Host "Example: 10.10.30.234" -ForeGroundColor Cyan -BackGroundColor Black
$Result4 = Read-Host

$DNSServerName = Get-DnsServerSetting | Select ComputerName -ExpandProperty ComputerName

$FLZoneExist1 = Get-DnsServerZone | Where { $_.ZoneName -eq $FLZoneName } | Select ZoneName -ExpandProperty ZoneName
IF ($FLZoneExist1 -ne $Null) { Add-DnsServerResourceRecordA -Name $ARecord -ZoneName $FLZoneName -AllowUpdateAny -IPv4Address $Result4; Add-DnsServerResourceRecord -Srv -Name $DTPRecord -ZoneName $FLZoneName –DomainName $FLZoneName1 –Priority $Priority –Weight $Weight –Port $DTPPort; Add-DnsServerResourceRecord -Srv -Name $SVCRecord -ZoneName $FLZoneName –DomainName $FLZoneName1 –Priority $Priority –Weight $Weight –Port $SVCPort } ELSE { Add-DnsServerPrimaryZone -Name $FLZoneName -ReplicationScope "Forest" -PassThru; Add-DnsServerResourceRecordA -Name $ARecord -ZoneName $FLZoneName -AllowUpdateAny -IPv4Address $Result4; Add-DnsServerResourceRecord -Srv -Name $DTPRecord -ZoneName $FLZoneName –DomainName $FLZoneName1 –Priority $Priority –Weight $Weight –Port $DTPPort; Add-DnsServerResourceRecord -Srv -Name $SVCRecord -ZoneName $FLZoneName –DomainName $FLZoneName1 –Priority $Priority –Weight $Weight –Port $SVCPort }