Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Leading zero(s) in AD attribute gets removed in powershell script

$
0
0

The Active Directory Attribute 'otherHomePhone' is used as an employee ID which can contain leading zeros.  It seems the leading zero's get truncated.  For example: If the employee ID is 003421, the output file has 3421.  Any suggestions?

import-module activedirectory
Get-ADUser -Filter {(ObjectClass -eq "user")} -Properties Mail,otherHomePhone  | 
Select-Object GivenName,Surname,userPrincipalName,mail,@{n="otherHomePhone";e={$_.otherHomePhone[0]}} | 
Export-Csv -NoType "jper263a.csv"
Copy-Item d:\Scripts\PeopleSoftADExport\jper263a.csv \\addfsdev01\bjsdev\VOL1\ADexport


http://techwithmike.com


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>