Hide a Powershell box ? (composed of -ExecutionPolicy UnRestricted)

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 7 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Etmila
Posts: 5
Last visit: Mon Jul 18, 2016 5:33 pm

Hide a Powershell box ? (composed of -ExecutionPolicy UnRestricted)

Post by Etmila »

Hello

I have this script below, I didn't manage to hide the powershell, if I add -w hidden the script doesn't work
  1. powershell -ExecutionPolicy UnRestricted (new-object System.Net.WebClient).DownloadFile('http://d.7-zip.org/a/7z1601.exe','%TEMP%\7z1601.exe');&'%TEMP%\7z1601.exe'
Have you some ideas ?

Thanks in advance.

NB : The code is wrote in the execute box (windows + r)
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Hide a Powershell box ? (composed of -ExecutionPolicy UnRestricted)

Post by jvierra »

  1. powershell -WindowStyle Hidden -ExecutionPolicy Bypass -Command "$wc=new-object System.Net.WebClient;$file=Join-Path $env:TEMP 7z1601.exe;$wc.DownloadFile('http://d.7-zip.org/a/7z1601.exe',$file);& $file"
User avatar
Etmila
Posts: 5
Last visit: Mon Jul 18, 2016 5:33 pm

Re: Hide a Powershell box ? (composed of -ExecutionPolicy UnRestricted)

Post by Etmila »

Thank you jvierra. You understood and wrote exactly what I was looking for.

It helps me a lot to understand powershell scripts.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Hide a Powershell box ? (composed of -ExecutionPolicy UnRestricted)

Post by jvierra »

Keep scripting. It is very useful.
This topic is 7 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked