<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Scripting Archives - Jim Dolby</title>
	<atom:link href="https://jim.dolby.id.au/tips/scripting/feed" rel="self" type="application/rss+xml" />
	<link>https://jim.dolby.id.au/./tips/scripting</link>
	<description>A Geek and still proud of it!</description>
	<lastBuildDate>Thu, 17 Jun 2021 09:06:35 +0000</lastBuildDate>
	<language>en-AU</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">195341223</site>	<item>
		<title>Remove preinstalled window 10 apps for all users using powershell</title>
		<link>https://jim.dolby.id.au/tips/windows/remove-preinstalled-window-10-apps-for-all-users-using-powershell.html</link>
		
		<dc:creator><![CDATA[YTS_Jim]]></dc:creator>
		<pubDate>Wed, 03 Jun 2020 07:53:33 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Windows Tips]]></category>
		<category><![CDATA[Default Apps]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Windows 10]]></category>
		<guid isPermaLink="false">https://www.securetech.com.au/?p=295</guid>

					<description><![CDATA[<p>To remove the apps that come pre-installed with windows 10, open a powershell window as Administrator, and paste the following</p>
<p>The post <a href="https://jim.dolby.id.au/tips/windows/remove-preinstalled-window-10-apps-for-all-users-using-powershell.html">Remove preinstalled window 10 apps for all users using powershell</a> appeared first on <a href="https://jim.dolby.id.au">Jim Dolby</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>We all need Remove preinstalled window 10 apps for all users at some point. We can do this using powershell. The list on this page is hard to keep current, but running the following code will give you a list of the names of your currently installed packages and you can remove what you think isn&#8217;t required. It is fairly easy to re-install if required, but we still advise caution.</p>



<pre class="wp-block-code"><code>Get-AppxPackage -AllUsers | Select Name</code></pre>



<p>To remove the preinstalled windows 10 apps for all users using powershell, open <a href="https://en.wikipedia.org/wiki/PowerShell">powershell</a> as Administrator, and paste the following.</p>



<pre class="wp-block-code"><code>#Be careful with the first line ... you may want to keep the windows store installed as alot of applications come through there now, rather than direct installs.
#Get-appxpackage -allusers windowsstore | install-appxpackage
Get-appxpackage -allusers xboxapp | remove-appxpackage
Get-appxpackage -allusers 3dbuilder | remove-appxpackage
Get-appxpackage -allusers zune | remove-appxpackage
Get-appxpackage -AllUsers camera | remove-appxpackage
Get-appxpackage -AllUsers solitaire | remove-appxpackage
Get-appxpackage -AllUsers bing | remove-appxpackage
Get-appxpackage -AllUsers getstarted | remove-appxpackage
Get-appxpackage -AllUsers photos | remove-appxpackage
Get-appxpackage -allusers alarms | remove-appxpackage
Get-appxpackage -allusers skype | remove-appxpackage
Get-appxpackage -allusers phone | remove-appxpackage
Get-appxpackage -allusers maps | remove-appxpackage
Get-appxpackage -allusers people | remove-appxpackage
Get-appxpackage -allusers messaging | remove-appxpackage
Get-appxpackage -allusers connectivity | remove-appxpackage
Get-appxpackage -allusers communication | remove-appxpackage
Get-appxpackage -allusers candy | remove-appxpackage
Get-appxpackage -AllUsers office | Remove-AppxPackage
Get-appxpackage -AllUsers twitter | Remove-AppxPackage</code></pre>



<p>If you didn&#8217;t actually read the above before copying and pasting (as we may or may not have done), you will need to re-install the store if you want it (which is likely):</p>



<pre class="wp-block-code"><code>Get-AppXPackage WindowsStore -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}</code></pre>



<p>To Add singular packages back in, use the following code</p>



<pre class="wp-block-code"><code>Get-appxpackage -allusers twitter | install-appxpackage</code></pre>



<p><a href="https://www.securetech.com.au/tag/powershell">Powershell</a> is an amazing thing that allows the reasonably knowledgeable person to do many functions easily which would normally require alot more time and or effort.</p>



<p>Microsoft also has a great resource on what apps are installed, system apps and if not on the list are therefore removable &#8230; <a href="https://docs.microsoft.com/en-us/windows/application-management/apps-in-windows-10">Windows 10 &#8211; Apps &#8211; Windows Application Management | Microsoft Docs</a></p>



<h2 class="wp-block-heading">Update 2021</h2>



<p>The following list is one that I have found on a newly installed win10 machine and most of the problematic apps where removed. it should be noted that when i re-ran the list and found most of the apps still installed, so im working on a way to remove the likes of skype &#8230; good old microsoft, always doing what it thinks is right by us, despite being told to remove an app and actually showing it as removing, the app doesn&#8217;t remove &#8230; go figure.</p>



<pre class="wp-block-code"><code>Get-AppxPackage -AllUsers Microsoft.GetHelp | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.Windows.Photos | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.WindowsAlarms | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.WindowsCalculator | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.WindowsCamera | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.WindowsMaps | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.WindowsSoundRecorder | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.Xbox.TCUI | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.XboxGameOverlay | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.XboxGamingOverlay | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.XboxIdentityProvider | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.XboxSpeechToTextOverlay | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.YourPhone | Remove-AppPackage
Get-AppxPackage -AllUsers SpotifyAB.SpotifyMusic | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.XboxApp | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.MixedReality.Portal | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.Microsoft3DViewer | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.Getstarted | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.ZuneVideo | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.ZuneMusic | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.BingWeather | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.WindowsFeedbackHub | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.MicrosoftSolitaireCollection | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.MicrosoftStickyNotes | Remove-AppPackage
Get-AppxPackage -AllUsers Microsoft.SkypeApp | Remove-AppPackage
</code></pre>



<p></p>
<p>The post <a href="https://jim.dolby.id.au/tips/windows/remove-preinstalled-window-10-apps-for-all-users-using-powershell.html">Remove preinstalled window 10 apps for all users using powershell</a> appeared first on <a href="https://jim.dolby.id.au">Jim Dolby</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">295</post-id>	</item>
		<item>
		<title>Remotely Lock &#038; Shutdown computers using PowerShell</title>
		<link>https://jim.dolby.id.au/tips/remotely-lock-shutdown-computers-using-powershell.html</link>
		
		<dc:creator><![CDATA[YTS_Jim]]></dc:creator>
		<pubDate>Sun, 22 Sep 2019 00:18:56 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Windows Tips]]></category>
		<category><![CDATA[lockdown]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[shutdown]]></category>
		<category><![CDATA[Windows 10]]></category>
		<guid isPermaLink="false">https://www.securetech.com.au/?p=191</guid>

					<description><![CDATA[<p>PowerShell takes the functionality of batch scripts to the next level and allows you to Remotely Lock &#38; Shutdown computers using PowerShell. The following needs to be run on each computer if using a workgroup setup. or changed in your AD security policy (to make it permanent – which isn’t advisable without signing the script) [&#8230;]</p>
<p>The post <a href="https://jim.dolby.id.au/tips/remotely-lock-shutdown-computers-using-powershell.html">Remotely Lock &#038; Shutdown computers using PowerShell</a> appeared first on <a href="https://jim.dolby.id.au">Jim Dolby</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p><a href="https://www.securetech.com.au/tag/powershell">PowerShell</a> takes the functionality of batch scripts to the next level and allows you to Remotely Lock &amp; Shutdown computers using PowerShell. </p>



<p>The following needs to be run on each computer if using a workgroup setup. or changed in your AD security policy (to make it permanent – which isn’t advisable without signing the script) </p>



<p><a href="https://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/">https://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/</a></p>



<pre class="wp-block-code"><code>Enable-PSRemoting
Set-executionpolicy unrestricted
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "192.168.1.250" -Force 
Get-Item WSMan:\localhost\Client\TrustedHosts
Restart-Service WinRM</code></pre>



<p>The above does the following:<br><code>Enable-PSRemoting</code> sets up the policies and firewalls to allow remote connections using powershell<br><code>Set-executionpolicy unrestricted</code> changes the local execution policy to allow execution of all scripts (not just signed)<br><code>Set-Item WSMan:\localhost\Client\TrustedHosts -Value "192.168.1.250" -Force</code> Adds server IP into the trustedhosts to allow execution<br><code>Restart-Service WinRM</code> restarts windows remote management service</p>



<p>We are assuming that your server IP is 192.168.1.250, change as appropriate</p>



<p>Now to the actual shutdown code that will be run from our &#8220;Server&#8221;:</p>



<pre class="wp-block-code"><code>Function Get-MyCredential{
 param(
 [string]$username,
 [string]$password
 )

 $secStr = new-object -typename System.Security.SecureString
 $password.ToCharArray() | ForEach-Object {$secStr.AppendChar($_)}
 return new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$secStr
}
Function Lock-Machine{
 param(
 $machineName
 )

 &amp; winrm set winrm/config/client `@`{TrustedHosts = `"$machineName`"`}
 Invoke-Command -ComputerName $machineName -ScriptBlock { tsdiscon.exe console } -Credential (Get-MyCredential User Pa$W0rd)
 }
Function Hibernate-Machine{
 param(
 $machineName
 )

 &amp; winrm set winrm/config/client `@`{TrustedHosts = `"$machineName`"`}
 Invoke-Command -ComputerName $machineName -ScriptBlock { &amp;"$env:SystemRoot\System32\rundll32.exe" powrprof.dll,SetSuspendState Hibernate } -Credential (Get-MyCredential Administrator password)
}
Lock-Machine "192.168.1.84"
#Lock-Workstation "NameOfTheComputer" (Get-Credential)
Stop-Computer -ComputerName 192.168.1.85 -Force -Credential (Get-MyCredential User Pa$W0rd)</code></pre>



<p></p>
<p>The post <a href="https://jim.dolby.id.au/tips/remotely-lock-shutdown-computers-using-powershell.html">Remotely Lock &#038; Shutdown computers using PowerShell</a> appeared first on <a href="https://jim.dolby.id.au">Jim Dolby</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">191</post-id>	</item>
		<item>
		<title>Relaunching a windows app using a batch script</title>
		<link>https://jim.dolby.id.au/tips/relaunching-a-windows-app-using-a-batch-script.html</link>
		
		<dc:creator><![CDATA[YTS_Jim]]></dc:creator>
		<pubDate>Sat, 21 Sep 2019 13:26:38 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Windows Tips]]></category>
		<category><![CDATA[Batch Script]]></category>
		<category><![CDATA[restart app]]></category>
		<category><![CDATA[Windows 10]]></category>
		<guid isPermaLink="false">https://www.securetech.com.au/?p=187</guid>

					<description><![CDATA[<p>We recently had need to restart an app server exe automatically when the demonstration license it was running on caused the server to close regularly, annoying everyone trying to learn the system. We had need of a script (YAY) to check if it was running and restart it when required. Requirements: Check to see if [&#8230;]</p>
<p>The post <a href="https://jim.dolby.id.au/tips/relaunching-a-windows-app-using-a-batch-script.html">Relaunching a windows app using a batch script</a> appeared first on <a href="https://jim.dolby.id.au">Jim Dolby</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We recently had need to restart an app server exe automatically when the demonstration license it was running on caused the server to close regularly, annoying everyone trying to learn the system. We had need of a script (YAY) to check if it was running and restart it when required.</p>
<h2>Requirements:</h2>
<ol>
<li>Check to see if the app is running on start if not running, start it.</li>
<li>wait for some period of time (60 seconds)</li>
<li>Check to see if the app is running, if not running, start it</li>
</ol>
<h2>Flourishes:</h2>
<ol>
<li>Date app last restarted is displayed in title</li>
<li>ability to close script with a button press</li>
<li>ability to cancel wait time and relaunch app now</li>
<li>ability to log when app was restarted</li>
</ol>
<h2>Working on it:</h2>
<h3>checking if a process is running:</h3>
<p>It turns out that checking if a process is running is relatively easy:</p>
<p><pre>tasklist /FI "IMAGENAME eq appServer.exe" | findstr "appServer.exe"
if %ERRORLEVEL% == 1 Echo No server Process found
if %ERRORLEVEL% == 1 goto start
</pre>
<p>and of course, now you have to choose:</p>
<p><pre>choice /T 60 /D y /C YABCDEFGHIJKLMNOPQRSTUVWXZ /N &gt;NUL
if %ERRORLEVEL% == 1 goto loop</pre>
<p>now we start the exe</p>
<p><pre>start "" "C:\Program Files (x86)\AppVision 4.0\Bin\appServer.exe"</pre>
<p>Set the title</p>
<p><pre>title appServer (re)Started at %NowDate% %NowTime% (Press X to exit script before closing appServer.exe)</pre>
<h2>Pulling it all together:</h2>
<p><pre>@echo off
title appServer (re)Launching script started at %time:~0,2%_%time:~3,2%_%time:~6,2% (Press X to exit script before closing appServer.exe)
pushd "C:\Program Files (x86)\AppVision 4.0\Bin"

:loop
timeout 2 &gt;NUL
rem ping 127.0.0.1 -n 2 &gt;NUL
echo.
tasklist /FI "IMAGENAME eq appServer.exe" | findstr "appServer.exe"
if %ERRORLEVEL% == 1 Echo No server Process found
if %ERRORLEVEL% == 1 goto start
echo Server process found at %time%, waiting 60 seconds
echo.
rem timeout 60
rem ping 127.0.0.1 -n 30 &gt;NUL
choice /T 60 /D y /C YABCDEFGHIJKLMNOPQRSTUVWXZ /N &gt;NUL
rem echo %ERRORLEVEL%
if %ERRORLEVEL% == 1 goto loop
goto eof

:start
set NowTime=%time:~0,2%_%time:~3,2%_%time:~6,2%
set NowDate=%date:~10,4%_%date:~4,2%_%date:~7,2%

cls
echo starting
start "" "C:\Program Files (x86)\AppVision 4.0\Bin\appServer.exe"
title appServer (re)Started at %NowDate% %NowTime% (Press X to exit script before closing appServer.exe)
choice /T 10 /D y /C YABCDEFGHIJKLMNOPQRSTUVWXZ /N &gt;NUL
rem ping 127.0.0.1 -n 11 &gt;NUL
goto loop

:eof
popd
echo script finished due to keypress
rem pause</pre>
<p>The post <a href="https://jim.dolby.id.au/tips/relaunching-a-windows-app-using-a-batch-script.html">Relaunching a windows app using a batch script</a> appeared first on <a href="https://jim.dolby.id.au">Jim Dolby</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">187</post-id>	</item>
		<item>
		<title>Pausing a Batch script</title>
		<link>https://jim.dolby.id.au/tips/pausing-a-batch-script.html</link>
		
		<dc:creator><![CDATA[YTS_Jim]]></dc:creator>
		<pubDate>Sat, 14 Sep 2019 08:39:00 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Batch Script]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[Windows 10]]></category>
		<guid isPermaLink="false">https://www.securetech.com.au/?p=185</guid>

					<description><![CDATA[<p>Those of you that still use batch scripts (and why not … they are backwards compatible to older systems), will occasionally need to pause a script...</p>
<p>The post <a href="https://jim.dolby.id.au/tips/pausing-a-batch-script.html">Pausing a Batch script</a> appeared first on <a href="https://jim.dolby.id.au">Jim Dolby</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Those of you that still use batch scripts (and why not … they are backwards compatible to older systems), will occasionally need to pause a script to wait for something to start or finish or just because.</p>



<p>There are various different ways to accomplish this. My current favourite is:</p>



<pre class="wp-block-code"><code>choice /T 60 /D y /C YABCDEFGHIJKLMNOPQRSTUVWXZ /N >NUL</code></pre>
<p>The post <a href="https://jim.dolby.id.au/tips/pausing-a-batch-script.html">Pausing a Batch script</a> appeared first on <a href="https://jim.dolby.id.au">Jim Dolby</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">185</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)

Served from: jim.dolby.id.au @ 2026-04-06 22:03:08 by W3 Total Cache
-->