guidance on how to remotely run powershell function, please

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of tommls tommls 1 year, 9 months ago.

  • Author
    Posts
  • #22749
    Profile photo of tommls
    tommls
    Participant

    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
    Profile photo of Tim Pringle
    Tim Pringle
    Participant

    Hi Tom,

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

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

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

  • #22767
    Profile photo of tommls
    tommls
    Participant

    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

You must be logged in to reply to this topic.