News, tips, advice, support for Windows, Office, PCs & more
Home icon Home icon Home icon Email icon RSS icon

We're community supported and proud of it!

  • Close-AllComputers

    Home Forums Developers, developers, developers DevOps Lounge Close-AllComputers

    • This topic has 2 replies, 1 voice, and was last updated 1 year ago.
    Viewing 2 reply threads
    • Author
      Posts
      • #2261552
        RetiredGeek
        AskWoody MVP

        Hey Y’all,

        Here’s my latest Covid-19 project.
        This PowerShell script will shutdown or reboot the computers on your local LAN.
        You must be sure your machines are properly setup for PowerShell remoting for it to work.

        Once you unzip the file and place it with your other PS scripts you can get the help file as follows:

        1. In a PS command window type:
        2. Get-Help [d:\path\]Close-AllComputers.ps1 -full

        You’ll want to modify the script to include the names of all your computers for the default operation of closing everyting.

        1. Look for this line in the script:
          Param(
          [Parameter(Mandatory=$False)]
          $Computer=
          @(“DELLXPS137000″,”DELLXPS8700″,”DELLXPS8920”,
          “JanetsLaptop”) ,
        2. Replace the existing computer names with the names of your computers. You can have as many as you want and they can be on multiple lines as long as each line ends with a comma and your don’t split quote marks.
        3. Save the script and you’re ready to go.

        2261553: Close-AllComputers
        .zip MD5 Hash: 428B507E21E25A95CDBED56D488685D5
        .ps1 MD5 Hash: DF1190B416BF404D589FD5A3EEE8A766

        Enjoy 😎

        May the Forces of good computing be with you!

        RG

        PowerShell & VBA Rule!
        Computer Specs

        • This topic was modified 1 year, 1 month ago by RetiredGeek.
        • This topic was modified 1 year, 1 month ago by RetiredGeek.
        • This topic was modified 1 year, 1 month ago by RetiredGeek.
      • #2261571
        RetiredGeek
        AskWoody MVP

        Hey Y’all,

        Please note that $Computer is spelled wrong in line 174. Please correct! Sorry about that! 😎

        May the Forces of good computing be with you!

        RG

        PowerShell & VBA Rule!
        Computer Specs

        1 user thanked author for this post.
      • #2273352
        RetiredGeek
        AskWoody MVP

        Hey Y’all,

        I’ve updated the program to grab the computer list form a NAS server, or could be onedrive I guess. This way you don’t have to play with the code.

        I’ve also instituted Parameter Sets so if you try to use the -Computer and/or -Exclusions parameters at the same time it won’t let you. In the previous version the help file warned against this but it was not enforced, now it is.

        2273353: Close-AllComputers
        .zip MD5 Hash: F5D6545643898E947E31A1ABF5674FD3
        .ps1 MD5 Hash: F38C6EE6A58FEAD551449281A54D96E0

        FYI: If you don’t have a NAS or file server you can just put your computer list on each machine or stick with the old version of the program.

        Note: You’ll also have to adjust one line in the program to point to your computer list (NetComps.txt).

        #Change:
        #--- Set the path for location of NetComps.txt ---
        $NetPath = "\\MYBOOKLIVE\CMShared\Misc"
        
        #To:
        #--- Set the path for location of NetComps.txt ---
        $NetPath = "Your Path to NetComps.txt"
        

        NetComps.Txt is a simple file created with NotePad or any plain text editor.
        Sample:

        DELLXPS137000
        DELLXPS8700
        DELLXPS8920
        JsLaptop
        

        HTH 😎

        May the Forces of good computing be with you!

        RG

        PowerShell & VBA Rule!
        Computer Specs

    Viewing 2 reply threads

    Please follow the -Lounge Rules- no personal attacks, no swearing, no politics or religion.

    Reply To: Close-AllComputers

    You can use BBCodes to format your content.
    Your account can't use Advanced BBCodes, they will be stripped before saving.