1
특정 관리자 암호를 사용하여 일련의 가상 컴퓨터 (Windows Server)를 만들었습니다. 이러한 VM은 사용자에게 할당되어 사용 중일 수 있습니다. 사용자가 관리자 암호를 변경했는지 확인하고 사용자가 알아 차리지 못하도록 확인합니다. PowerShell의 좋은 솔루션은 무엇입니까?Powershell에서 비밀번호 변경 확인을 구현하는 방법은 무엇입니까?
특정 관리자 암호를 사용하여 일련의 가상 컴퓨터 (Windows Server)를 만들었습니다. 이러한 VM은 사용자에게 할당되어 사용 중일 수 있습니다. 사용자가 관리자 암호를 변경했는지 확인하고 사용자가 알아 차리지 못하도록 확인합니다. PowerShell의 좋은 솔루션은 무엇입니까?Powershell에서 비밀번호 변경 확인을 구현하는 방법은 무엇입니까?
PSCredential을 만든 다음 호스트에서 WmiObject를 가져올 수 있습니다. 다음과 같음 :
$computerNames = "host1", "host2"
$pw = ConvertTo-SecureString "adminpw" -AsPlainText -Force
foreach($computerName in $computerNames)
{
$cred = New-Object System.Management.Automation.PSCredential("$computerName\Administrator", $pw)
try
{
Get-WmiObject win32_bios -ComputerName $computerName -Credential $cred
Write-Host "$computerName = Password not changed."
}
catch [System.UnauthorizedAccessException]
{
Write-Host "$computerName = Password changed."
}
}