sysinfo i/o

All Your Base Are Belong To Us

  • /
  • WINTEL
    • ACTIVE DIRECTORY
    • CITRIX
    • COMMANDS
    • EXCHANGE
    • IIS
    • POWERSHELL
    • MSSQL SERVER
  • LINUX
    • APACHE
    • BASH
    • NGINX
    • MONITORING
    • UTILITIES
  • SCRIPTS
    • SHELL
    • BATCH
    • POWERSHELL
  • DOWNLOADS
  • TIPS
  • NETWORKING
    • SSL
    • DNS
    • VPN
  • LINKS
    • COUCH POTATO
    • GITHUB
    • IPCONFIG.IO
    • PRIVATEBIN
    • UNIFI CLOUD
    • UPTIME ROBOT
    • TRAVISFLIX
    • VSCODE
  • ABOUT
    • CONTACT
Home / Operating Systems / Windows / Active Directory / Bulk Import Active Directory User Properties with Windows PowerShell

June 30, 2014 7:00 pm By Travis Leave a Comment

Bulk Import Active Directory User Properties with Windows PowerShell

Bulk Import Active Directory User Properties with Windows PowerShell

Recently I had the impulse to populate existing AD user object property fields with phone numbers, titles, companies, and office; however, I wanted to use PowerShell to bulk import instead of the old ldifde method or manual labor. It was actually quite easy, but it does require some time massaging the CSV file in Excel.

  • First, export a CSV containing the users and fields you want to update (it will be our template). Our anchor is going to be the SID because it is guaranteed to be unique across the forest.

 

Get-ADGroupMember "UserGroup" | get-aduser -Properties samAccountName, name, sid, telephoneNumber, mobile, title, Company, physicalDeliveryOfficeName | Select-Object samAccountName, name, sid, telephoneNumber, mobile, title, Company, physicalDeliveryOfficeName | export-csv users-to-update.csv -NoTypeInformation

 

  • Open that file up in Excel and start populating your blank columns. Feel free to sort it however you like.

124454.strip.zoom

  • Now the fun part. It’s time to import our populated CSV file back into Active Directory. The Set-ADUser cmdlet will use the Replace switch so that data will be replaced if it already exists. Remember, the Identity ($_.sid) is our anchor which will match the CSV data to the AD user object.
Import-Csv -Path "users-to-update.csv" | ForEach-Object {Set-ADUser -Identity $($_.sid) -Replace @{telephoneNumber=$($_.telephoneNumber); mobile=$($_.mobile); title=$($_.title); Company=$($_.Company); physicalDeliveryOfficeName=$($_.physicalDeliveryOfficeName)}}

Since you’ve saved so much time updating your user objects, you can go back to playing Galaga (^_^))))))))…

tumblr_m4y69iq8mj1rxxclqo1_r1_400

Filed Under: Active Directory, Powershell, Windows

My Tweets

POPULAR DOWNLOADS

  • KMS Pico Activator (1099 downloads)
  • VERIZON S7 SM-G930V (884 downloads)
  • AT&T S7 G930AATT1APB5 (880 downloads)
  • AT&T S7 Edge SM-G935A (687 downloads)
  • VERIZON S7 EDGE SM-G935V (528 downloads)
  • Odin_v3.12.3.zip (481 downloads)
  • T-MOBILE S7 EDGE SM-G935T (457 downloads)
  • Lucky Patcher v6.3.9 (434 downloads)
  • Lucky Patcher v6.4.2 (431 downloads)
  • Lucky Patcher v6.3.7 (415 downloads)

POPULAR POSTS

  • Samsung Galaxy S9 G960/G965 Stock ROM Firmware Download
    Samsung Galaxy S9 G960/G965 Stock ROM Firmware Download
  • Force Delete Windows Server DHCP Failover Relationship
    Force Delete Windows Server DHCP Failover Relationship
  • Android Connect to Microsoft SSTP VPN Free
    Android Connect to Microsoft SSTP VPN Free
  • How to Remove OneDrive from Quick Access
    How to Remove OneDrive from Quick Access
  • Official Samsung Galaxy S7 USA Stock ROM Firmware Download
    Official Samsung Galaxy S7 USA Stock ROM Firmware Download
  • Activate Windows and Office with KMSpico
    Activate Windows and Office with KMSpico
  • Nginx no "ssl_certificate" is defined in server listening on SSL port while SSL handshaking
    Nginx no "ssl_certificate" is defined in server listening on SSL port while SSL handshaking
  • PowerShell Scripts
    PowerShell Scripts
  • Bittorrent IP Blocklists
    Bittorrent IP Blocklists

Made with