Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Get-ADUser return text only

$
0
0

Hi, I’m getting stuck on something stupid but I haven´t really found a solution on google.

this is my code: $user = get-aduser @ADUserParams | select-object CN | Sort-Object CN $userid = $($userid | Select-Object -Last 1)

the output of $userid will be : @{CN=user001}

What i need to do is to have in $userid only the value : user001 Because i need then to increment the ‘counter’ and create a variable with user002 and so on.

Does someone have an idea how to do it?

submitted by /u/fedechksum
[link] [comments]

The post Get-ADUser return text only appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles