This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Downloads all policies | |
Invoke-CimMethod -ClassName SMS_Client -Namespace root/ccm -MethodName 'ResetPolicy' -Arguments @{ uFlags = [uint32]0 } | |
# Clears local policies and downloads all policies again | |
Invoke-CimMethod -ClassName SMS_Client -Namespace root/ccm -MethodName 'ResetPolicy' -Arguments @{ uFlags = [uint32]1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Code = @" | |
using System; | |
using System.Runtime.InteropServices; | |
namespace UserNotificationState { | |
public class NitsAndBits { | |
public enum UserNotificationState | |
{ | |
/// <summary> | |
/// A screen saver is displayed, the machine is locked, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Removes a QueryPanePageDescription from the details of an object in the MEMCM Admin Console | |
.DESCRIPTION | |
Reads the supplied XML-file and finds the node on which it will remove a PanePageDescription element. | |
This means that it will remove a tab from the details of an object in MEMCM. | |
The supplied example removes a tab from applications. | |
.EXAMPLE | |
$Params = @{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Adds a QueryPanePageDescription to the details of an object in the MEMCM Admin Console | |
.DESCRIPTION | |
Reads the supplied XML-file and finds the node on which it will add a PanePageDescription element. | |
This means that it will add a tab to the details of an object in MEMCM. | |
The supplied example adds a tab which adds a tab to applications which shows a list of devices | |
which has reported that the application has been installed. | |
.EXAMPLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the file "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\XmlStorage\ConsoleRoot\ManagementClassDescriptions.xml", locate the line where the declaration of SMS_DeploymentType starts (in SCCM 1906 its at line 7771). Should look like: | |
<ManagementClassDescription Name="SMS_DeploymentType" SuperclassName="SMS_ConfigurationItemBaseClass"> | |
Once you find it look for '<Properties>' and below that line you add: | |
<ManagementClassPropertyDescription Name="CIVersion" Type="Integer" /> | |
In my file i added it a little bit further down and now my file looks like this: | |
<ManagementClassPropertyDescription Name="PriorityInLatestApp" Type="Integer" /> | |
<ManagementClassPropertyDescription Name="CIVersion" Type="Integer" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[string]$BaselineName | |
) | |
$ErrorActionPreference = "Stop" | |
try { | |
$Params = @{ | |
Namespace = 'ROOT\ccm\Policy\Machine\ActualConfig' | |
ClassName = 'CCM_DCMCIAssignment' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Thank you CodyMathis123 (https://github.com/CodyMathis123) for adding ParameterSets to do it the right way! | |
Updated 2022-08-22 thanks to Bryan Dam who noticed that the XML definition was changed and Type became DataType. | |
Also renamed function because SCCM is the old name of the product. | |
#> | |
<# | |
.SYNOPSIS | |
Run a script with custom parameters over WMI in ConfigMgr | |
.DESCRIPTION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$MethodClass = [WmiClass]"\\COMPUTERNAME\NAMESPACE:CLASS" | |
$Method = "MethodName" | |
$InParams = $MethodClass.psbase.GetMethodParameters($Method) | |
$InParams.PSBase.properties | select Name,Value | format-Table | |
# Set the parameters with $InParams.Property = "" | |
# and invoke as follows | |
$Result = $MethodClass.InvokeMethod($Method, $InParams, $null) | |
$Result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Load-Module { | |
param( | |
$ModuleName, | |
[switch]$Force | |
) | |
$Params = @{ | |
ErrorAction = 'Stop' | |
} | |
if ($Force.IsPresent) { | |
$Params.Add('Force',$true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[string]$ExitCode | |
) | |
# http://www.msierrors.com/drivers/dpinst-exit-codes-explained/ | |
$DPInstInfo = New-Object psobject @{ | |
PackageInstallationFailure = $false | |
RebootRequired = $false | |
<# |
NewerOlder