Month: June 2021

Quick Snippet to Copy NTFS Permissions Between SMB Shares

The experimental script below will sync permissions of a folder toward another.WARNING: if sub-folders at…

How To Copy Folder in Legacy Windows with Long File Names?

$sourceDirectory='D:\SMBSHARE\LONGPATH' $destinationDirectory='\\FILESERVER\LONGPATH' function copyFolderWithLongNames($sourceDirectory,$destinationDirectory){ $sourceParent=split-path $sourceDirectory -parent $sourceChild=split-path $sourceDirectory -leaf $destinationParent=split-path $destinationDirectory -parent $destinationChild=split-path $destinationDirectory…

PowerShell: Expand Disk Volume to Maximum Size

# expandDisk.ps1 # version 0.02 $driveLetters=(Get-wmiobject win32_volume -filter 'DriveType=3 AND DriveLetter IS NOT NULL').DriveLetter function…

PowerShell: How to Change Active Directory Username

$oldUsername='testUser' $newUsername='tUser' function changeUsername{ param( $oldUsername, $newUsername ) $domainName=$env:USERDNSDOMAIN $newUserPrincipleName="$newUsername@$domainName" try{ Set-ADUser $oldUsername -SamAccountName $newUsername…

Converting from IOPS to MB/s

Conversion factors: from IOPS to MiB/s Throughput is a function of Input/Output per second (IOPS)…

Disable Windows 10 Automatic Updates

Why? It's annoying if Windows keep updating automatically in the background and even reboot when…

System Center Virtual Machine Manager Errors and Resolutions

Error Message: Error (415)Agent installation failed copying 'C:\Program Files\Microsoft System Center\Virtual Machine Manager\agents\I386\IRV-VMM01\msiInstaller.exe' to '\\IRV-HYPERV06\ADMIN$\msiInstaller.exe'.The…

PowerShell: Create, Edit User Accounts Basing on CSV File

# Create New Users: defined as names in CSV that does not exist in Existing…

PowerShell: Create User Accounts From CSV File

# User-input Variables $csvFile='C:\Users-finalized.csv' $newOu='CN=Users,DC=kimconnect,DC=com' $newCompany='Kim Connect' $logFile="c:\temp\createActiveDirectoryAccounts-$(get-date -f yyyy-mm-dd-hh-mm-ss).txt" function createActiveDirectoryAccounts{ param( $csvFile, $newOu,…

PowerShell: Update Accounts Basing on CSV File

# adAccountsCsvUpdate.ps1 $originalCsvFile='C:\Users.csv' $newCsvFile='C:\Users-finalized.csv' $newEmailSuffix='@kimconnect.net' $newOu='CN=Users,DC=kimconnect,DC=com' function adAccountsCsvUpdate{ param( $originalCsvFile, $newCsvFile, $newEmailSuffix, $newOu ) function…