Add files via upload
This commit is contained in:
parent
f1877e048a
commit
fc083ceaba
8 changed files with 91 additions and 0 deletions
54
Custom Protocols/Run-ApplicationID.ps1
Normal file
54
Custom Protocols/Run-ApplicationID.ps1
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Script used to execute applications directly from my Windows 10 Toast Notification Script
|
||||
|
||||
.NOTES
|
||||
Filename: Run-ApplicationID.ps1
|
||||
Version: 1.0
|
||||
Author: Martin Bengtsson
|
||||
Blog: www.imab.dk
|
||||
Twitter: @mwbengtsson
|
||||
|
||||
.LINKS
|
||||
https://www.imab.dk/windows-10-toast-notification-script
|
||||
#>
|
||||
|
||||
# Function for triggering the installation or reparing of applications
|
||||
# Parts of this function is heavily inspired by Timmy's post at: https://timmyit.com/2016/08/08/sccm-and-powershell-force-installuninstall-of-available-software-in-software-center-through-cimwmi-on-a-remote-client/
|
||||
# Function is modified to cater for a scenario where the application needs repairing instead of installing
|
||||
# Also removed bits and pieces which I don't need :-)
|
||||
function Trigger-AppInstallation() {
|
||||
param(
|
||||
[String][Parameter(Mandatory=$true)] $appID
|
||||
)
|
||||
|
||||
Begin {
|
||||
$application = (Get-CimInstance -ClassName CCM_Application -Namespace "root\ccm\clientSDK" | Where-Object {$_.Id -eq $appID})
|
||||
$args = @{EnforcePreference = [UINT32] 0
|
||||
Id = "$($application.Id)"
|
||||
IsMachineTarget = $application.IsMachineTarget
|
||||
IsRebootIfNeeded = $false
|
||||
Priority = 'High'
|
||||
Revision = "$($application.Revision)"}
|
||||
}
|
||||
|
||||
Process {
|
||||
if ($application.InstallState -eq "NotInstalled") {
|
||||
try {
|
||||
Invoke-CimMethod -Namespace "root\ccm\clientSDK" -ClassName CCM_Application -MethodName Install -Arguments $args
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
elseif ($application.InstallState -eq "Installed") {
|
||||
try {
|
||||
Invoke-CimMethod -Namespace "root\ccm\clientSDK" -ClassName CCM_Application -MethodName Repair -Arguments $args
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
End { }
|
||||
}
|
||||
$registryPath = "HKCU:\SOFTWARE\ToastNotificationScript"
|
||||
$applicationID = (Get-ItemProperty -Path $RegistryPath -Name "RunApplicationID").RunApplicationID
|
||||
Trigger-AppInstallation -appID $applicationID
|
||||
20
Custom Protocols/Run-PackageID.ps1
Normal file
20
Custom Protocols/Run-PackageID.ps1
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Script used to execute packages and task sequences directly from my Windows 10 Toast Notification Script
|
||||
|
||||
.NOTES
|
||||
Filename: Run-PackageID.ps1
|
||||
Version: 1.0
|
||||
Author: Martin Bengtsson
|
||||
Blog: www.imab.dk
|
||||
Twitter: @mwbengtsson
|
||||
|
||||
.LINKS
|
||||
https://www.imab.dk/windows-10-toast-notification-script
|
||||
#>
|
||||
|
||||
$RegistryPath = "HKCU:\SOFTWARE\ToastNotificationScript"
|
||||
$PackageID = (Get-ItemProperty -Path $RegistryPath -Name "RunPackageID").RunPackageID
|
||||
$SoftwareCenter = New-Object -ComObject "UIResource.UIResourceMgr"
|
||||
$ProgramID = "*"
|
||||
$SoftwareCenter.ExecuteProgram($ProgramID,$PackageID,$true)
|
||||
1
Custom Protocols/ToastReboot.cmd
Normal file
1
Custom Protocols/ToastReboot.cmd
Normal file
|
|
@ -0,0 +1 @@
|
|||
shutdown /r /t 0 /d p:0:0 /c "Toast Notification Reboot"
|
||||
BIN
Custom Protocols/ToastRebootProtocol.reg
Normal file
BIN
Custom Protocols/ToastRebootProtocol.reg
Normal file
Binary file not shown.
2
Custom Protocols/ToastRunApplicationID.cmd
Normal file
2
Custom Protocols/ToastRunApplicationID.cmd
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File "C:\ProgramData\ToastNotificationScript\Run-ApplicationID.ps1"
|
||||
|
||||
12
Custom Protocols/ToastRunApplicationID.reg
Normal file
12
Custom Protocols/ToastRunApplicationID.reg
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
Windows Registry Editor Version 5.00
|
||||
|
||||
[HKEY_CLASSES_ROOT\ToastRunApplicationID]
|
||||
"URL Protocol"=""
|
||||
@="URL:ToastRunApplicationID Protocol"
|
||||
|
||||
[HKEY_CLASSES_ROOT\ToastRunApplicationID\shell]
|
||||
|
||||
[HKEY_CLASSES_ROOT\ToastRunApplicationID\shell\open]
|
||||
|
||||
[HKEY_CLASSES_ROOT\ToastRunApplicationID\shell\open\command]
|
||||
@="C:\\ProgramData\\ToastNotificationScript\\ToastRunApplicationID.cmd"
|
||||
2
Custom Protocols/ToastRunPackageID.cmd
Normal file
2
Custom Protocols/ToastRunPackageID.cmd
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File "C:\ProgramData\ToastNotificationScript\Run-PackageID.ps1"
|
||||
|
||||
BIN
Custom Protocols/ToastRunPackageID.reg
Normal file
BIN
Custom Protocols/ToastRunPackageID.reg
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue