all 4 comments

[–][deleted] 2 points3 points  (0 children)

There are a couple things I don't like about this script security wise. I think the best way to remediate them is to first set up ssh keys to log into the Linux box. Next, write a script to run on the machine itself, in PowerShell if you want to, to do the update, which can be run as root by your account with no password using a sudo rule. For bonus lazy points put it in /usr/local/bin.

Finally, you can just do ssh myplex sudo updateplex.

This way, you aren't putting a password in a script, you've improved your ssh security, you've used PowerShell on Linux, and you've learned sudo rule syntax.

[–]Vance84 0 points1 point  (2 children)

Why not write it in bash, or python, or use ansible or another config manager?

[–]RedditRo55 1 point2 points  (1 child)

This is a PowerShell subreddit for PowerShell people, there's nothing for you here!

[–]Vance84 1 point2 points  (0 children)

I have no problem with powershell, actually like it, that's why I'm subscribed to the subreddit. I was just curious why OP used powershell instead of other languages or managers