Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Adding Variable to Hash Table.

$
0
0

You can get that same information quite a bit more easily, if you like (without resorting to string parsing steps):

$group = Get-WmiObject Win32_Group -Filter 'Name = "Administrators"'
$group.GetRelated('Win32_UserAccount') | Select-Object -Property Domain, Name

Edit: I tested this on a home computer that's not a member of a domain. For domain-joined computers, you may need to modify it slightly to make sure Get-WmiObject returns the correct group.


Viewing all articles
Browse latest Browse all 13067

Trending Articles