Bulk update AD user details with powershell from CSV / update AD users’ phone numbers

Create a csv file with columns and data:

name officephone
John.Jones 212-555-1212 ext. 123
Jane.Jones 212-555-1212 ext. 124

Save it and run this command:

Import-Csv ‘.\phonenums.csv’ | % { Set-ADUser -Identity $_.name -OfficePhone $_.OfficePhone -WhatIf}

Remove the What If switch to actually make the updates. What if simulates the changes so you can see which users will be updated, but won’t change anything if you made a mistake.

Advertisements

Decompress multiple gzipped files into one file

E.g. I have multiple old Apache access logs (which are compressed with gzip) and I want to extract them all into one large log.

You can use cat to combine all the gzipped files into one file, then decompress the one large file.

cat *.gz > all.gz
gzip -d all.gz

Blog at WordPress.com.

Up ↑