質問

I have tried the following script and it fetched the members of the group.

$CompStat = Get-WmiObject win32_computersystem;
$Localhst = $CompStat.Name;
$Computer = [ADSI]('WinNT://'+$localhst+',computer');
$group = [ADSI]('WinNT://'+$Localhst+'/Remote Desktop Users,group');
$Members = @($group.psbase.Invoke("Members"));
$Members | ForEach-Object {$MemberNames += $_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null);}

But the members are not getting displayed. How to print the members?

役に立ちましたか?

解決

Just add a Write-Host $MemberNames at the end of your script

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top