guidance on how to remotely run powershell function, please

Welcome Forums General PowerShell Q&A guidance on how to remotely run powershell function, please

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
3 years, 8 months ago.

  • Author
    Posts
  • #22749

    Participant
    Points: 0
    Rank: Member

    I am working on automating WSUS updates.

    I have a simple, basic script here that I can use:

    It's also a function, which is good 🙂

    My desire is to run the function remotely upon an array of servers, like so:

    foreach in $servers array, e.g. foreach ($server in $servers) {

    ** properly connect to server

    run the wsus update function

    sleep/wait a few minutes

    next server

    Is this a good way to do this and what code do I need to ** properly connect to the server??

    What is the proper code for server connection such that I can use $server and not the actual server name??

    Thank you, Tom

  • #22765

    Participant
    Points: 5
    Published
    Rank: Member

    Hi Tom,

    Best thing i can recommend is to take a look at the free ebook Secrets of PowerShell remoting.

    You can find it via Resources / Free E-Books on this site or directly via :

    https://www.penflip.com/powershellorg/secrets-of-powershell-remoting

  • #22767

    Participant
    Points: 0
    Rank: Member

    OIC — found and downloaded.

    Seems what I must do now is write a test script and practice having it run remotely on the servers, then work on the WSUS stuff.

    Thank you, Tom

The topic ‘guidance on how to remotely run powershell function, please’ is closed to new replies.