Advertisement
Guest User

subloc

a guest
Apr 20th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $global:SUB = "101010"
  2. function Get-Serv {
  3. $PIC = New-Object System.Collections.ArrayList
  4. $PIC.Clear()
  5. $PIC.Add("\\SERVER\PIC")
  6. $i=2
  7. Do {
  8.     $PIC.Add("\\SERVER\PIC"+"_"+$i++)
  9.     }
  10. Until ((Test-Path $PIC[-1]) -eq $false)
  11.  
  12. $PIC.RemoveAt($PIC.Count -1)
  13.  
  14. Find-SUB $PIC
  15. }
  16.  
  17. function Find-SUB ([String[]]$list){
  18. $subloc = New-Object System.Collections.ArrayList
  19. $subloc.Clear()
  20.  
  21. foreach ($l in $list){
  22.  
  23. $c = -Join ( $l,"\",$SUB )
  24. $w = Test-Path $c
  25.    if ( ( $w ) -eq $true ){
  26.         $subloc.Add( $c )}
  27.   }
  28. $subloc
  29. }
  30.  
  31. Get-Serv
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement