下面我有一个 PS 命令来获取一些有用的用户信息。我还想从带有 PC 名称的 csv 文件中获得输入。我怎样才能给所有东西相同的格式?
PC 名称后的冒号与我从get-aduser
. 有人可以建议我该怎么做吗?
Clear-Host
do {
write-Host " Enter the user ID: " -ForegroundColor Cyan -NoNewline
$UserName = Read-Host
Write-Host ""
Get-ADUser -Identity $Username -Properties * | Select-Object DisplayName, mail, LastLogonDate, LastBadPasswordAttempt, AccountExpirationDate, PasswordLastSet , OfficePhone, Department, Manager
$Processes = Import-CSV 'C:\Users\w0vlnd\Desktop\Powershells\Computers in a specific workgroup or domain.csv'
$processes | where "User ID" -like $Username | Select-Object "PC name"
net user $Username /domain | find "Password expires"
net user $Username /domain | find "Password changeable"
write-host "`n"
} while ($Username -notcontains $Processes)