Advertisement
Guest User

Untitled

a guest
Sep 26th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <# Script: Menu.ps1 by Patrick Deno
  2. Purpose: To allow a user (Admin) to select and run any of a number of management/maintenance scripts, dealing with Active Directory, MS Exchange, or the general Network tasks, from a single interactive interface on my company's network.
  3. Last Updated: August 30th, 2018 #>
  4.  
  5. <# --- Begin Pathing --- #>
  6. $ScriptRoot = "\\MyDataServer\Install\IT - Share\Helpful BATs & Scripts"
  7.  
  8. <# --- Active Directory Path --- #>
  9. $pathADAudit = $ScriptRoot+ "\Active Directory\AD Auditing\"
  10. $pathADManagement = $ScriptRoot+ "\Active Directory\AD Management\"
  11. $pathADUser = $ScriptRoot+ "\Active Directory\AD User Management\"
  12.  
  13. <# --- Exchange Path --- #>
  14. $pathExAudit = $ScriptRoot+ "\Exchange Scripts\Exchange Auditing\"
  15. $pathExManagment = $ScriptRoot+ "\Exchange Scripts\Exchange Management\"
  16. $pathExUser = $ScriptRoot+ "\Exchange Scripts\User Account Management\"
  17.  
  18. <# --- Network Path --- #>
  19. $pathNetwork = $ScriptRoot+ "\Network\"
  20.  
  21. <# --- End Pathing --- #>
  22.  
  23. <# --- Variable Decision Engine --- #>
  24. $LoopMain = "0"
  25.  
  26. Function ExitMessage {
  27.  
  28.     CLS
  29.     Write-Host "No script chosen.
  30. Exited.
  31.    
  32. "
  33.  
  34. }
  35.  
  36. While ($LoopMain -ne "1") {
  37.    
  38.     <# --- (Re)initializing variables --- #>
  39.     $Exit = "0"
  40.     $LoopAD = "0"
  41.     $LoopEX = "0"
  42.     $LoopNW = "0"
  43.     $MainChoice = $NULL
  44.     $ADSubMainChoice = $NULL
  45.     $ADSub1stChoice = $NULL
  46.     $ADSub2ndChoice = $NULL
  47.     $ADSub3rdChoice = $NULL
  48.     $EXSub1stChoice = $NULL
  49.     $EXSub2ndChoice = $NULL
  50.     $EXSub3rdChoice = $NULL
  51.     $NWSubMainChoice = $NULL
  52.     $ScriptArray = $NULL
  53.     $ScriptChoice = $NULL
  54.  
  55.     <# --- Main Menu Loop --- #>
  56.     do {
  57.    
  58.     CLS
  59.     Write-Host "********************************************" -ForegroundColor White
  60.     Write-Host "**  Please choose a script type           **" -ForegroundColor White
  61.     Write-Host "**                                        **" -ForegroundColor White
  62.     Write-Host "**  Please choose one                     **" -ForegroundColor White
  63.     Write-Host "**                                        **" -ForegroundColor White
  64.     Write-Host "**  (1) Active Directory                  **" -ForegroundColor White
  65.     Write-Host "**  (2) Exchange                          **" -ForegroundColor White
  66.     Write-Host "**  (3) Network                           **" -ForegroundColor White
  67.     Write-Host "**  (4) Exit                              **" -ForegroundColor White
  68.     Write-Host "**                                        **" -ForegroundColor White
  69.     Write-Host "********************************************" -ForegroundColor White
  70.  
  71.         $MainChoice = Read-Host "Main menu choice?"
  72.        
  73.     } while (1..4 -notcontains $MainChoice)
  74.    
  75.         <# --- Main Menu Choice Loop --- #>
  76.        
  77.         <# --- Active Directory Main Menu --- #>
  78.         If ($MainChoice -eq "1") {
  79.            
  80.             do {
  81.            
  82.             CLS
  83.             Write-Host "********************************************" -ForegroundColor Cyan
  84.             Write-Host "**  Please choose Active Directory Group  **" -ForegroundColor Cyan
  85.             Write-Host "**                                        **" -ForegroundColor Cyan
  86.             Write-Host "**  Please choose one                     **" -ForegroundColor Cyan
  87.             Write-Host "**                                        **" -ForegroundColor Cyan
  88.             Write-Host "**  (1) AD Auditing                       **" -ForegroundColor Cyan
  89.             Write-Host "**  (2) AD Management                     **" -ForegroundColor Cyan
  90.             Write-Host "**  (3) AD User management                **" -ForegroundColor Cyan
  91.             Write-Host "**  (4) Back                              **" -ForegroundColor Cyan
  92.             Write-Host "**  (5) Exit                              **" -ForegroundColor Cyan
  93.             Write-Host "**                                        **" -ForegroundColor Cyan
  94.             Write-Host "********************************************" -ForegroundColor Cyan
  95.            
  96.                 $ADSubMainChoice = Read-Host "AD menu choice?"
  97.                
  98.             } while (1..5 -notcontains $ADSubMainChoice)
  99.            
  100.             <# --- Active Directory Choice Loop --- #>
  101.             While ($LoopAD -ne "1") {
  102.            
  103.                 If ($ADSubMainChoice -eq "1") {
  104.                
  105.                     $PathChoice = $pathADAudit
  106.                    
  107.                     do {
  108.                     CLS
  109.                     Write-Host "********************************************" -ForegroundColor Cyan
  110.                     Write-Host "**                                        **" -ForegroundColor Cyan
  111.                     Write-Host "**  Active Directory Auditing             **" -ForegroundColor Cyan
  112.                     Write-Host "**                                        **" -ForegroundColor Cyan
  113.                     Write-Host "**  Please choose one                     **" -ForegroundColor Cyan
  114.                     Write-Host "**                                        **" -ForegroundColor Cyan
  115.                     Write-Host "**  (1) Export All User Memberships       **" -ForegroundColor Cyan
  116.                     Write-Host "**  (2) Export All Computers              **" -ForegroundColor Cyan
  117.                     Write-Host "**  (3) Export All Disabled Users         **" -ForegroundColor Cyan
  118.                     Write-Host "**  (4) Export All Users In Group         **" -ForegroundColor Cyan
  119.                     Write-Host "**  (5) Export Inactive Users (90 Days)   **" -ForegroundColor Cyan
  120.                     Write-Host "**  (6) Export All Computers              **" -ForegroundColor Cyan
  121.                     Write-Host "**  (7) Back                              **" -ForegroundColor Cyan
  122.                     Write-Host "**  (8) Exit                              **" -ForegroundColor Cyan
  123.                     Write-Host "**                                        **" -ForegroundColor Cyan
  124.                     Write-Host "**                                        **" -ForegroundColor Cyan
  125.                     Write-Host "********************************************" -ForegroundColor Cyan
  126.                    
  127.                         $ADSub1stChoice = Read-Host "AD Auditing Script?"
  128.                        
  129.                     } while (1..8 -notcontains $ADSub1stChoice)
  130.                    
  131.                     If ($ADSub1stChoice -eq "7") {
  132.                    
  133.                         $LoopAD = "1"
  134.                         Break
  135.                    
  136.                     } ElseIf ($ADSub1stChoice -eq "8") {
  137.                    
  138.                         ExitMessage
  139.                         $LoopMain = "1"
  140.                         Break Script
  141.                    
  142.                     }  Else {
  143.                    
  144.                         $ScriptArray = "AD-AllUserMemberships.ps1","AD-DisabledCompsAudit.ps1","AD-DisabledUsersAudit.ps1","AD-GetAllUsersInGroup.ps1","AD-InActiveUsers-90DaysAudit.ps1","AD-ListAllComputers.ps1"
  145.                         $ScriptChoice = $ScriptArray[$ADSub1stChoice -1]
  146.                         $LoopAD = "1"
  147.                         $LoopMain = "1"
  148.                         Break
  149.                    
  150.                     }
  151.  
  152.                 } ElseIf ($ADSubMainChoice -eq "2") {
  153.                                
  154.                     $PathChoice = $pathADManagement
  155.                    
  156.                     do {
  157.                    
  158.                     CLS
  159.                     Write-Host "********************************************" -ForegroundColor Cyan
  160.                     Write-Host "**                                        **" -ForegroundColor Cyan
  161.                     Write-Host "**  Active Directory Management           **" -ForegroundColor Cyan
  162.                     Write-Host "**                                        **" -ForegroundColor Cyan
  163.                     Write-Host "**  Please choose one                     **" -ForegroundColor Cyan
  164.                     Write-Host "**                                        **" -ForegroundColor Cyan
  165.                     Write-Host "**  (1) Force ADs To Replicate            **" -ForegroundColor Cyan
  166.                     Write-Host "**  (2) Back                              **" -ForegroundColor Cyan
  167.                     Write-Host "**  (3) Exit                              **" -ForegroundColor Cyan
  168.                     Write-Host "**                                        **" -ForegroundColor Cyan
  169.                     Write-Host "********************************************" -ForegroundColor Cyan
  170.  
  171.                         $ADSub2ndChoice = Read-Host "AD Management Script?"
  172.                        
  173.                     } while (1..3 -notcontains $ADSub2ndChoice)
  174.                    
  175.                     IF ($ADSub2ndChoice -eq "2") {
  176.                    
  177.                         $LoopAD = "1"
  178.                         Break
  179.                    
  180.                     } ElseIf ($ADSub2ndChoice -eq "3") {
  181.                    
  182.                         ExitMessage
  183.                         $LoopMain = "1"
  184.                         Break Script
  185.                    
  186.                     }  Else {
  187.                    
  188.                         $ScriptChoice = "ForceADsToReplicate.ps1"
  189.                         $LoopAD = "1"
  190.                         $LoopMain = "1"
  191.                         Break
  192.                    
  193.                     }
  194.  
  195.                 } ElseIf ($ADSubMainChoice -eq "3") {
  196.                                
  197.                     $PathChoice = $pathADUser
  198.                    
  199.                     do {
  200.                    
  201.                     CLS
  202.                     Write-Host "********************************************" -ForegroundColor Cyan
  203.                     Write-Host "**                                        **" -ForegroundColor Cyan
  204.                     Write-Host "**  Active Directory User Management      **" -ForegroundColor Cyan
  205.                     Write-Host "**                                        **" -ForegroundColor Cyan
  206.                     Write-Host "**  Please choose one                     **" -ForegroundColor Cyan
  207.                     Write-Host "**                                        **" -ForegroundColor Cyan
  208.                     Write-Host "**  (1) Onboard an incoming user          **" -ForegroundColor Cyan
  209.                     Write-Host "**  (2) Offboard a departing user         **" -ForegroundColor Cyan
  210.                     Write-Host "**  (3) Copy Permissions from user A to B **" -ForegroundColor Cyan
  211.                     Write-Host "**  (4) Disable a user account            **" -ForegroundColor Cyan
  212.                     Write-Host "**  (5) Enable a user account             **" -ForegroundColor Cyan
  213.                     Write-Host "**  (6) Reset a user password             **" -ForegroundColor Cyan
  214.                     Write-Host "**  (7) Back                              **" -ForegroundColor Cyan
  215.                     Write-Host "**  (8) Exit                              **" -ForegroundColor Cyan
  216.                     Write-Host "**                                        **" -ForegroundColor Cyan
  217.                     Write-Host "********************************************" -ForegroundColor Cyan
  218.  
  219.                         $ADSub3rdChoice = Read-Host "AD User Management Script?"
  220.                        
  221.                     } while (1..8 -notcontains $ADSub3rdChoice)
  222.                    
  223.                     IF ($ADSub3rdChoice -eq "7") {
  224.                    
  225.                         $LoopAD = "1"
  226.                         Break
  227.                    
  228.                     } ElseIf ($ADSub3rdChoice -eq "8") {
  229.  
  230.                         ExitMessage
  231.                         $LoopMain = "1"
  232.                         Break Script
  233.                    
  234.                     } Else {
  235.                    
  236.                         $ScriptArray = "Onboarding and Offboarding\AD-OnboardincomingUser++.ps1","Onboarding and Offboarding\AD-OffboardDepartingUser++.ps1","AD-CopyPermissionsFromAtoB.ps1","AD-DisableUserAccount.ps1","AD-EnableUserAccount.ps1","AD-ResetUserPassword.ps1"
  237.                         $ScriptChoice = $ScriptArray[$ADSub3rdChoice -1]
  238.                         $LoopAD = "1"
  239.                         $LoopMain = "1"
  240.                         Break
  241.                    
  242.                     }
  243.                    
  244.                 } ElseIf ($ADSubMainChoice -eq "4") {
  245.  
  246.                     $LoopAD = "1"
  247.                     Break
  248.  
  249.                 } Else {
  250.                
  251.                         ExitMessage
  252.                         $LoopMain = "1"
  253.                         Break Script
  254.                    
  255.                 }
  256.            
  257.             }
  258.            
  259.         <# --- Exchange Main Menu Loop --- #>
  260.         } ElseIf ($MainChoice -eq "2") {
  261.            
  262.             do {
  263.            
  264.             CLS
  265.             Write-Host "********************************************" -ForegroundColor Yellow
  266.             Write-Host "**  Please choose Exchange Group          **" -ForegroundColor Yellow
  267.             Write-Host "**                                        **" -ForegroundColor Yellow
  268.             Write-Host "**  Please choose one                     **" -ForegroundColor Yellow
  269.             Write-Host "**                                        **" -ForegroundColor Yellow
  270.             Write-Host "**  (1) EX Auditing                       **" -ForegroundColor Yellow
  271.             Write-Host "**  (2) EX Management                     **" -ForegroundColor Yellow
  272.             Write-Host "**  (3) EX User management                **" -ForegroundColor Yellow
  273.             Write-Host "**  (4) Back                              **" -ForegroundColor Yellow
  274.             Write-Host "**  (5) Exit                              **" -ForegroundColor Yellow
  275.             Write-Host "**                                        **" -ForegroundColor Yellow
  276.             Write-Host "********************************************" -ForegroundColor Yellow
  277.  
  278.                 $EXSubMainChoice = Read-Host "Exchange menu choice?"
  279.                
  280.             } while (1..5 -notcontains $EXSubMainChoice)
  281.            
  282.                 <# --- Exchange Menu Choice Loop --- #>
  283.             While ($LoopEX -ne "1") {
  284.  
  285.                 If ($EXSubMainChoice -eq "1") {
  286.  
  287.                     $PathChoice = $pathExAudit
  288.                    
  289.                     do {
  290.                    
  291.                     CLS
  292.                     Write-Host "********************************************" -ForegroundColor Yellow
  293.                     Write-Host "**                                        **" -ForegroundColor Yellow
  294.                     Write-Host "**  Exchange Auditing                     **" -ForegroundColor Yellow
  295.                     Write-Host "**                                        **" -ForegroundColor Yellow
  296.                     Write-Host "**  Please choose one                     **" -ForegroundColor Yellow
  297.                     Write-Host "**                                        **" -ForegroundColor Yellow
  298.                     Write-Host "**  (1) Disable Exchange accounts of      **" -ForegroundColor Yellow
  299.                     Write-Host "**      disabled AD users                 **" -ForegroundColor Yellow
  300.                     Write-Host "**  (2) Hide disabled users from global   **" -ForegroundColor Yellow
  301.                     Write-Host "**      address list                      **" -ForegroundColor Yellow
  302.                     Write-Host "**  (3) Export disconnected mailboxes     **" -ForegroundColor Yellow
  303.                     Write-Host "**  (4) Top 10 biggest mailboxes          **" -ForegroundColor Yellow
  304.                     Write-Host "**  (5) Track an email send failure       **" -ForegroundColor Yellow
  305.                     Write-Host "**  (6) Back                              **" -ForegroundColor Yellow
  306.                     Write-Host "**  (7) Exit                              **" -ForegroundColor Yellow
  307.                     Write-Host "**                                        **" -ForegroundColor Yellow
  308.                     Write-Host "********************************************" -ForegroundColor Yellow
  309.  
  310.                         $EXSub1stChoice = Read-Host "EX Auditing Script?"
  311.                        
  312.                     } while (1..7 -notcontains $EXSub1stChoice)
  313.                    
  314.                     IF ($EXSub1stChoice -eq "6") {
  315.                    
  316.                         $LoopEX = "1"
  317.                         Break
  318.                    
  319.                     } ElseIf ($EXSub1stChoice -eq "7") {
  320.                    
  321.                         ExitMessage
  322.                         $LoopMain = "1"
  323.                         Break Script
  324.                    
  325.                     }  Else {
  326.                    
  327.                         $ScriptArray = "DisableEmailAccountsInAD-DisabledUsers.ps1","HideDisabledUsersFromGlobalAddressList.ps1","ExportDisconnectedMailBoxes.ps1","Top10Mailboxes.ps1","TrackEmailFailures.ps1"
  328.                         $ScriptChoice = $ScriptArray[$EXSub1stChoice -1]
  329.                         $LoopEX = "1"
  330.                         $LoopMain = "1"
  331.                         Break
  332.                        
  333.                     }
  334.  
  335.                 } ElseIf ($ExSubMainChoice -eq "2") {
  336.                
  337.                 $PathChoice = $pathExManagment
  338.                    
  339.                     do {
  340.                    
  341.                     CLS
  342.                     Write-Host "**********************************************" -ForegroundColor Yellow
  343.                     Write-Host "**                                          **" -ForegroundColor Yellow
  344.                     Write-Host "**  Exchange Management                     **" -ForegroundColor Yellow
  345.                     Write-Host "**                                          **" -ForegroundColor Yellow
  346.                     Write-Host "**  Please choose one                       **" -ForegroundColor Yellow
  347.                     Write-Host "**                                          **" -ForegroundColor Yellow
  348.                     Write-Host "**  (1) Add address to blocked senders      **" -ForegroundColor Yellow
  349.                     Write-Host "**  (2) Add address to bypass senders       **" -ForegroundColor Yellow
  350.                     Write-Host "**  (3) Domain to blocked Domains & Subs    **" -ForegroundColor Yellow
  351.                     Write-Host "**  (4) Add spam domains to block list      **" -ForegroundColor Yellow
  352.                     Write-Host "**  (5) Remove address from bypass senders  **" -ForegroundColor Yellow
  353.                     Write-Host "**  (6) Remove address from blocked senders **" -ForegroundColor Yellow
  354.                     Write-Host "**  (7) Remove domain from block list       **" -ForegroundColor Yellow
  355.                     Write-Host "**  (8) Export blocked domains (c:\temp\)   **" -ForegroundColor Yellow
  356.                     Write-Host "**  (9) Export blocked senders (c:\temp\)   **" -ForegroundColor Yellow
  357.                     Write-Host "**  (10) Export bypass senders (c:\temp\)   **" -ForegroundColor Yellow
  358.                     Write-Host "**  (11) Import bad domains    (c:\temp\)   **" -ForegroundColor Yellow
  359.                     Write-Host "**  (12) Back                               **" -ForegroundColor Yellow
  360.                     Write-Host "**  (13) Exit                               **" -ForegroundColor Yellow
  361.                     Write-Host "**                                          **" -ForegroundColor Yellow
  362.                     Write-Host "**********************************************" -ForegroundColor Yellow
  363.  
  364.                         $EXSub2ndChoice = Read-Host "EX Management Script?"
  365.                        
  366.                     } while (1..13 -notcontains $EXSub2ndChoice)
  367.                    
  368.                         IF ($EXSub2ndChoice -eq "12") {
  369.                        
  370.                             $LoopEX = "1"
  371.                             Break
  372.                        
  373.                         } ElseIf ($EXSub2ndChoice -eq "13") {
  374.                        
  375.                             ExitMessage
  376.                             $LoopMain = "1"
  377.                             Break Script
  378.                        
  379.                         }  Else {
  380.                        
  381.                             $ScriptArray = "Black & White Lists\AddAddressToBlockedSendersList.ps1","Black & White Lists\AddAddressToBypassedSendersList.ps1","Black & White Lists\AddSpamDomainsToBlockList.ps1","Black & White Lists\RemoveAddressFromBypassedSendersList.ps1","Black & White Lists\RemoveSenderFromBlockedSendersList.ps1","Black & White Lists\RemoveSpamDomainsFromBlockList.ps1","Black & White Lists\Import & Export\ExportBlockedDomainsList.ps1","Black & White Lists\Import & Export\ExportBlockedSendersList.ps1","Black & White Lists\Import & Export\ExportBypassedSendersList.ps1","Black & White Lists\Import & Export\ImportBadDomainsList.ps1"
  382.                             $ScriptChoice = $ScriptArray[$EXSub2ndChoice -1]
  383.                             $LoopEX = "1"
  384.                             $LoopMain = "1"
  385.                             Break
  386.                    
  387.                     }
  388.  
  389.                 } ElseIf ($ExSubMainChoice -eq "3") {
  390.  
  391.                 $PathChoice = $pathExUser
  392.                    
  393.                     do {
  394.                    
  395.                     CLS
  396.                     Write-Host "********************************************" -ForegroundColor Yellow
  397.                     Write-Host "**                                        **" -ForegroundColor Yellow
  398.                     Write-Host "**  Exchange User Account Management      **" -ForegroundColor Yellow
  399.                     Write-Host "**                                        **" -ForegroundColor Yellow
  400.                     Write-Host "**  Please choose one                     **" -ForegroundColor Yellow
  401.                     Write-Host "**                                        **" -ForegroundColor Yellow
  402.                     Write-Host "**  (1) Delete disabled user by GUID      **" -ForegroundColor Yellow
  403.                     Write-Host "**  (2) Delete user folder contents       **" -ForegroundColor Yellow
  404.                     Write-Host "**  (3) Discovery Search                  **" -ForegroundColor Yellow
  405.                     Write-Host "**  (4) Set Out-Of-Office reply           **" -ForegroundColor Yellow
  406.                     Write-Host "**  (5) Reconnect a disabled mailbox      **" -ForegroundColor Yellow
  407.                     Write-Host "**  (6) Reset a user's Role Ass. Policy   **" -ForegroundColor Yellow
  408.                     Write-Host "**  (7) Set a calendar reminder           **" -ForegroundColor Yellow
  409.                     Write-Host "**  (8) Back                              **" -ForegroundColor Yellow
  410.                     Write-Host "**  (9) Exit                              **" -ForegroundColor Yellow
  411.                     Write-Host "**                                        **" -ForegroundColor Yellow
  412.                     Write-Host "********************************************" -ForegroundColor Yellow
  413.  
  414.                         $EXSub3rdChoice = Read-Host "EX User Management Script?"
  415.                        
  416.                     } while (1..9 -notcontains $EXSub3rdChoice)
  417.                    
  418.                     IF ($EXSub3rdChoice -eq "8") {
  419.                    
  420.                         $LoopEX = "1"
  421.                         Break
  422.                    
  423.                     } ElseIf ($EXSub3rdChoice -eq "9") {
  424.                    
  425.                         ExitMessage
  426.                         $LoopMain = "1"
  427.                         Break Script
  428.                    
  429.                     }  Else {
  430.                    
  431.                         $ScriptArray = "DeleteDisabledUserByGUID.ps1","DeleteFolderContents.ps1","DiscoverySearchSimplified.ps1","OutOfOfficeReplyToBothExternalAndInternal-GUI.ps1","ReconnectDisabledMailbox.ps1","ResetUser'sRoleAssignmentPolicyInExchange.ps1","SetCalendarReminder.ps1"
  432.                         $ScriptChoice = $ScriptArray[$EXSub3rdChoice -1]
  433.                         $LoopEX = "1"
  434.                         $LoopMain = "1"
  435.                         Break
  436.                     }
  437.                    
  438.             } ElseIf ($ExSubMainChoice -eq "4") {
  439.  
  440.                 $LoopMain -ne "1"
  441.                 Break
  442.  
  443.             } Else {
  444.            
  445.                 ExitMessage
  446.                 $LoopMain = "1"
  447.                 Break Script
  448.                
  449.             }
  450.        
  451.         }
  452.        
  453.     } ElseIf ($MainChoice -eq "3") {
  454.        
  455.         <# --- Network Main Menu Loop --- #>
  456.        
  457.         While ($LoopNW -ne "1") {
  458.        
  459.             $PathChoice = $pathNetwork
  460.            
  461.             do {
  462.            
  463.             CLS
  464.             Write-Host "********************************************" -ForegroundColor Green
  465.             Write-Host "**                                        **" -ForegroundColor Green
  466.             Write-Host "**  Network User Management               **" -ForegroundColor Green
  467.             Write-Host "**                                        **" -ForegroundColor Green
  468.             Write-Host "**  Please choose one                     **" -ForegroundColor Green
  469.             Write-Host "**                                        **" -ForegroundColor Green
  470.             Write-Host "**  (1) Find computer user is logged into **" -ForegroundColor Green
  471.             Write-Host "**  (2) Log off -ALL- remote users        **" -ForegroundColor Green
  472.             Write-Host "**  (3) Log off remote user               **" -ForegroundColor Green
  473.             Write-Host "**  (4) Log off remote user 2             **" -ForegroundColor Green
  474.             Write-Host "**  (5) Enable winrm on remote computer   **" -ForegroundColor Green
  475.             Write-Host "**  (6) Show who and when last logged     **" -ForegroundColor Green
  476.             Write-Host "**      on to remote computer             **" -ForegroundColor Green
  477.             Write-Host "**  (7) Back                              **" -ForegroundColor Green
  478.             Write-Host "**  (8) Exit                              **" -ForegroundColor Green
  479.             Write-Host "**                                        **" -ForegroundColor Green
  480.             Write-Host "********************************************" -ForegroundColor Green
  481.  
  482.                 $NWSubMainChoice = Read-Host "Network menu choice?"
  483.                
  484.             } while (1..8 -notcontains $NWSubMainChoice)
  485.            
  486.             IF ($NWSubMainChoice -eq "7") {
  487.            
  488.                 $LoopNW = "1"
  489.                 Break
  490.            
  491.             } ElseIf ($NWSubMainChoice -eq "8") {
  492.            
  493.                 ExitMessage
  494.                 $LoopMain = "1"
  495.                 Break Script
  496.            
  497.             } Else {
  498.            
  499.                 $ScriptArray = "FindComputerUserLoggedInto.ps1","LogOffAllRemoteUsers.ps1","LogoffRemoteUser.ps1","LogoffRemoteUser2.ps1","remotely_enable_winrm.ps1","WhoLoggedOn.ps1"
  500.                 $ScriptChoice = $ScriptArray[$NWSubMainChoice -1]
  501.                 $LoopNW = "1"
  502.                 $LoopMain = "1"
  503.                 Break
  504.                
  505.             }
  506.            
  507.         }
  508.            
  509.     } ElseIf ($MainChoice -eq "4") {
  510.    
  511.         ExitMessage
  512.         $LoopMain = "1"
  513.         Break Script
  514.    
  515.     } Else {
  516.    
  517.         Break
  518.    
  519.     }
  520.  
  521. }
  522.  
  523. $path = $PathChoice + $ScriptChoice
  524.  
  525. cls
  526.  
  527. $params = "menu"
  528. &$path $params
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement