Powershell -Filter not accepting two conditions

后端 未结 3 1928
故里飘歌
故里飘歌 2021-01-28 21:01

I have this command

$remoteuserlist = Get-WmiObject Win32_UserAccount `
-filter \"LocalAccount =True\" –computername $PC -verbose

that I am run

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-28 21:51

    If you have a bunch of old VBScript WMI queries laying around you can use the Get-WMIObject -Query param to reuse them.

    $remoteuserlist = Get-WmiObject -query "SELECT * FROM Win32_UserAccount WHERE LocalAccount = 'True' and Name != 'Guest'" –computername $PC -verbose
    

    Not groundbreaking but it can help if you don't want to rewrite queries.

提交回复
热议问题