Solved

In CSV file there is a (?) instead of a (-). Values gathered from AD

Posted on 2013-05-23
2
202 Views
Last Modified: 2013-05-23
Hello, i have the following code but the value from title in AD has a (-) it but outputs a (?) in the CSV file

Import-Module ActiveDirectory
$File = Import-Csv "c:\scripts\ceridian\05-22-2013_CeridianExport.csv"
$AD = Get-ADUser -SearchBase "OU=OU,DC=DOMAIN,DC=COM" -filter * -Properties sAMAccountName,sn,givenName,title,employeeNumber | Where { $_.DistinguishedName -notmatch "OU=VIP" -and $_.DistinguishedName -notmatch "OU=DA"} | Select-Object  sAMAccountName,sn,givenName,title,employeeNumber
$ADMisMatch = @()
Foreach ($AD_User in $AD){
If (!($File | ?{$AD_User.EmployeeNumber -eq $_."Clock Number" -and $AD_User.sn -eq $_."Last Name" -and $AD_User.givenName -eq $_."First Name" -and $AD_User.title -eq $_."Job Title"}))
    {
        $ADMisMatch += $AD_User
    }
}
$ADMisMatch | Sort-Object -Property "sn", "givenName" | Select sn,givenName,title,employeeNumber | Export-Csv "c:\scripts\ceridian\05-23-2013_ADMisMatch.csv" -NoTypeInformation

Open in new window


Title in AD:Manager – Systems/Network
title in CSV file:Manager ? Systems/Network

Thoughts ?

Thanks for your help
0
Comment
Question by:namerg
2 Comments
 
LVL 39

Accepted Solution

by:
footech earned 500 total points
ID: 39192276
Just a guess, but the dash in your title probably isn't a standard hyphen "-", but some other character.  Exporting a user with a standard hyphen works just fine for me.
If I take the long dash from MS Word, and paste it into the properties of a user it turns into a "?".  Word autocorrects a hyphen into the long dash when you type a word<space><hyphen><space>word<space or return>.  So it's likely an encoding error.
0
 

Author Comment

by:namerg
ID: 39192290
Hmm, interesting...
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
A procedure for exporting installed hotfix details of remote computers using powershell
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now