How do you develop scripts that can only run on a remote system?

Welcome Forums General PowerShell Q&A How do you develop scripts that can only run on a remote system?

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

 
Participant
2 years, 5 months ago.

  • Author
    Posts
  • #43971

    Participant
    Points: 1
    Rank: Member

    Hi everyone,

    I'm currently solving this problem by logging to the desktop of a remote system and developing my script with ISE there. I don't believe this is the right way to go about it but I don't know how else to do it.

    Using a remote session doesn't always work because I sometimes rely on the local filesystem of the remote machine.

    Another problem with this method of script development is that it disconnects me from my local script repo. I have yet to create a copy of my repo on the remote machines because that too seems like the wrong way to go about it.

    I'm sure I'm not unique in having this problem. What do you do to solve it?

    Thanks!
    Chris

  • #43975

    Keymaster
    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    Develop the script locally. Deploy it via Invoke-Command, which has a file path parameter. That's a local path to the script, which is then transmitted to the remote machine and run there, with full access to its local resources.

    • #44075

      Participant
      Points: 1
      Rank: Member

      Well that sounds like just what I'll have to do. Thanks.

  • #43981

    Participant
    Points: 0
    Rank: Member

    If I understand this correctly, I have a similar experience to this and do have a workaround but may not be ideal in many cases.

    We do not have a VPN (yet) but we do have a Documents Redirect GPO where my script repo is synced to the server. This allows me to remote into my desktop (out-of-band), from my laptop, to access ISE for script development and local testing. When my laptop is connected to the corporate network, the scripts are updated on it via GPO. If I am desperate, I'll manually copy the changes to my laptop if I can't wait for the next time I'm at the office.

  • #44029

    Participant
    Points: 21
    Rank: Member

    I use sapien which has an option to import the remote machine modules.

    Developing PowerShell scripts for other machines (Part 2)

The topic ‘How do you develop scripts that can only run on a remote system?’ is closed to new replies.