我正在使用此命令在管理员组中获取本地用户,并且它有效
Get-WmiObject -Class Win32_Groupuser -ComputerName $computer |? {$_.groupcomponent -like '*"Administrators"' -and $_.Partcomponent -like '*"User"'}|ft groupcomponent,Partcomponent
但现在我想使用像这样的变量 $Group="Administrators" $Account="users"
Get-WmiObject -Class Win32_Groupuser -ComputerName $computer |? {$_.groupcomponent -like *$Group -and $_.Partcomponent -like *$Account}|ft groupcomponent,Partcomponent
但我一无所获