Solved

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

Posted on 2013-05-23
2
201 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This article will help you understand what HashTables are and how to use them in PowerShell.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 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

16 Experts available now in Live!

Get 1:1 Help Now