r/PowerShell • • Dec 31 '19

Helpdesk/Remote Support Powershell Script - Expedite frequent & repetitive helpdesk tasks

https://github.com/Justin-Lund/PS-Remote-Support
122 Upvotes

31 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Jan 01 '20

[deleted]

-4

u/uptimefordays Jan 01 '20

You can also Unblock-File which allows a file to run without changing Execution Policy.

1

u/Kaeny Jan 01 '20

Would i put that in the target field in the shortcut, or is that some attribute of the ps1 file?

9

u/mOjO_mOjO Jan 01 '20

Ignore. That's not correct info. Unblock-file will release the warning prompt you get from any downloaded file (not just PS). You know that prompt you get if you just downloaded an exe and run it saying it's from the internet and may not be safe (I totally forget the actual prompt) but there's a checkbox to never prompt again. That's what this command pertains to. You can also unblock the file by doing a properties on the freshly downloaded file and checking a box. This command just does that from PS. It has nothing to do with execution policy. That being said to run the downloaded script you'll probably need to unlock it first but if your execution policy doesn't permit running the script then you'll still have to mess with execution policy settings. In other words, these two things are independent of each other and serve different purposes.

1

u/Kaeny Jan 01 '20

Oh well aint that spooky.

Thanks for clearing things up

1

u/uptimefordays Jan 01 '20

Am I misreading this?

Example 7: Unblock a script to run it without changing the execution policy

This example shows how the RemoteSigned execution policy prevents you from running unsigned scripts.

A best practice is to read the script's code and verify it's safe before using the Unblock-File cmdlet. The Unblock-File cmdlet unblocks scripts so they can run, but doesn't change the execution policy.

It looks an awful lot like Microsoft's example WILL RUN not just ignore the warning if you Unblock-File

2

u/mOjO_mOjO Jan 01 '20

Keyword there is remote signed. Unblocking it just makes it no longer considered a remote file.

1

u/uptimefordays Jan 01 '20

Ah I see. I’m a remote signed kind of gal.

2

u/mOjO_mOjO Jan 01 '20

Yeah and that honestly may be the default setting making that advice true on a practical level (I don't remember the default as we set it by GPO) but still technically not the same thing as execution policy.

1

u/uptimefordays Jan 01 '20

Right and I wasn’t saying it was the same, just that it looks like you can execute unsigned but verified code without changing execution policy. Correct me if I’m wrong, but it’s my understanding you can also save your code as modules and run them without changing policy.

→ More replies (0)