PowerShell Function Comma List and Text File

email me

Function Get-CompSysInfo {
     param(
     [string[]]$ComputerName
)
     BEGIN {}
     PROCESS {
         if ($_ -ne $null) {
         $ComputerName = $_
         }
           
           #foreach used for comma list
           foreach ($computer in $ComputerName) {
            #returns info on computer - could be another wmi object     
            get-wmiobject -Class win32_computersystem -ComputerName $Computer |
               Select-Object -Property Name,Manufacturer,Model
          }
     }
     END {}
}

# from comma list
# Get-CompSystemInfo -ComputerName PC_1, PC_2, PC_3

# from text file
Get-Content C:\Computerlist.txt | Get-CompSysInfo

Windows 10 Cannot Enable PowerShell Scripting

email me

Something strange happened to me when I was working on some automation for Windows 10. No matter what I did, PowerShell scripting would not enable. See below.

Error

File C:\Setup\Test.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see “get- help about_signing” for more details. At line:1

 

Fix

Step 1
Open registry, Start > Run > Regedit

Step 2
Navigate to HKLM\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell

Step 3
Create ExecutionPolicy as REG_SZ, with value RemoteSigned

Step 4
Open PowerShell and run Get-ExecutionPolicy to verify it is working

 

Notes

If you’re doing an upgrade, make sure you add the above reg key before upgrading.

PowerShell ByPass Execution Policy

email me

The Set-ExecutionPolicy cmdlet enables you to determine which Windows PowerShell scripts (if any) will be allowed to run on your computer. Windows PowerShell has four different execution policies:

  • Restricted – No scripts can be run. Windows PowerShell can be used only in interactive mode.
  • AllSigned – Only scripts signed by a trusted publisher can be run.
  • RemoteSigned – Downloaded scripts must be signed by a trusted publisher before they can be run.
  • Unrestricted – No restrictions; all Windows PowerShell scripts can be run.

But, automating certain sequences, you may not want to modify the current execution policy. To launch scripts in an elevated status, without changing the policy, you can run the following—which points to your script

powershell -ExecutionPolicy ByPass -File YourScript.ps1

 

Notes

Powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File “YourScript.ps1”

Powershell -noprofile -executionpolicy bypass -file “YourScript.ps1”

Create Windows 10 Profiles from Default Profile

email me

You used to have the ability to copy/paste a reference user profile into the C:\Users\Default folder, and all the profile settings could be applied to a new user when they first logged in. This process doesn’t quite work anymore, but…still, I wanted to try it.

 

DISCLAIMER

This method was for testing only…and is not recommended for the enterprise.

Since Windows 8, Microsoft now uses unique file association hashes in the registry, known as UserChoice, as well as a tile database for the Start Menu. If you copy a profile using the old Windows 7 method, all kinds of anomalous things transpire, like broken app associations, and busted, non-functional Start Menus. 

 

moving on…

 

Log into the Admin profile. Launch the User account console. Enable the disabled Default user account.

 

Create a new user.

 

Name that user Reference — to be used as our reference profile

 

Set password.

 

Create a new user. User1 will be our test user, to make sure the Default profile is working properly.

 

Make sure ‘Show hidden files, folders, and drives’ is enabled in the File Explorer Options.

 

Next, right click on the Reference profile > Properties > Security > Advanced. You’re going to change the owner from SYSTEM to everyone.

 

Select the Replace all child objects…

 

Now log into the Reference Profile

 

By default, Microsoft includes a ton of bloatware you don’t want. See picture.
Configure all settings, wallpaper, themes, and the menu layout. Log out.

 

Log back into the Admin profile. Go to C:\Users\Reference — Cut the contents.

 

Paste the contents into the Default profile

 

To test, log into the User1 profile. A new user profile will be generated from the Default profile.

 

All the settings and layout have been successfully created in the User1 profile. Click pic to zoom.

 

Notes

If you have problems, look into the C:\Users\Default\AppData\Local\Microsoft\Windows folder. There is a chance that certain settings and configs may lockup the profile…or cause other anomalies like Taskbar loading issues, Tiles not working right, or applications not loading from Start Menu.

There are also plenty of things to explore for in the Microsoft\Windows folder. For example, WinX is where Microsoft keeps the Win-X pop up menu when you right click on the Start Button: In that folder is a Group 1, Group 2, and Group 3 folder—they contain shortcuts. There are registry methods for making custom changed, or…just use this Win-X toolmirror.

 

Customization Links

How to Create Hardware Independent System Image for Installing Windows 10

How to Add or Remove Programs from Win+X Menu in Windows 10

Customize Windows 10 Start with Group Policy

Customizing the Windows 10 Start Menu and add IE Shortcut during OSD

How to Add or Remove Programs from Win+X Menu in Windows 10

Customizing the Taskbar in Windows 10 during OSD

Custom Start Menu in Windows 10

email me

To customize the Start Menu in your images, you need to export a ‘reference’ Start Menu using the Export-StartLayout PowerShell cmdlet.

Export Command
Use a computer, setup the Start Menu exactly the way you want it, and then export the layout.

Export-StartLayout –path C:\LayoutModification.xml

 

Import Command 
Now, in your imaging process, you can use the following PowerShell command to import the custom XML into the Default profile….before sysprep.

Import-StartLayout -LayoutPath c:\LayoutModification.xml -MountPath $env:SystemDrive\

 

Copy Command
If for some reason you have problems with that, you can just add a low level copy either before sysprep or in post setup. Note, I used the ‘Default’ path so the customized XML will be used when a new profile is generated.

copy /y c:\LayoutModification.xml “C:\Users\Default\AppData\Local\Microsoft\Windows\Shell”

Removing Windows 10 Native Shortcuts from All apps

email me

The Windows 10 Start Menu has changed a bit. If you haven’t noticed yet, you can’t exactly remove the Windows 10 built-in applications; this is by design.

You can still move application shortcuts around, but it no longer seems possible to remove native ones from the Start Menu. It is also not possible to move those apps in a folder to make room for desktop programs.

The Start Menu itself does not offer any options, but there are a couple workarounds.

 

Method 1 

  1. The application shortcuts listed under C:\Users\%username%\AppData\Local\Microsoft\Windows\Application Shortcuts\
  2. To display that folder in File Explorer, make sure you enable the display of hidden files and folders with a click on View > Hidden Items.
  3. The folder lists all installed applications. Example: Microsoft.3DBuilder_8wekyb3d8bbwe
  4. Create a new folder in there and call it Apps.
  5. Move all applications that you don’t want to see in the Start Menu’s all apps listings root into the Apps.

 

Method 2 (I used this one)

If the shortcut still appears on the Start Menu after a reboot, try this from an admin PowerShell Prompt:

Get-AppxPackage *3dbuilder* | Remove-AppxPackage


from PowerShell

 

Others

Uninstall Alarms and Clock:
Get-AppxPackage *windowsalarms* | Remove-AppxPackage

Uninstall Calculator:
Get-AppxPackage *windowscalculator* | Remove-AppxPackage

Uninstall Calendar and Mail:
Get-AppxPackage *windowscommunicationsapps* | Remove-AppxPackage

Uninstall Camera:
Get-AppxPackage *windowscamera* | Remove-AppxPackage

Uninstall Get Office:
Get-AppxPackage *officehub* | Remove-AppxPackage

Uninstall Get Skype:
Get-AppxPackage *skypeapp* | Remove-AppxPackage

Uninstall Get Started:
Get-AppxPackage *getstarted* | Remove-AppxPackage

Uninstall Groove Music:
Get-AppxPackage *zunemusic* | Remove-AppxPackage

Uninstall Maps:
Get-AppxPackage *windowsmaps* | Remove-AppxPackage

Uninstall Microsoft Solitaire Collection:
Get-AppxPackage *solitairecollection* | Remove-AppxPackage

Uninstall Money:
Get-AppxPackage *bingfinance* | Remove-AppxPackage

Uninstall Movies & TV:
Get-AppxPackage *zunevideo* | Remove-AppxPackage

Uninstall News:
Get-AppxPackage *bingnews* | Remove-AppxPackage

Uninstall OneNote:
Get-AppxPackage *onenote* | Remove-AppxPackage

Uninstall People:
Get-AppxPackage *people* | Remove-AppxPackage

Uninstall Phone Companion:
Get-AppxPackage *windowsphone* | Remove-AppxPackage

Uninstall Photos:
Get-AppxPackage *photos* | Remove-AppxPackage

Uninstall Store:
Get-AppxPackage *windowsstore* | Remove-AppxPackage

Uninstall Sports:
Get-AppxPackage *bingsports* | Remove-AppxPackage

Uninstall Voice Recorder:
Get-AppxPackage *soundrecorder* | Remove-AppxPackage

Uninstall Weather:
Get-AppxPackage *bingweather* | Remove-AppxPackage

Uninstall Xbox:
Get-AppxPackage *xboxapp* | Remove-AppxPackage

 

Potential Issue with PowerShell

Now, although the “short” package name should work with the cmdlet, in some cases it will not (especially if elevated access is required). So, to create a startup script that will remove shortcuts for the Current User, use this with the full package name.

