2010-03-20 3 views

답변

2

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." 
    } 

} 
관련 문제