I have a script that takes input from a csv file; then using the employee's ID number it extracts the employee's manager's name from AD.
Next I capture the manager's email address; which I believe is a string. If I use the same command string in both PS ise and the command prompt I get to 2 different outputs; see below.
using PS ise: @{username@thecompany.com}
command prompt: username@thecompany.com
why is ise adding the "@{" and "}"
Here is a portion of the code:
Foreach($_ID in $_users) {
$Name = $($_ID.EmpName)
$EcomName = $($_ID.EcomName)
$EmployeeID = $($_ID.EmpNumbr)
if ($EmployeeID -ne $null) {
$MgrInfo = Get-QADUser -LdapFilter "(EmployeeID=$EmployeeID)" -IncludedProperties EmployeeID | Select-Object Manager # obtain employee's AD info using their Employee Number
$Mgr = $MgrInfo -split("CN=")
# capture employee's manager name (CN string)
$MgrName = $Mgr[1] -split(',') # capture
manager's name
$MgrEmail = (Get-QADUser -Name $MgrName[0] | Select-Object Email) # extract manager's email address by searching AD for -Name
Write-Host $Name $EcomName $EmployeeID $MgrName[0] $MgrEmail
}
}
El Bee