Remove-Appxpackage -package Microsoft.SkypeApp_3.2.1.0_x86__kzf8qxf38zg5c
Remove-Appxpackage -package Windows.ContactSupport_10.0.10240.16384_neutral_neutral_cw5n1h2txyewy
Remove-Appxpackage -package Microsoft.XboxGameCallableUI_1000.10240.16384.0_neutral_neutral_cw5n1h2txyewy
Remove-Appxpackage -package Microsoft.XboxIdentityProvider_1000.10240.16384.0_neutral_neutral_cw5n1h2txyewy
Remove-Appxpackage -package Microsoft.Windows.Photos_15.618.18170.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.Getstarted_2.1.9.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.BingWeather_4.3.193.0_x86__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.People_1.10159.0.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.MicrosoftSolitaireCollection_3.1.6103.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.BingSports_4.3.193.0_x86__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.WindowsAlarms_10.1512.28020.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.WindowsPhone_10.1602.3010.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.3DBuilder_10.9.6.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.ZuneMusic_3.6.15131.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.BingNews_4.9.51.0_x86__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.BingFinance_4.9.51.0_x86__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.WindowsStore_11602.1.26.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.XboxApp_15.17.3003.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.WindowsMaps_4.1603.1190.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.MicrosoftOfficeHub_17.7012.23531.0_x64__8wekyb3d8bbwe
Remove-Appxpackage -package Microsoft.Office.OneNote_17.6965.57691.0_x64__8wekyb3d8bbw
Remove-Appxpackage -package Microsoft.ZuneVideo_3.6.19761.0_x64__8wekyb3d8bbwe
exit-pssession

Others

microsoft.windowscommunicationsapps_17.6568.46361.0_x64__8wekyb3d8bbwe
Microsoft.NET.Native.Runtime.1.3_1.3.23901.0_x64__8wekyb3d8bbwe
Microsoft.NET.Native.Runtime.1.3_1.3.23901.0_x86__8wekyb3d8bbwe
Microsoft.NET.Native.Framework.1.3_1.3.23901.0_x64__8wekyb3d8bbwe
Microsoft.NET.Native.Framework.1.3_8wekyb3d8bbwe
Microsoft.WindowsSoundRecorder_10.1512.21110.0_x64__8wekyb3d8bbwe
Microsoft.NET.Native.Runtime.1.1_1.1.23406.0_x86__8wekyb3d8bbwe
Microsoft.NET.Native.Runtime.1.1_1.1.23406.0_x64__8wekyb3d8bbwe
Microsoft.NET.Native.Framework.1.1_1.0.23115.0_x86__8wekyb3d8bbwe
Microsoft.NET.Native.Framework.1.1_1.0.23115.0_x64__8wekyb3d8bbwe
Microsoft.VCLibs.140.00_14.0.23816.0_x64__8wekyb3d8bbwe
Microsoft.WindowsCalculator_10.1601.19020.0_x64__8wekyb3d8bbwe
Microsoft.VCLibs.140.00_14.0.23816.0_x86__8wekyb3d8bbwe
Microsoft.Appconnector_1.3.3.0_neutral__8wekyb3d8bbwe
windows.devicesflow_6.2.0.0_neutral_neutral_cw5n1h2txyewy
Microsoft.WindowsCamera_5.38.3003.0_x64__8wekyb3d8bbwe
Microsoft.NET.Native.Runtime.1.0_1.0.22929.0_x64__8wekyb3d8bbwe
Microsoft.NET.Native.Runtime.1.0_1.0.22929.0_x86__8wekyb3d8bbwe
Microsoft.NET.Native.Framework.1.0_1.0.22929.0_x64__8wekyb3d8bbwe
Microsoft.NET.Native.Framework.1.0_1.0.22929.0_x86__8wekyb3d8bbwe
Windows.PurchaseDialog_6.2.0.0_neutral_neutral_cw5n1h2txyewy
Windows.PrintDialog_6.2.0.0_neutral_neutral_cw5n1h2txyewy
Windows.MiracastView_6.3.0.0_neutral_neutral_cw5n1h2txyewy
windows.immersivecontrolpanel_6.2.0.0_neutral_neutral_cw5n1h2txyewy
Microsoft.Windows.CloudExperienceHost_10.0.10240.16384_neutral_neutral_cw5n1h2txyewy
Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy
Microsoft.AAD.BrokerPlugin_1000.10240.16384.0_neutral_neutral_cw5n1h2txyewy
Microsoft.AccountsControl_10.0.10240.16384_neutral__cw5n1h2txyewy
Microsoft.BioEnrollment_10.0.10240.16384_neutral__cw5n1h2txyewy
Microsoft.LockApp_10.0.10240.16384_neutral__cw5n1h2txyewy
Microsoft.Windows.AssignedAccessLockApp_1000.10240.16384.0_neutral_neutral_cw5n1h2txyewy
Microsoft.Windows.AssignedAccessLockApp_cw5n1h2txyewy
Microsoft.Windows.ContentDeliveryManager_10.0.10240.16384_neutral_neutral_cw5n1h2txyewy
Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy
Microsoft.Windows.Cortana_1.4.8.152_neutral_neutral_cw5n1h2txyewy
Microsoft.Windows.ParentalControls_1000.10240.16384.0_neutral_neutral_cw5n1h2txyewy
Microsoft.Windows.ShellExperienceHost_10.0.10240.16384_neutral_neutral_cw5n1h2txyewy
Microsoft.WindowsFeedback_10.0.10240.16384_neutral_neutral_cw5n1h2txyewy

 

 

