Day: July 2, 2020

PowerShell: Setting or Resetting User Password

$username='dragoncoin' $newPassword='SomeComplexPasswordHere' function resetPassword($username,$password){ if($env:userdnsdomain){ try{ Unlock-ADAccount -Identity $username Set-ADAccountPassword -Identity $username -Reset -NewPassword (ConvertTo-SecureString…

PowerShell: Regex Examples

# Example 1 Simple 10-digit match $x='123-456-7890' [regex]$regex10Digits='\({0,1}\d{0,1}\){0,1}\-{0,1}(\d{3})' $areaCode=$regex10Digits.Match($x).Groups[1].Value # Example 2 IP Version 4…

Hyper-V: Creating a New Virtual Machine

# Compulsory variables $hyperVHost='HYPERV007' $vmName='WindowsGoldenImage' $parentDirectory='C:\ClusterStorage\Volume5' $disk1Size='100GB' $memoryAllocation='8GB' $networkSwitch='PublicZone' $vlan='1005' $clusterName='DEV-CLUSTER05' # Optional variables $disk2Size=$false…