【发布时间】:2010-09-20 21:40:44
【问题描述】:
我正在尝试编写一个脚本来删除测试帐户的本地配置文件。我正在使用以下行返回以“test-”开头的任何帐户的 SID
PowerShell:$UserSID = (Get-WmiObject Win32_UserProfile | Where {$_.LocalPath -like '*\test-*'}).SID
获得 SID 后,我使用 wmic 进行删除,但我不确定如何将该代码转换为 PowerShell。
WMIC:wmic /node:"localhost" path win32_UserProfile where Sid="%%b" Delete
【问题讨论】:
标签: powershell wmi