Notes

C:\Users\%username%\AppData\Local\Packages
C:\Users\%username%\AppData\Local\Microsoft\Windows\Application Shortcuts
C:\Users\%username%\AppData\Local\TileDataLayer\Database
C:\Users\Default\AppData\Local\Microsoft\Windows\Shell
C:\Users\%username%\AppData\Local\Microsoft\Windows\Shell

Windows 10 Start Menu Broken
Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}

Export Layout
export-startlayout –path C:\LayoutModification.xml

Import Layout (can be applied via PS or GP)
Import-StartLayout -LayoutPath LayoutModification.xml -MountPath $en
v:SystemDrive\

For New Profile Generation
copy /y LayoutModification.xml “C:\Users\Default\AppData\Local\Microsoft\Windows\Shell”

Remove Windows 10 Built-in Apps

email me

Something really annoying…is how Microsoft bundles bloatware applications into Windows 10. These are especially irritating when deploying the OS out to enterprise users. The last thing you want is end-users clicking on the Microsoft Store, playing with XBox, and messing around with the other numerous non-business applications. To remove these, run the below PowerShell script as part of post setup.

A couple caveats, (1) many of these apps are setup upon new profile creation, meaning the script needs to be a part of the Default user profile, or executed after the user logs in; (2) not all apps can be removed using the PowerShell script.

Note, be prepared to continue seeing Cortana Search, Microsoft Edge, Contact Support, and Windows Feedback…as these cannot be removed with PowerShell. See my Experimental section for these apps.

Import-Module -DisableNameChecking $PSScriptRoot\..\lib\take-own.psm1

Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

echo "Elevating priviledges for this process"
do {} until (Elevate-Privileges SeTakeOwnershipPrivilege)

echo "Uninstalling default apps"
$apps = @(
# default Windows 10 apps
"Microsoft.Getstarted"
"Microsoft.Office.Sway"
"Microsoft.WindowsMaps"
"Microsoft.People"
"Microsoft.WindowsAlarms"
"Microsoft.3DBuilder"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.ZuneMusic"
"Microsoft.ZuneVideo"
"Microsoft.SkypeApp"
"Microsoft.BingFinance"
"Microsoft.BingNews"
"Microsoft.BingSports"
"Microsoft.BingWeather"
"Microsoft.MicrosoftSolitaireCollection"
"Microsoft.XboxApp"
"Microsoft.MinecraftUWP"
"Microsoft.WindowsPhone"
"microsoft.windowscommunicationsapps"
"Microsoft.CommsPhone"
"Microsoft.ConnectivityStore"
"Microsoft.Messaging"
"9E2F88E3.Twitter"
"Flipboard.Flipboard"
"ShazamEntertainmentLtd.Shazam"
"king.com.CandyCrushSaga"
"ClearChannelRadioDigital.iHeartRadio"
"Microsoft.Appconnector"
"Microsoft.Office.OneNote"

#"Microsoft.Windows.Photos"
#"Microsoft.WindowsCalculator"
#"Microsoft.WindowsCamera"
#"Microsoft.WindowsSoundRecorder"
#"Microsoft.WindowsStore"

# apps which cannot be removed using Remove-AppxPackage
#"Microsoft.BioEnrollment"
#"Microsoft.MicrosoftEdge"
#"Microsoft.Windows.Cortana"
#"Microsoft.WindowsFeedback"
#"Microsoft.XboxGameCallableUI"
#"Microsoft.XboxIdentityProvider"
#"Windows.ContactSupport"
)

foreach ($app in $apps) {
Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage

Get-AppXProvisionedPackage -Online |
where DisplayName -EQ $app |
Remove-AppxProvisionedPackage -Online
}

 

Of course, not everything can be uninstalled in this manner. For the more difficult apps, use the install_wim_tweak.exe utility and this code (this tool was created by Legolash2o)

“%Temp%\TweakUtil.exe” /o /l
“%Temp%\TweakUtil.exe” /o /c Microsoft-Windows-InsiderHub /r
“%Temp%\TweakUtil.exe” /h /o /l

“%Temp%\TweakUtil.exe” /o /l
“%Temp%\TweakUtil.exe” /o /c Microsoft-Windows-ContactSupport /r
“%Temp%\TweakUtil.exe” /h /o /l

Not recommended for removal
“%Temp%\TweakUtil.exe” /o /l

“%Temp%\TweakUtil.exe” /o /c Microsoft-Windows-Store /r /r
“%Temp%\TweakUtil.exe” /h /o /l

 

