Skip to content

Instantly share code, notes, and snippets.

View Kaidja's full-sized avatar

Kaido Järvemets Kaidja

View GitHub Profile
Import-CMMaintenanceWindows.ps1 -MWsInputFile E:\Scripts\MW\Maintenance_Solution.csv -Delimiter ',' -Production
Get-ChildItem PS1:\Application | Select-Object -Property Name,ContainerNodeID,ObjectType
$FolderID = 16777224 # ContainerNodeID property value
$SiteCode = "PS1"
$Query = "select * from SMS_ApplicationLatest where ModelName is
in(select InstanceKey from SMS_ObjectContainerItem where ObjectType='6000' and ContainerNodeID='$FolderID')"
$ApplicationsInFolder = Get-WmiObject -Namespace "ROOT\SMS\Site_$SiteCode" -Query $Query
$ApplicationsInFolder
Set-CMApplication -InputObject $ApplicationsInFolder -NewName "IT - Dell Command Monitor 2"
$SCCMCMPSHObject = ConvertTo-CMIResultObject -InputObject $ApplicationsInFolder
Set-CMApplication -InputObject $SCCMCMPSHObject -NewName "IT - Dell Command Monitor 2"
$ObjectPath = "/Dell/Sub1"
$ApplicationsInFolder = Get-WmiObject -Namespace "ROOT\SMS\Site_PS1" `
-Query "select * from SMS_ApplicationLatest where ObjectPath = '$ObjectPath'"
$ApplicationsInFolder
Invoke-Command -ScriptBlock {
Stop-Service -Name Spooler -Force
Set-Service -Name Spooler -StartupType Disabled
} -ComputerName SERVER1
Stop-Service -Name Spooler -Force
Set-Service -Name Spooler -StartupType Disabled
Configuration DSCDISABLEPRINTSPOOLER {
Import-DscResource –ModuleName 'PSDesiredStateConfiguration'
Node StandardConfiguration {
Service PrintSpooler {
Name = "Spooler"
DisplayName = "Print Spooler"
Ensure = "Present"
$AllLogs = Get-WinEvent -ListLog *
$PrinterLogs = $AllLogs | where LogName -eq "Microsoft-Windows-PrintService/Operational"
$PrinterLogs.IsEnabled = $True
$PrinterLogs.SaveChanges()