1
我想写一个脚本,将检查一个字符串是否为空,如果它是输出用户名到一个文件,所以我可以回去检查该文件,看看谁是空的。下面是我的代码,脚本不写入out-file任何想法?Powershell与变量的文件
$user = "[email protected]"
#just gets the users info
$user_info = gam info user $user
$suspended = $user_info | Select-String -pattern "Account Suspended: true"
if ($suspended = $null) {
$user | Out-File -FilePath C:\scripts\not_suspended.txt -append -Encoding utf8
}