How to Remove Active Directory Domain Services Role from Windows Server using PowerShell

ADDS roles can be removed by using the GUI and Powershell. Powershell is a fast and easy method that requires only a single command. Remove ADDS Role with PowerShell Step 1: Open PowerShell. Step 2: Type in the following command and then press enter: Uninstall-ADDSDomainController -DemoteOperationMasterRole -RemoveApplicationPartition Step 3: Provide the local administrator password and press ... Read more

How to Migrate Print Services from Server 2012 to Server 2016

These instructions describe how to migrate print services from Windows Server 2012 R2 to Windows Server 2016. Windows Server 2016 has built-in migration wizard. Install Print Services on Server 2016 Step 1: Open the server manager. Click on the Add Roles and Features wizard. Step 2: Click on Next. Step 3: Choose Role-based or feature-based installation ... Read more

samAccountName Vs userPrincipalName

In this article, I am going to explain the difference between a samAccountName and a userPrincipalName which are often used in an Active Directory context. samAccountName It was used with an earlier version of windows (pre-windows 2000). User login name is in the format of DomainName\testUser. It should be less than 20 characters. It should be ... Read more

How to Prompt a User for Input using PowerShell

You can use the read-host command-let to get an input from a user during program execution. PowerShell Input Example Here is a related example, the program gets two numbers in string format and converts them into integers and then sums up those numbers and finally displays the result. The -prompt parameter is used to display a ... Read more

How to Read a Text File Using PowerShell

You can read a text file and display its content using get-content cmdlet in PowerShell. Read textfile example Execute the following command on PowerShell with elevated privileges. Get-Content c:\scripts\test.txt This command will display the contents of the file test.txt which is located in c:\scripts\

How to Generate Random Numbers Using PowerShell

When you have to generate random passwords for users, you can execute the get-random command let on PowerShell to create it. Generate Random Number get-random -maximum 2000 -minimum 100 This command, when executed on PowerShell, creates a number between 1999 (not 2000 and always set one number higher in maximum) and 100.

How to Configure DHCP with PowerShell

PowerShell commands are an easy way to save a lot of time as system administrator. In this article, I'll show you how to configure DHCP from PowerShell. I have following information including scope, and router gateway IP. DHCP DNSServerIP="192.168.1.10" DHCPServerIP="192.168.1.10" StartRange="192.168.1.150" EndRange="192.168.1.200" Subnet="255.255.255.0" Router="192.168.1.1" Following is the configuration break down: Installing DHCP Adding DHCP scope ... Read more

How to Keep Installed Drivers After Running SYSPREP

Sometime it is necessary to keep installed drivers on windows even after running sysprep. You can do so by following these steps. Step-by-Step instructions Step 1: Open run command. Type regedit and then press enter key. Step 2: Go to the following path: GoHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\Sysprep\Settingregedits\sppnp Step 3: Locate PersistAllDeviceInstalls on right side of window. Step 4: Right-click and ... Read more