소스 검색

pass argument to remote command

Tobias Simetsreiter 2 년 전
부모
커밋
36703ca2e6
1개의 변경된 파일4개의 추가작업 그리고 7개의 파일을 삭제
  1. 4 7
      bin/uninstall-package.ps1

+ 4 - 7
bin/uninstall-package.ps1

@@ -4,14 +4,11 @@ param(
     $LogFile="runtime/uninstall-package.log"
 )
 $ComputerName | Out-Host
-# $psremoteremote = Resolve-Path "$PSScriptRoot\..\localadmin\psremote-remote.ps1"
 
-# &$psremoteremote -ComputerName $ComputerName
-
-# "NetPhone Client"
 Invoke-Command -ComputerName $ComputerName -ScriptBlock {
+    param($ProgramName)
     hostname
     Get-Package |
-    Where-Object {$_.Name -eq $ProgramName} |
-    Uninstall-Package -Force
-} *>&1 | Tee-Object -Append $LogFile
+        Where-Object {$_.Name -eq $ProgramName} |
+        Uninstall-Package -Force
+} -ArgumentList $ProgramName *>&1 | Tee-Object -Append $LogFile