2014-09-23 2 views
0

로컬 레지스트리에서 모든 프로그램 이름 목록을 확인하고 시만텍이 설치된 경우 경고에 'if'문을 제공하는 다음 코드가 있습니다.PowerShell 원격 레지스트리

$List = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* 

if ($List.displayname -Match "Symantec") 
{ Write-Host "Symantec is installed." -ForegroundColor Green } 
else 
{ Write-Host "Symantec is not installed." -ForegroundColor Red } 

원격 레지스트리를 사용하여이 코드를 원격 서버에서 확인하는 방법을 알려주십시오.

답변

0

당신은 호출-명령으로 스크립트를 포장 할 수 있습니다 원격 활성화 된 경우

icm -ComputerName computer1 -ScriptBlock { 
    $List = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* 

    if ($List.displayname -Match "Symantec") 
    { Write-Host "Symantec is installed." -ForegroundColor Green } 
    else 
    { Write-Host "Symantec is not installed." -ForegroundColor Red } 
} 
+0

참고로, 인보-명령은 작동합니다. 보안 문제 일 수 있습니다. (아마 Windows Server 2012에서 기본적으로 활성화되어 있기 때문에) 아닙니다. 기본적으로 많은 컴퓨터 (Windows 7, 예를 들어 Pre-WS2012)에서는 사용할 수 없습니다. – mbourgon