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
# (Get-CimClass -Namespace root\ccm -ClassName sms_client).CimClassMethods['ResetPolicy'].Parameters | |
Invoke-CimMethod -Namespace root\ccm -ClassName sms_client -Name ResetPolicy -Arguments @{ uFlags = ([UInt32]1) } | |
Restart-Service CcmExec |
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
<# | |
# https://blogs.technet.microsoft.com/charlesa_us/2015/03/07/triggering-configmgr-client-actions-with-wmic-without-pesky-right-click-tools/ | |
# {00000000-0000-0000-0000-000000000001} Hardware Inventory | |
# {00000000-0000-0000-0000-000000000002} Software Inventory | |
# {00000000-0000-0000-0000-000000000003} Discovery Inventory | |
# {00000000-0000-0000-0000-000000000010} File Collection | |
# {00000000-0000-0000-0000-000000000011} IDMIF Collection | |
# {00000000-0000-0000-0000-000000000012} Client Machine Authentication | |
# {00000000-0000-0000-0000-000000000021} Request Machine Assignments | |
# {00000000-0000-0000-0000-000000000022} Evaluate Machine Policies |
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
get-ScheduledTask -TaskName "Configuration Manager Client Ugrade" | Start-ScheduledTask -Verbose |
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 Get-ContentIDToAppName { | |
param ( | |
$ContentID, | |
$ContentRevision = 1, | |
$SiteServer, | |
$Namespace | |
) | |
$AllInfo = Get-WmiObject -ComputerName $SiteServer -Namespace $Namespace -Query "SELECT SMS_Application.LocalizedDisplayName,SMS_CIToContent.ModelName FROM SMS_CIToContent INNER JOIN SMS_Application ON SMS_CIToContent.SecuredModelName = SMS_Application.ModelName WHERE SMS_CIToContent.ContentUniqueID = '$ContentID' AND SMS_CIToContent.ContentVersion = '$ContentRevision'" | |
New-Object -TypeName PSObject @{ | |
ApplicationName = $AllInfo.SMS_Application.LocalizedDisplayName |
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 | |
<# |
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
$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
<# | |
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
param( | |
[string]$BaselineName | |
) | |
$ErrorActionPreference = "Stop" | |
try { | |
$Params = @{ | |
Namespace = 'ROOT\ccm\Policy\Machine\ActualConfig' | |
ClassName = 'CCM_DCMCIAssignment' |
OlderNewer