Get-LocationComputer.ps1 468 B

12345678910111213141516171819202122
  1. param(
  2. $Location,
  3. [Switch]$DSK,
  4. [Switch]$LAP
  5. )
  6. $DSKFILTER="${Location}DSK*"
  7. $LAPFILTER="${Location}LAP*"
  8. if ($DSK){
  9. Get-ADComputer -Filter {
  10. (Enabled -eq $true) -and ((Name -like $DSKFILTER))
  11. }
  12. } elseif ($LAP) {
  13. Get-ADComputer -Filter {
  14. (Enabled -eq $true) -and ((Name -like $LAPFILTER))
  15. }
  16. } else {
  17. Get-ADComputer -Filter {
  18. (Enabled -eq $true) -and ((Name -like $DSKFILTER) -or (Name -like $LAPFILTER))
  19. }
  20. }