{"id":76231,"date":"2016-01-15T00:01:00","date_gmt":"2016-01-15T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/01\/15\/working-with-windows-startup-processes-and-powershell\/"},"modified":"2019-02-18T09:20:16","modified_gmt":"2019-02-18T16:20:16","slug":"working-with-windows-startup-processes-and-powershell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/working-with-windows-startup-processes-and-powershell\/","title":{"rendered":"Working with Windows Startup Processes and PowerShell"},"content":{"rendered":"<p><b>Summary<\/b>: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to examine startup processes in Windows&nbsp;10.<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. This morning I am playing with the Xbox One Smart Glass app on Windows 10. I have used the app since it was in beta, and I just got my Xbox One. But I have started using the Pandora app on my Xbox One, and I like to do stuff like mute advertisements, skip boring songs, change stations, and otherwise control the app.<\/p>\n<p>Yeah, I can use my Xbox controller, and with a recent firmware update, it does connect faster, and has better battery life, but it is bulky on my workstation. I wanted something better, so I updated the Xbox One Smart Glass app. It works great. It connects fast, and I can do everything I want to do. Here is the screen layout:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3581.HSG-1-15-16-01.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3581.HSG-1-15-16-01.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>I click the little remote control icon in the lower-right corner, and it opens an Xbox controller emulator that permits me to completely move around and do what I need to do. When I am done, I close it. Because it connects really fast, I don&rsquo;t worry about having access to it. I pinned it to my Windows&nbsp;10 start screen, so it is available. Cool. Some things just work.<\/p>\n<h2>The proliferating startup process problem<\/h2>\n<p>Some things just work, and then there are some things that seem to remain a pain. Windows startup applications are such a pain point&mdash;at least for me. I recently installed a new printer (which did not seem to have a driver, and instead required a quarter-gigabyte monolithic installation, and once installed, immediately required updating&hellip;yeah I know, I am a whiner) and a few other things required for work.<\/p>\n<p>This morning I turned on my laptop, and behold! I was greeted with a notice that said I had so many startup applications that they were killing my poor three-year-old laptop&hellip;or words to that effect.<\/p>\n<p>So I launched <b>Task Manager<\/b>, went to the <b>Startup<\/b> tab, and disabled a bunch of startup applications:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1323.HSG-1-15-16-02.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1323.HSG-1-15-16-02.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<h2>Using PowerShell to find startup processes<\/h2>\n<p>After I had disabled some startup processes via <b>Task Manager<\/b>, I decided to check on some other processes. I used Windows PowerShell to produce a list of startup processes. The command uses the <b>Win32_StartUpCommand<\/b> WMI class. To access this, I use the <b>Get-CimInstance<\/b> cmdlet (<b>gcim<\/b> is an alias):<\/p>\n<p style=\"margin-left:30px\">gcim win32_startupcommand<\/p>\n<p>The command and its output are shown here:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1055.HSG-1-15-16-03.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1055.HSG-1-15-16-03.png\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>Hmmm. It looks like some of the processes I disabled are still running. Bummer. But before I throw my poor little laptop across the room and possibly break something (other than my laptop), I decide to use another WMI class to investigate things further.<\/p>\n<p>This time I use the <b>Win32_Process<\/b> WMI class because it has the <b>CommandLine<\/b> property that will show me what command line is used to start a particular process. I can match that with the <b>Command<\/b> property from <b>Win32_StartupCommand<\/b>. There are a lot of processes running in Windows&nbsp;10, and I want to filter some. First of all, I look for a command line that contains <b>OneDrive<\/b>:<\/p>\n<p style=\"margin-left:30px\">gcim win32_process | where commandline -match &#039;onedrive&#039;<\/p>\n<p>Well, what about Lync?<\/p>\n<p style=\"margin-left:30px\">gcim win32_process | where commandline -match &#039;lync&#039;<\/p>\n<p>Neither of these appear. So I decide to do a more generic Lenovo query. The output is shown here:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; gcim win32_process | where commandline -match &#039;lenovo&#039;<\/p>\n<p style=\"margin-left:30px\">ProcessId Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HandleCount WorkingSetSize VirtualSize<\/p>\n<p style=\"margin-left:30px\">&#8212;&#8212;&#8212; &#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;<\/p>\n<p style=\"margin-left:30px\">2660&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tphkload.exe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 233&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5353472&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 87777280&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">2668&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; micmute.exe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 187&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2768896&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 76730368&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">4032&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tpnumlkd.exe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 132&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2363392&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 62742528&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">4376&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tposd.exe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 111&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2011136&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 86228992&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">1288&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; shtctky.exe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 130&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1716224&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 93081600&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">5808&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SynLenovoHelper.exe 129&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2801664&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 90853376&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">6992&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RAVBg64.exe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 264&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6230016&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 119590912&nbsp;<\/p>\n<p>It appears that even though some of startup applications are listed, <b>Task Manager<\/b> is effectively disabling the apps. Cool. So sometimes things actually do work.<\/p>\n<p>That is all there is to using Windows PowerShell to examine startup processes. Join me tomorrow when I will talk about <a href=\"http:\/\/powershellsaturday.com\/010\/\" target=\"_blank\">PowerShell Saturday in Tampa<\/a>.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to examine startup processes in Windows&nbsp;10. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am playing with the Xbox One Smart Glass app on Windows 10. I have used the app since it was in beta, and I just got my Xbox [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[385,87,3,45,6],"class_list":["post-76231","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-cim","tag-processes","tag-scripting-guy","tag-windows-powershell","tag-wmi"],"acf":[],"blog_post_summary":"<p>Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to examine startup processes in Windows&nbsp;10. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am playing with the Xbox One Smart Glass app on Windows 10. I have used the app since it was in beta, and I just got my Xbox [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/76231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=76231"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/76231\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=76231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=76231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=76231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}