무엇이 있는지 알기 위해 서버의 모든 패치를 원격으로 가져 오려고합니다. 아래는이 작업을 위해 작성한 스크립트입니다. 그러나 스크립트를 실행할 때 스크립트를 실행하는 로컬 컴퓨터에 대한 패치 만 얻습니다. 내가 도대체 뭘 잘못하고있는 겁니까?PSSession 및 Get-Hotfix
$computers = Get-ADComputer -Filter * -Properties operatingsystem;
$filter = "Windows Server*"
foreach($computer in $computers)
{
if($computer.OperatingSystem -like $filter)
{
$name = $computer.Name.ToString();
write-host "Working on computer: "$name
New-PSSession -ComputerName $name;
Enter-PSSession -ComputerName $name | Get-HotFix | Export-Csv "c:\new\$name patches.csv";
Exit-PSSession;
}
}
이러한 컴퓨터 중 c : \ new를 확인 했습니까? 귀하의 PSSessions에있는 귀하의 CSV가 귀하의 PC가 아닌 원격 기계에 있다고 의심됩니다. –
예, 찾고있는 컴퓨터 중 하나를 게시하지 않고 스크립트를 실행중인 로컬 컴퓨터에 배치합니다. 그러나 모든 사람의 권한으로 UNC 경로를 만들었으므로 다음과 같이 표시됩니다. ' '\\ 서버 이름 \ d $ \ Patches \ sample.csv'경로에 대한 액세스가 거부되었습니다. + CategoryInfo : OpenError : (:) [Export-Csv], UnauthorizedAccessException + FullyQualifiedErrorId : FileOpenFailure, Microsoft.PowerShell.Commands.ExportCsvCommand' – Fidelis
WMI를 사용해 보셨습니까? Get-WMIObject Win32_QuickFixEngineering -ComputerName $ name입니다. – EBGreen