Advertisement
Guest User

Untitled

a guest
Jan 10th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Clears the console
  2. Clear-Host
  3.  
  4. function requestMonitors()
  5. {
  6.     $monitorlists = New-Object System.Collections.ArrayList
  7.     [int] $monitors = Read-Host("How many monitors do you have? ")
  8.     if ( [int]$monitors -ge 1 )
  9.     {
  10.         for ($i=1; $i -le $monitors; $i++)
  11.         {
  12.             $input = Read-Host "What is the serial number of the " $i "Monitor? "
  13.             $monitorlists += $input
  14.         }
  15.         foreach($serialnumber in $monitorlists)
  16.         {
  17.             Write-Host($serialnumber)
  18.             Write-Host("`n")
  19.         }
  20.         return $monitorlists
  21.     }
  22.     else
  23.     {
  24.         Write-Host("You expect me to believe you don't use any monitors... ")
  25.         requestMonitors    
  26.     }
  27. }
  28.  
  29. $myList = requestMonitors
  30.  
  31. $key = Read-Host "Hit enter to Exit or e to export list"
  32. if($key -eq "e"){
  33.     $myList | Out-File -FilePath ExportedList.txt
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement