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 Create a Function in PowerShell

If you have worked with other programming languages, you have may used functions for code reusability. You can also create functions in PowerShell. PowerShell function example Below is syntax of simple function function hello-world { write-host "hello world"  } You can also pass parameters in a function using param keyword function Get-TimesResult { Param ([int]$a,[int]$b) $c = $a * $b Write-Output ... Read more

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="" DHCPServerIP="" StartRange="" EndRange="" Subnet="" Router="" 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