Other TweakUtil Uninstalls

install_wim_tweak.exe /o /c Microsoft-Windows-Cortana /r

install_wim_tweak.exe /o /c “Microsoft-Windows-MediaViewer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “Microsoft-Windows-MediaViewer-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “Microsoft-Windows-Camera-Package” /r

install_wim_tweak.exe /o /c “Microsoft-Windows-WebcamExperience-Package” /r

install_wim_tweak.exe /o /c “Microsoft-Windows-FileManager-Package~31bf3856ad364e35~amd64~~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “Microsoft-Windows-FileManager-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “Microsoft-Windows-Store-Client-Package~31bf3856ad364e35~amd64~~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “Microsoft-Windows-Store-Client-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “Checkpoint-VpnPlugin-Package~31bf3856ad364e35~amd64~~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “Checkpoint-VpnPlugin-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “F5-VpnPlugin-Package~31bf3856ad364e35~amd64~~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “F5-VpnPlugin-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “Juniper-VpnPlugin-Package~31bf3856ad364e35~amd64~~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “Juniper-VpnPlugin-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “Microsoft-Windows-VpnPlugins-Package~31bf3856ad364e35~amd64~~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “Microsoft-Windows-VpnPlugins-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “SonicWALL-VpnPlugin-Package~31bf3856ad364e35~amd64~~6.3.9600.16384” /r

install_wim_tweak.exe /o /c “SonicWALL-VpnPlugin-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384” /r

 

Direct Image Mods

You may not want to do any of this in post setup; perhaps you want to make changes directly to the install.wim. In that case, use the below commands to modify the wim directly.

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.3DBuilder_2015.624.2254.0_neutral_~_8wekyb3d8bbwedism

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage
/packagename:Microsoft.BingFinance_10004.3.193.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.BingNews_10004.3.193.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.BingSports_10004.3.193.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.BingWeather_10004.3.193.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.Getstarted_2015.622.1108.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.MicrosoftOfficeHub_2015.4218.23751.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.MicrosoftSolitaireCollection_3.1.6103.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.Office.OneNote_2015.4201.10091.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.People_2015.627.626.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.SkypeApp_3.2.1.0_neutral_~_kzf8qxf38zg5c

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.Windows.Photos_2015.618.1921.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.windowscommunicationsapps_2015.6002.42251.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.WindowsMaps_2015.619.213.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.WindowsPhone_2015.620.10.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.WindowsStore_2015.701.14.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.XboxApp_2015.617.130.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.ZuneMusic_2019.6.10841.0_neutral_~_8wekyb3d8bbwe

dism /image:D:\Win10\ISO\YourWIM /remove-provisionedappxpackage /packagename:Microsoft.ZuneVideo_2019.6.10811.0_neutral_~_8wekyb3d8bbwe

 

Experimental

Moving folders from these locations supposedly removes ‘functionality’ of shortcuts on Start Menu (this did not work for me). Note, four apps on the Start Menu will cause you to pull your hair out: Cortana Search, Microsoft Edge, Contact Support, and Windows Feedback.

 

My experience with trying to remove Contact Support (it failed)

Python Silent Installs

email me

Depending on whether you download the MSI or EXE type, this is how you would silently install Python.

MSI

%windir%\system32\msiexec.exe /i “%CD%\python-2.7.11.msi” /qn /norestart


EXE

“%CD%\python-3.5.1.exe” /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 TargetDir=c:\Python351

{updated}

“%CD%\python-3.7.0.exe” /quiet InstallAllUsers=1 PrependPath=1 Include_test=0

 

Notes

Python Releases for Windows

Using Python on Windows

 

Packaging

I packaged to a deployable EXE using ExeScript. You can also use a self-extracting WinRar EXE.

 

All of the options available in the installer UI can also be specified from the command line, allowing scripted installers to replicate an installation on many machines without user interaction. These options may also be set without suppressing the UI in order to change some of the defaults.

To completely hide the installer UI and install Python silently, pass the /quiet option. To skip past the user interaction but still display progress and errors, pass the /passive option. The /uninstall option may be passed to immediately begin removing Python – no prompt will be displayed.

All other options are passed as name=value, where the value is usually 0 to disable a feature, 1 to enable a feature, or a path. The full list of available options is shown below.

Name Description Default
InstallAllUsers Perform a system-wide installation. 0
TargetDir The installation directory Selected based on InstallAllUsers
DefaultAllUsersTargetDir The default installation directory for all-user installs %ProgramFiles%\Python X.Y or%ProgramFiles(x86)%\Python X.Y
DefaultJustForMeTargetDir The default install directory for just-for-me installs %LocalAppData%\Programs\PythonXY or%LocalAppData%\Programs\PythonXY-32
DefaultCustomTargetDir The default custom install directory displayed in the UI (empty)
AssociateFiles Create file associations if the launcher is also installed. 1
CompileAll Compile all .py files to .pyc. 0
PrependPath Add install and Scripts directories tho PATH and .PY to PATHEXT 0
Shortcuts Create shortcuts for the interpreter, documentation and IDLE if installed. 1
Include_doc Install Python manual 1
Include_debug Install debug binaries 0
Include_dev Install developer headers and libraries 1
Include_exe Install python.exe and related files 1
Include_launcher Install Python Launcher for Windows. 1
InstallLauncherAllUsers Installs Python Launcher for Windows for all users. 1
Include_lib Install standard library and extension modules 1
Include_pip Install bundled pip and setuptools 1
Include_symbols Install debugging symbols (*.pdb) 0
Include_tcltk Install Tcl/Tk support and IDLE 1
Include_test Install standard library test suite 1
Include_tools Install utility scripts 1
LauncherOnly Only installs the launcher. This will override most other options. 0
SimpleInstall Disable most install UI 0
SimpleInstallDescription A custom message to display when the simplified install UI is used. (empty)

For example, to silently install a default, system-wide Python installation, you could use the following command (from an elevated command prompt):

python-3.5.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0

To allow users to easily install a personal copy of Python without the test suite, you could provide a shortcut with the following command. This will display a simplified initial page and disallow customization:

python-3.5.0.exe InstallAllUsers=0 Include_launcher=0 Include_test=0
    SimpleInstall=1 SimpleInstallDescription="Just for me, no test suite."

R and RStudio with Config

email me

Installing RStudio can present a couple of challenges.

One: To install RStudio, ‘R’ also has to be installed; RStudio uses R as a core application.
Two: You may want to use a custom config file to store “global” settings.

Step 1

To install R as a prerequisite program, just add the following to your deployment script

R_App_3.3.0.exe” /silent


Step 2

Next, add the silent setup for RStudio with

RStudio_Desktop.exe” /S


Step 3

Next, to distribute the global config file, first set all the options you would like distributed to all users; for me, I disabled the automatic updates. I launched RStudio, and deselected the Automatically Notify option.

Then, grab the user-settings file from

%userprofile%\AppData\Local\RStudio-Desktop\monitored\user-settings


Step 4

Use this script to distribute the user-setting file to all user profiles. Just add a line to your deployment script pointing to this VBS.

Distribution Script

on error resume next

Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

Const HKEY_LOCAL_MACHINE = &H80000002
Const OverwriteExisting = TRUE

'SETS CURRENT DIRECTORY TO VARIABLE
strCurrentDirectory = objShell.CurrentDirectory

'SETS CURRENT COMPUTER NAME
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objRegistry=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\ProfileList"
objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys
For Each objSubkey In arrSubkeys
on error resume next
strValueName = "ProfileImagePath"
strSubPath = strKeyPath & "\" & objSubkey
objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue
Const POPUP_TITLE = "User To SID Conversion"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 
Set objAccount = objWMIService.Get("Win32_SID.SID='" & objSubkey & "'")
strUser = objAccount.AccountName
'strDomain = objAccount.ReferencedDomainName'returns referenced domain

'DISPLAY PROFILE NAME & SID
objSubkey = trim(objSubkey)'trims whitespace
strUser = trim(strUser)'trims whitespace
'msgbox "objSubkey: " & objSubkey'returns SID
'msgbox strUser'returns username

'LOGIC TO DETERMINE IF REGISTRY ACCOUNT IS TO BE LOADED
if strUser = "SYSTEM" then strUser=""
if strUser = "LOCAL SERVICE" then strUser=""
if strUser = "NETWORK SERVICE" then strUser=""
'if strUser = "ADMINISTRATOR" then strUser=""

'COPY CUSTOM CONFIG TO EACH USER PROFILE
if strUser <> "" then
on error resume next
'USED LOW LEVEL COPYING BECAUSE IT WORKS BETTER IN DEPLOYMENTS
objShell.Run "%comspec% /c md " & chr(34) & "C:\users\" & strUser & "\AppData\Local\RStudio-Desktop\monitored\user-settings\" & chr(34),0,true
Wscript.Sleep 1000
objShell.Run "%comspec% /c copy /y " & chr(34) & strCurrentDirectory & "\user-settings" & chr(34) & " " & chr(34) & "C:\users\" & strUser & "\AppData\Local\RStudio-Desktop\monitored\user-settings\" & chr(34),0,true
Wscript.Sleep 1000

end if

Next

 

This is what the setting looks like.

1 – Where the user-settings file is located
2 – The particular Automatically Notify for Updates setting in the user-settings file
3 – The Automatically Notify for Updates option in the GUI

 

The full user-settings file

alwaysSaveHistory=”1″
cleanTexi2DviOutput=”1″
cleanupAfterRCmdCheck=”1″
contextIdentifier=”2D6BC5AD”
cranMirrorCountry=”us”
cranMirrorHost=”RStudio”
cranMirrorName=”Global (CDN)”
cranMirrorUrl=”https://cran.rstudio.com/”
enableLaTeXShellEscape=”0″
errorHandlerType=”1″
hideObjectFiles=”1″
initialWorkingDirectory=”~”
lineEndingConversion=”2″
loadRData=”1″
newlineInMakefiles=”1″
removeHistoryDuplicates=”0″
restoreLastProject=”1″
reuseSessionsForProjectLinks=”1″
rprofileOnResume=”0″
saveAction=”-1″
securePackageDownload=”1″
showLastDotValue=”0″
showUserHomePage=”sessions”
uiPrefs=”{\n \”always_complete_characters\” : 3,\n \”always_complete_console\” : true,\n \”always_complete_delay\” : 250,\n \”always_enable_concordance\” : true,\n \”auto_append_newline\” : false,\n \”auto_expand_error_tracebacks\” : false,\n \”background_diagnostics_delay_ms\” : 2000,\n \”blinking_cursor\” : true,\n \”check_arguments_to_r_function_calls\” : false,\n \”check_for_updates\” : false,\n \”clear_hidden\” : false,\n \”code_complete\” : \”always\”,\n \”code_complete_other\” : \”always\”,\n \”continue_comments_on_newline\” : false,\n \”default_encoding\” : \”\”,\n \”default_latex_program\” : \”pdfLaTeX\”,\n \”default_project_location\” : \”~\”,\n \”default_sweave_engine\” : \”Sweave\”,\n \”diagnostics_in_function_calls\” : true,\n \”diagnostics_on_save\” : true,\n \”enable_background_diagnostics\” : true,\n \”enable_emacs_keybindings\” : false,\n \”enable_rstudio_connect\” : false,\n \”enable_snippets\” : true,\n \”enable_style_diagnostics\” : false,\n \”focus_console_after_exec\” : false,\n \”font_size_points\” : 10,\n \”handle_errors_in_user_code_only\” : true,\n \”highlight_r_function_calls\” : false,\n \”highlight_selected_line\” : false,\n \”highlight_selected_word\” : true,\n \”ignore_uppercase_words\” : true,\n \”ignore_words_with_numbers\” : true,\n \”insert_matching\” : true,\n \”insert_numbered_latex_sections\” : false,\n \”insert_parens_after_function_completion\” : true,\n \”insert_spaces_around_equals\” : true,\n \”navigate_to_build_error\” : true,\n \”num_spaces_for_tab\” : 2,\n \”packages_pane_enabled\” : true,\n \”pane_config\” : {\n \”consoleLeftOnTop\” : false,\n \”consoleRightOnTop\” : true,\n \”panes\” : [\n \”Source\”,\n \”Console\”,\n \”TabSet1\”,\n \”TabSet2\”\n ],\n \”tabSet1\” : [\n \”Environment\”,\n \”History\”,\n \”Build\”,\n \”VCS\”,\n \”Presentation\”\n ],\n \”tabSet2\” : [\n \”Files\”,\n \”Plots\”,\n \”Packages\”,\n \”Help\”,\n \”Viewer\”\n ]\n },\n \”pdf_previewer\” : \”desktop-synctex\”,\n \”preferred_document_outline_width\” : 110,\n \”print_margin_column\” : 80,\n \”reindent_on_paste\” : true,\n \”restore_source_documents\” : true,\n \”rmd_preferred_template_path\” : \”\”,\n \”rmd_viewer_type\” : 0,\n \”root_document\” : \”\”,\n \”save_before_sourcing\” : true,\n \”save_files_before_build\” : false,\n \”show_diagnostics_cpp\” : true,\n \”show_diagnostics_other\” : true,\n \”show_diagnostics_r\” : true,\n \”show_doc_outline_rmd\” : false,\n \”show_indent_guides\” : false,\n \”show_inline_toolbar_for_r_code_chunks\” : true,\n \”show_invisibles\” : false,\n \”show_line_numbers\” : true,\n \”show_margin\” : false,\n \”show_publish_ui\” : true,\n \”show_signature_tooltips\” : true,\n \”show_unnamed_chunks_in_document_outline\” : true,\n \”soft_wrap_r_files\” : false,\n \”source_with_echo\” : false,\n \”spelling_dictionary_language\” : \”en_US\”,\n \”strip_trailing_whitespace\” : false,\n \”surround_selection\” : \”quotes_and_brackets\”,\n \”syntax_color_console\” : false,\n \”tab_multiline_completion\” : false,\n \”theme\” : \”TextMate\”,\n \”toolbar_visible\” : true,\n \”use_rcpp_template\” : true,\n \”use_roxygen\” : false,\n \”use_spaces_for_tab\” : true,\n \”use_vim_mode\” : false,\n \”valign_argument_indent\” : true,\n \”warn_if_no_such_variable_in_scope\” : false,\n \”warn_if_variable_defined_but_not_used\” : false\n}”
useDevtools=”1″
useInternet2=”1″
vcsEnabled=”1″
vcsGitExePath=””
vcsSvnExePath=””
vcsTerminalPath=””
vcsUseGitBash=”1″
viewDirAfterRCmdCheck=”0″

What is IE Enterprise Mode?

email me

Enterprise Mode is a compatibility mode that runs in Internet Explorer 11 on Windows 8.1 and Windows 7 devices. This mode allows websites to render web content using a modified browser configuration. It is designed to emulate either Windows Internet Explorer 7 or Windows Internet Explorer 8, avoiding the common compatibility problems associated with web apps written and tested on older versions of Internet Explorer.

Many customers identify web app compatibility as a significant cost to upgrading because web apps need to be tested and upgraded before adopting a new browser. The improved compatibility provided by Enterprise Mode can help give customers confidence to upgrade to the latest version of IE. In particular, IE11 lets customers benefit from modern web standards, increased performance, improved security, and better reliability.

The Enterprise Mode Option

 

Registry Entries

You will probably want to automate the setting or add it to your imaging process. To do this, simply add the following reg commands to a setup/deployment script. You will of course need to create your own compatibility list using the respective site.xml file.

reg add “hklm\SOFTWARE\Policies\Microsoft\Internet Explorer\Main\EnterpriseMode” /v Enable /f 

reg add “hklm\SOFTWARE\Policies\Microsoft\Internet Explorer\Main\EnterpriseMode” /v SiteList /t REG_SZ /d \\site.xml /f

Note, \\site.xml could be formatted as

http://YourWebSite/site.xml
\\Server\ShareName\site.xml
file://C:/Users/JDoe/site.xml

 

Sample sitelist.xml

 <site-list version=“205”>
<!— File creation header —>
<created-by> <tool>EnterpriseSitelistManager</tool>
<version>10240</version>
<date-created>20150728.135021</date-created> </created-by>
<!— Begin Site List —>
<site url=“www.MYSite.com”>
<compat-mode>IE8Enterprise</compat-mode>
<open-in>MSEdge</open-in> </site>
<site url=“www.MYSite.com/images”>
<compat-mode>IE7Enterprise</compat-mode>
<open-in>IE11</open-in> </site>
<site url=“contoso.com”> <compat-mode>default</compat-mode>
<open-in>IE11</open-in> </site>
</site-list>

 

If you do not see enterprise mode, make sure you have installed KB3087038, specifically, KB/3070773. Download the update here.

Update!

On some of our machines, we noticed that Enterprise Mode was not being enabled automatically, even though the reg keys were there, IE11 was installed, and the KBs were there.

This was the solution: KB3185319, https://www.microsoft.com/en-us/download/details.aspx?id=53757

This will upgrade IE11 to 11.0.9600.18449.

 

Enterprise Mode Features

Enterprise Mode includes the following features:

  • Improved web app and website compatibility. Through improved emulation, Enterprise Mode lets many legacy web apps run unmodified on IE11, supporting a number of site patterns that aren’t currently supported by existing document modes.
  • Centralized control. You can specify the websites or web apps to interpret using Enterprise Mode, through an XML file on a website or stored locally. Domains and paths within those domains can be treated differently, allowing granular control. Use Group Policy to let users turn Enterprise Mode on or off from the Tools menu and to decide whether the Enterprise browser profile appears on the Emulation tab of the F12 developer tools.

    Important
     
    All centrally-made decisions override any locally-made choices.
  • Integrated browsing. When Enterprise Mode is set up, users can browse the web normally, letting the browser change modes automatically to accommodate Enterprise Mode sites.
  • Data gathering. You can configure Enterprise Mode to collect local override data, posting back to a named server. This lets you “crowd source” compatibility testing from key users; gathering their findings to add to your central site list.

 

References

https://blogs.windows.com/msedgedev/2015/11/23/windows-10-1511-enterprise-improvements/

https://blogs.msdn.microsoft.com/notime/2015/04/11/ie-enterprise-mode-in-a-nutshell/

 

Notes

You may actually want to use GP to enforce and manage the site URL, in that case use the following:

You also need to enable the ‘Use the Enterprise Mode IE website list’ option in GP.

Still in the Internet Explorer settings, Select ‘Use the Enterprise Mode IE website list’ option, navigate to the Enable, and add your URL or UNC into the field.

If you want to use the netlogon server-–instead of a web server—you can add the netlogon environmental variable, with a share name as the UNC location in GP.

 %logonserver%\netlogon\SiteList\site.xml