소스 검색

add get-locationcomputer

Tobias Simetsreiter 2 년 전
부모
커밋
b10827da02
2개의 변경된 파일27개의 추가작업 그리고 1개의 파일을 삭제
  1. 22 0
      bin/Get-LocationComputer.ps1
  2. 5 1
      bin/uninstall-package.ps1

+ 22 - 0
bin/Get-LocationComputer.ps1

@@ -0,0 +1,22 @@
+param(
+    $Location,
+    [Switch]$DSK,
+    [Switch]$LAP
+)
+
+$DSKFILTER="${Location}DSK*"
+$LAPFILTER="${Location}LAP*"
+
+if ($DSK){
+    Get-ADComputer -Filter {
+        (Enabled -eq $true) -and ((Name -like $DSKFILTER))
+    }
+} elseif ($LAP) {
+    Get-ADComputer -Filter {
+        (Enabled -eq $true) -and ((Name -like $LAPFILTER))
+    }
+} else {
+    Get-ADComputer -Filter {
+        (Enabled -eq $true) -and ((Name -like $DSKFILTER) -or (Name -like $LAPFILTER))
+    }
+}

+ 5 - 1
bin/uninstall-package.ps1

@@ -8,4 +8,8 @@ $ComputerName | Out-Host
 # &$psremoteremote -ComputerName $ComputerName
 
 # "NetPhone Client"
-Invoke-Command $ComputerName -ScriptBlock { Get-Package | Where-Object {$_.Name -eq $ProgramName} | Uninstall-Package -Force }
+Invoke-Command -ComputerName $ComputerName -ScriptBlock { 
+    Get-Package |
+    Where-Object {$_.Name -eq $ProgramName} |
+    Uninstall-Package -Force
+}