Coming soon - Get a detailed view of why an account is flagged as spam!
view details
4
Need help with csv file
Post Body

I have a csv file which has 1 column with usernames and the second column with the persons real name. What I'm trying to do is search AD based off the username in the first field in the computer description field, and output the computer name. Here's my code:

$UserN=@()

$Name=@()

Import-Csv C:\\Scripts\q2.csv | ForEach-Object {

$UserN = $_.Username

$Comp = (Get-ADComputer -Filter 'description -like "*$UserN*"').Name

$Name = $_.Name

write-host $Comp belongs to $UserN

}

But right now I get nothing in the front... it basically outputs " belongs to <username>" with no computer name. What am I doing wrong?

Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
Yes
Total Karma
66,614
Link Karma
30,920
Comment Karma
35,639
Profile updated: 6 days ago
Posts updated: 9 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago