PowerShell – Install AppX via Command Line

email me

Command

powershell.exe -noprofile -command “Add-AppxPackage -Path .\setup.appx”

 

Output

 


Notes

Example 1: Add an app package

PS C:\> Add-AppxPackage -Path “C:\Users\GeorgeStark\Desktop\MyApp.appx” -DependencyPath “C:\Users\GeorgeStark\Desktop\winjs.appx”


Example 2: Add a disabled app package in development mode

PS C:\> $ManifestPath = (Get-AppxPackage -Name “*WindowsCalculator*”).InstallLocation + “\Appxmanifest.xml”

PS C:\> Add-AppxPackage -Path $ManifestPath -Register -DisableDevelopmentMode


Example 3: Add an app along with its optional packages

PS C:\> Add-AppxPackage -Path “C:\Users\GeorgeStark\Desktop\MyApp.appxbundle” -ExternalPackages

“C:\Users\user1\Desktop\optionalpackage1.appx”,”C:\Users\GeorgeStark\Desktop\optionalpackage2.appxbundle”

PS C:\> Add-AppxPackage -Path “C:\Users\GeorgeStark\Desktop\MyApp.appxbundle” -OptionalPackages “29270sandstorm.OptionalPackage1_gah1vdar1nn7a”


Example 4: Install only the required section of a streaming app

PS C:\> Add-AppxPackage -Path “C:\Users\GeorgeStark\Desktop\MyApp.appxbundle” -RequiredContentGroupOnly

* hopefully you get my humor with George Stark.

 

tags: MrNetTek

Skype for Desktop – 8.44.0.40

email me

Download

New Skype for Desktop (Windows) is available here:

https://go.skype.com/windows.desktop.download  mirror


Size

59.3 MB


Silent Install

setup.exe /VERYSILENT /SP- /NOCANCEL /NORESTART /SUPPRESSMSGBOXES /NOLAUNCH -ms


Uninstall

Reg Keys

“HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Skype_is1”

Command

“C:\Program Files (x86)\Microsoft\Skype for Desktop\unins000.exe” /SILENT

 

Notes

Disable Skype auto updates

JavaScript – Toggle Function to Hide and Show Content, Expanding DIV

email me

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<script type="text/javascript">
function toggleContent() {
     // Get the DOM reference
     var contentId = document.getElementById("content");
    
     // Toggle 
     contentId.style.display == "block" ? contentId.style.display = "none" : 
     contentId.style.display = "block"; 

if (contentId.style.display == "none") {
     minimizeFunction(); // add your code or function here
} else {
     maximizeFunction(); // add your code or function here
}
}
</script>

 

Add to DIV

<div ID="content" style="display:block;">Some Content Here</div>

 

Call the Function

<span onclick="toggleContent();">*</span>

 


Notes

http://hilite.me/

Demo of my functions…

 function minimizeFunction()
 {
 var t = document.getElementById("txaPad");
 var h = window.innerHeight ? window.innerHeight :
 t.parentNode.offsetHeight;

 t.style.height = (h - t.offsetTop - 48) + "px";

 }
  
 
 
 function maximizeFunction()
 {
 var t = document.getElementById("txaPad");
 var h = window.innerHeight ? window.innerHeight :
 t.parentNode.offsetHeight;

 t.style.height = (h - t.offsetTop - 104) + "px";

 }
   

Java Client – 8 Update 211 and 212

email me

Download

The latest Java Client (Java SE Runtime Environment) is available here:

https://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html


Silent Installation

JavaDownload.exe INSTALL_SILENT=1 STATIC=0 AUTO_UPDATE=0 WEB_JAVA=1 WEB_JAVA_SECURITY_LEVEL=H WEB_ANALYTICS=0 EULA=0 REBOOT=0

 

64 Bit

Version
1.8.2120.10

Size
75.98 MB

Registry
REG.exe ADD “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F64180212F0}” /v “Publisher” /t REG_SZ /d “YourDesktopManagementSoftware—example: SCCM” /f

Uninstall
msiexec /x{26A24AE4-039D-4CA4-87B4-2F64180212F0}


32 Bit

Version
1.8.2120.10

Size
66.37 MB

Registry
REG.exe ADD “HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F32180212F0}” /v “Publisher” /t REG_SZ /d “YourDesktopManagementSoftware—example: SCCM” /f

Uninstall
msiexec /x{26A24AE4-039D-4CA4-87B4-2F32180212F0}

* notice the GUID formatting “32/64” “major version” “update version”

 

Windows – Enable Terminal Services, Remote Desktop

email me

If creating a policy package for SCCM: Compile to EXE, add the EXE you just created to SCCM as a package: Create Package > Environment > Program can run: Only when user is logged on > Run with administrator rights.


Registry

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server
type: dword
value: fDenyTSConnections
data: 0

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server
type: dword
value: TSUserEnabled
data: 1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
type: string
value: WinStationsDisabled
data: 0

* along with adding users to the Remote Desktop Users group

Windows – Disable Run Command Policy

email me

If creating a policy package for SCCM: Compile to EXE, add the EXE you just created to SCCM as a package: Create Package > Environment > Program can run: Only when user is logged on > Run with user rights.


Registry

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
type: dword
value: NoRun
data: 1

 

Notes

Set objShell = CreateObject("WScript.Shell")

on error resume next

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

Const HKEY_LOCAL_MACHINE = &amp;H80000002
Const OverwriteExisting = TRUE
Const POPUP_TITLE = "User To SID Conversion"

'SETS CURRENT DIRECTORY TO VARIABLE
strCurrentDirectory = objShell.CurrentDirectory
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")
Set objRegistry=GetObject("winmgmts:\\" &amp; strComputer &amp; "\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 &amp; "\" &amp; objSubkey
objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue

Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")
Set objAccount = objWMIService.Get("Win32_SID.SID='" &amp; objSubkey &amp; "'")
strUser = objAccount.AccountName

objSubkey = trim(objSubkey)'trims whitespace
strUser = trim(strUser)'trims whitespace

if strUser = "Administrator" then strUser=""
if strUser = "Media" then strUser=""
if strUser = "Default" then strUser=""

if strUser &lt;&gt; "" then
on error resume next

objShell.Run "REG ADD " &amp; chr(34) &amp; "HKEY_Users\" &amp; objSubkey &amp; "\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" &amp; chr(34) &amp; " /v NoRun /t REG_DWORD /d 1 /f",0,false

end if

Next

Windows – C# – Set Wallpaper and WallpaperStyle

email me

If creating a policy package for SCCM: Compile to EXE, add the EXE you just created to SCCM as a package: Create Package > Environment > Program can run: Only when user is logged on > Run with user rights.

 

Code, Console App

using Microsoft.Win32;
using System;
using System.Runtime.InteropServices;
using System.IO;

namespace ConsoleApp1
{
class Program
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SystemParametersInfo(
UInt32 action, UInt32 uParam, String vParam, UInt32 winIni);

private static readonly UInt32 SPI_SETDESKWALLPAPER = 0x14;
private static readonly UInt32 SPIF_UPDATEINIFILE = 0x01;
private static readonly UInt32 SPIF_SENDWININICHANGE = 0x02;

static public void SetWallpaper(String path)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
key.SetValue(@"WallpaperStyle", 0.ToString()); // 2 is stretched
key.SetValue(@"TileWallpaper", 0.ToString());

SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, path, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
}

static void Main(string[] args)
{
string imgWallpaper = @"C:\Windows\Wallpaper.jpg";

// verify
if (File.Exists(imgWallpaper))
{
SetWallpaper(imgWallpaper);
}

}

}
}


Code, Windows App

using System;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using System.IO;

namespace WindowsFormsApp1
{
static class Program
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SystemParametersInfo(
UInt32 action, UInt32 uParam, String vParam, UInt32 winIni);

private static readonly UInt32 SPI_SETDESKWALLPAPER = 0x14;
private static readonly UInt32 SPIF_UPDATEINIFILE = 0x01;
private static readonly UInt32 SPIF_SENDWININICHANGE = 0x02;

static public void SetWallpaper(String path)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
key.SetValue(@"WallpaperStyle", 0.ToString()); // 2 is stretched
key.SetValue(@"TileWallpaper", 0.ToString());

SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, path, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
}

[STAThread]
static void Main()
{
// path
string imgWallpaper = @"C:\Windows\Wallpaper.jpg";

// verify
if (File.Exists(imgWallpaper))
{
SetWallpaper(imgWallpaper);
}
}

}
}

 

Notes

RegistryKey.OpenSubKey Method

SCCM – VBScript – Set Wallpaper Policy

email me

Compile to EXE, add the EXE you just created to SCCM as a package: Create Package > Environment > Program can run: Only when user is logged on > Run with administrator rights.

on error resume next

Set objShell = CreateObject("Wscript.Shell")

Const HKEY_LOCAL_MACHINE = &amp;H80000002

Const OverwriteExisting = TRUE

' MAKE FOLDER

objShell.Run "cmd /c md c:\Wallpaper",0,true

' COPY WALLPAPER

objShell.Run "cmd /c copy /y Wallpaper.jpg c:\Wallpaper\Wallpaper.jpg",0,false

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")

