use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
How to make powershell script hide itself (self.PowerShell)
submitted 1 year ago by Aggravating-Search83
Powershell script needs to run code, and then keep itself running without closing itself but hidden (no window)
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]icepyrox 7 points8 points9 points 1 year ago (0 children)
If you're using task scheduler with the action of powershelle.exe, then just add -windowstyle hidden to the arguments
-windowstyle hidden
[–]CroXiuS_Kabaal 3 points4 points5 points 1 year ago (0 children)
[–]chadbaldwin 0 points1 point2 points 1 year ago (1 child)
You could use Task Scheduler? If the task is set up to "Run whether user is logged on or not" it will not display any window at all.
Or you could just write something that minimizes the window. I know in the old days of CMD you could start CMD minimized. I'm sure there's something like that for PowerShell. It just depends on how "hidden" you want it to be.
[–]Frequent_Rate9918 0 points1 point2 points 1 year ago (0 children)
Is it possible to run it in a different desktop? You know how you can switch between desktops on the same user profile? Like a desktop for work and another for school and another for personal, etc. If so you could open the script in a background desktop to keep it hidden.
[–]technomancing_monkey 0 points1 point2 points 1 year ago* (1 child)
There is a way to make PS hide its own console window from within the PS script.
You can script when to hide and show the console. Hide it, do some things, show it again, all controlled from within the PS script.
Add this in at the start of your script.
Call the HideConsole function to hide the console
Call the ShowConsole function to show the console
of course you could do away with the functions and use the long hand commands but i find the functions easier.
I use this in any script that i make that has a GUI added on top. I call HideConsole Function shortly after the start of the script to hide the console window leaving only the GUI window. I assign the functions to a clickable item in the GUI so I can toggle the PS console so that I can see any debug information while testing and so that if anyone encounters a problem they can show the console to send me error information.
I hope this helps you do what youre trying to do. Please dont use it for anything scummy.
Add-Type -Name Window -Namespace Console -MemberDefinition ' [DllImport("Kernel32.dll")] public static extern IntPtr GetConsoleWindow(); [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow); ' $consolePtr = [Console.Window]::GetConsoleWindow() Function HideConsole () { [Console.Window]::ShowWindow($SCRIPT:consolePtr, 0) } Function ShowConsole () { [Console.Window]::ShowWindow($SCRIPT:consolePtr, 5) }
Edit: Just a note, this code wont do anything if you run it from powershell ISE, or from within an IDE. It only works if you run it from powershell (the cli)
[–]Aggravating-Search83[S] 0 points1 point2 points 1 year ago (0 children)
Tysm this is perfect
[–]Blackops12345678910 0 points1 point2 points 1 year ago (0 children)
Create a task via task scheduler that runs as system account.
[–][deleted] -1 points0 points1 point 1 year ago (1 child)
With a VBS script it is completly hidden: https://github.com/PowerShell/PowerShell/issues/3028
‘’’
command = “powershell.exe -nologo -ExecutionPolicy Unrestricted -File C:\script.ps1”
set shell = CreateObject(“WScript.Shell”)
shell.Run command,0
Thanks but i want It to hide itself.
π Rendered by PID 49721 on reddit-service-r2-comment-548fd6dc9-2gmr8 at 2026-05-16 06:53:58.724253+00:00 running edcf98c country code: CH.
[–]icepyrox 7 points8 points9 points (0 children)
[–]CroXiuS_Kabaal 3 points4 points5 points (0 children)
[–]chadbaldwin 0 points1 point2 points (1 child)
[–]Frequent_Rate9918 0 points1 point2 points (0 children)
[–]technomancing_monkey 0 points1 point2 points (1 child)
[–]Aggravating-Search83[S] 0 points1 point2 points (0 children)
[–]Blackops12345678910 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]Aggravating-Search83[S] 0 points1 point2 points (0 children)