Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ContosoUserArray = @()
- $ADUserList = Import-Csv "C:\Scripts\DataFiles\ADUsers.csv"
- foreach($ContosoUser in $ADUserList)
- {
- $SamAccountName = (($ContosoUser.SamAccountName).Trim()).ToLower()
- $UserPrincipalName = (($ContosoUser.UserPrincipalName).Trim()).ToLower()
- $HomeDirectory = (($ContosoUser.HomeDirectory).Trim()).ToLower()
- $EmailAddress = (($ContosoUser.EmailAddress).Trim()).ToLower()
- $ContosoUserObj = New-Object –TypeName PSObject
- $ContosoUserObj | Add-Member -type NoteProperty -Name SamAccountName -value $SamAccountName
- $ContosoUserObj | Add-Member -type NoteProperty -Name EmailAddress -value $EmailAddress
- $ContosoUserObj | Add-Member -type NoteProperty -Name HomeDirectory -value $HomeDirectory
- $ContosoUserObj | Add-Member -type NoteProperty -Name UserPrincipalName -value $UserPrincipalName
- $ContosoUserArray += $ContosoUserObj
- }
- $ContosoUserArray.count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement