Script – Join a Computer to the Domain

Join the local computer to the domain without prompting  using a specific account and reboot once finished.

Add-Computer -DomainName testdom.local -NewName Server22 -Credential testdom\administrator -Restart -Force
Advertisements

Script – New AD Forest

This PowerShell script will deploy a new root forest with a forest and domain level of Windows Server 2012 R2.

Import-Module ADDSDeployment
Install-ADDSForest `
-CreateDnsDelegation:$false `
-DatabasePath "C:\Windows\NTDS" `
-DomainMode "Win2012R2" `
-DomainName "test.local" `
-DomainNetbiosName "TEST" `
-ForestMode "Win2012R2" `
-InstallDns:$true `
-LogPath "C:\Windows\NTDS" `
-NoRebootOnCompletion:$false `
-SysvolPath "C:\Windows\SYSVOL" `
-Force:$true

 

Script – Switch to / from Windows Core

Switch to Windows Core with GUI:

Import-Module ServerManager
Uninstall-WindowsFeature Server-GUI-Shell -Restart

Switch to Windows Core:

Import-Module ServerManager
Uninstall-WindowsFeature Server-GUI-Mgmt-Infra -Restart

Switch from Core to full GUI:

Import-Module ServerManager
Install-WindowsFeature Server-GUI-Mgmt-Infra
Install-WindowsFeature Server-GUI-Shell
Restart-Computer