Set objRegistry=GetObject("winmgmts:\\" &amp; strComputer &amp; "\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 &amp; "\" &amp; objSubkey

objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue

Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")

Set objAccount = objWMIService.Get("Win32_SID.SID='" &amp; objSubkey &amp; "'")

strUser = objAccount.AccountName

objSubkey = trim(objSubkey)'trims whitespace
strUser = trim(strUser)'trims whitespace

'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=""
if strUser = "Administrator" then strUser=""
if strUser = "Media" then strUser=""
if strUser = "Default" then strUser=""
if strUser = "IntuneAdmin" then strUser=""

if strUser &lt;&gt; "" then

on error resume next

objShell.Run "REG ADD " &amp; chr(34) &amp; "HKEY_Users\" &amp; objSubkey &amp; "\Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop" &amp; chr(34) &amp; " /v NoChangingWallPaper /t REG_DWORD /d 1 /f",0,false

objShell.Run "REG ADD " &amp; chr(34) &amp; "HKEY_Users\" &amp; objSubkey &amp; "\Control Panel\Desktop" &amp; chr(34) &amp; " /v Wallpaper /d c:\Wallpaper\Wallpaper.jpg /f",0,false

objShell.Run "REG ADD " &amp; chr(34) &amp; "HKEY_Users\" &amp; objSubkey &amp; "\Software\Microsoft\Windows\CurrentVersion\Policies\System" &amp; chr(34) &amp; " /v Wallpaper /t REG_SZ /d c:\Wallpaper\Wallpaper.jpg /f",0,false

objShell.Run "REG ADD " &amp; chr(34) &amp; "HKEY_Users\" &amp; objSubkey &amp; "\Control Panel\Desktop" &amp; chr(34) &amp; " /v WallpaperStyle /d 0 /f",0,false

objShell.Run "REG ADD " &amp; chr(34) &amp; "HKEY_Users\" &amp; objSubkey &amp; "\Software\Microsoft\Windows\CurrentVersion\Policies\System" &amp; chr(34) &amp; " /v WallpaperStyle /t REG_SZ /d 0 /f",0,false

end if

Next

SCCM – VBScript – Hide Desktop Icons

email me

Compile to EXE, add the EXE you just created to SCCM as a package: Create Package > Environment > Program can run: Only when user is logged on > Run with administrator rights.

on error resume next

Set objShell = CreateObject("Wscript.Shell")

Const HKEY_LOCAL_MACHINE = &amp;H80000002

Const OverwriteExisting = TRUE

strCurrentDirectory = objShell.CurrentDirectory

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")

Set objRegistry=GetObject("winmgmts:\\" &amp; strComputer &amp; "\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 &amp; "\" &amp; objSubkey

objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue

Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")

Set objAccount = objWMIService.Get("Win32_SID.SID='" &amp; objSubkey &amp; "'")

strUser = objAccount.AccountName

objSubkey = trim(objSubkey)'trims whitespace
strUser = trim(strUser)'trims whitespace

'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=""
if strUser = "Administrator" then strUser=""
if strUser = "Media" then strUser=""
if strUser = "Default" then strUser=""
if strUser = "IntuneAdmin" then strUser=""

if strUser &lt;&gt; "" then

on error resume next

objShell.Run "REG ADD " &amp; chr(34) &amp; "HKEY_Users\" &amp; objSubkey &amp; "\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" &amp; chr(34) &amp; " /v NoDesktop /t REG_DWORD /d 1 /f",0,false

end if

Next

SCCM – VBScript – Disable Right Click

email me

Compile to EXE, add the EXE you just created to SCCM as a package: Create Package > Environment > Program can run: Only when user is logged on > Run with administrator rights.

 

on error resume next

Set objShell = CreateObject("Wscript.Shell")

Const HKEY_LOCAL_MACHINE = &amp;H80000002

Const OverwriteExisting = TRUE

strCurrentDirectory = objShell.CurrentDirectory

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")

Set objRegistry=GetObject("winmgmts:\\" &amp; strComputer &amp; "\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 &amp; "\" &amp; objSubkey

objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue

Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")

Set objAccount = objWMIService.Get("Win32_SID.SID='" &amp; objSubkey &amp; "'")

strUser = objAccount.AccountName

objSubkey = trim(objSubkey)'trims whitespace
strUser = trim(strUser)'trims whitespace

'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=""
if strUser = "Administrator" then strUser=""
if strUser = "Media" then strUser=""
if strUser = "Default" then strUser=""
if strUser = "IntuneAdmin" then strUser=""

if strUser &lt;&gt; "" then

on error resume next

objShell.Run "REG ADD " &amp; chr(34) &amp; "HKEY_Users\" &amp; objSubkey &amp; "\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"" /v NoViewContextMenu /t REG_DWORD /d 1 /f",0,false

end if

Next

SCCM – VBScript – Disable C Drive

email me

Compile to EXE, add the EXE you just created to SCCM as a package: Create Package > Environment > Program can run: Only when user is logged on > Run with administrator rights (or SYSTEM account).

on error resume next

Set objShell = CreateObject("Wscript.Shell")

Const HKEY_LOCAL_MACHINE = &amp;H80000002

Const OverwriteExisting = TRUE

strCurrentDirectory = objShell.CurrentDirectory

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")

Set objRegistry=GetObject("winmgmts:\\" &amp; strComputer &amp; "\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 &amp; "\" &amp; objSubkey

objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue

Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")

Set objAccount = objWMIService.Get("Win32_SID.SID='" &amp; objSubkey &amp; "'")

strUser = objAccount.AccountName

objSubkey = trim(objSubkey)'trims whitespace
strUser = trim(strUser)'trims whitespace

'LOGIC TO DETERMINE IF PROFILE IS TO BE ACCESSED
if strUser = "System" then strUser=""
if strUser = "Administrator" then strUser=""
if strUser = "Media" then strUser=""
if strUser = "Default" then strUser=""
if strUser = "IntuneAdmin" then strUser=""

if strUser &lt;&gt; "" then

on error resume next

'COPY FILES
'objShell.Run "cmd /c copy /y /v file1.txt C:\Users\" &amp; strUser &amp;
"\Desktop\file1.txt",0,true

'APPLY REG KEY
objShell.Run "REG ADD " &amp; chr(34) &amp; "HKEY_Users\" &amp; objSubkey &amp; "\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"" /v NoViewOnDrive /t REG_DWORD /d 00000004 /f",0,false

end if

Next