Powershell -Filter not accepting two conditions

后端 未结 3 1926
故里飘歌
故里飘歌 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:39

    $remoteuserlist = Get-WmiObject Win32_UserAccount -filter {LocalAccount = "True" and Name != "Guest"} –computername $PC -verbose
    
    1. You were mixing WMI syntax and PowerShell syntax
    2. The brackets encompassing the filter were around the other parameters of Get-WmiObject

提交回复
热议问题