Skip to content

Instantly share code, notes, and snippets.

View Ioan-Popovici's full-sized avatar

Ioan Popovici Ioan-Popovici

View GitHub Profile
@Ioan-Popovici
Ioan-Popovici / Clean-CMClientCache.ps1
Last active June 21, 2023 09:40
Cleans the configuration manager client cache of all unneeded with the option to delete persistent content.
<#
.SYNOPSIS
Cleans the configuration manager client cache.
.DESCRIPTION
Cleans the configuration manager client cache of all unneeded with the option to delete persisted content.
.PARAMETER CleanupActions
Specifies cleanup action to perform. ('All', 'Applications', 'Packages', 'Updates', 'Orphaned'). Default is: 'All'.
If it's set to 'All' all cleaning actions will be performed.
.PARAMETER LowDiskSpaceThreshold
Specifies the low disk space threshold percentage after which the cache is cleaned. Default is: '100'.
@Ioan-Popovici
Ioan-Popovici / SQLExtension.mof
Last active July 14, 2023 10:28
HWI EXT SQL Classes for SQL Server Product Reporting
//=====================================================
//---------------| SQL extension start |---------------
//=====================================================
/*
.SYNOPSIS
Gathers SQL product info.
.DESCRIPTION
Gathers SQL product info, id and product key and adds them to custom WMI Classes.
.NOTES
@Ioan-Popovici
Ioan-Popovici / Get-ADForestComputers.ps1
Last active January 3, 2019 17:14
Gets AD computer name, operating system and domain from a list of forests.
<#
.SYNOPSIS
Gets AD computer information from a list of forests.
.DESCRIPTION
Gets AD computer name, operating system and domain from a list of forests.
.EXAMPLE
Get-AdForestComputers.ps1
.INPUTS
System.String.
.OUTPUTS
@Ioan-Popovici
Ioan-Popovici / New-CMMaintenanceWindows.ps1
Last active May 9, 2019 12:12
Creates maintenance windows on SCCM Collections based on patch tuesday.
<#
.SYNOPSIS
Creates maintenance windows on SCCM collections.
.DESCRIPTION
Creates maintenance windows on SCCM collections based on patch tuesday.
.EXAMPLE
New-MaintenanceWindows.ps1
.NOTES
Written in collaboration with my good friend Octavian Cordos.
.INPUTS
@Ioan-Popovici
Ioan-Popovici / SU.States.Update_Groups_per_Collection.Naming_Filter.sql
Last active March 21, 2016 17:26
Machine Software Update Compliance for Multiple SUG's per Collection - Naming Filter Query
SELECT CI_ID,
title
FROM v_AuthListInfo
-- Naming Filtering if you want it
WHERE title LIKE '%required%'
AND title NOT LIKE '%office%'
@Ioan-Popovici
Ioan-Popovici / SU.States.Update_Groups_per_Collection.SUG.sql
Last active March 21, 2016 17:26
Machine Software Update Compliance for Multiple SUG's per Collection - Main SUG Query
/*
DECLARE @CollID varchar(8) = 'Collection ID for Testing'
DECLARE @UserSIDs VARCHAR(16);
SELECT @UserSIDs = 'disabled';
*/
-- Getting Deployments IDs
DECLARE @lcid AS int SET @lcid = dbo.fn_LShortNameToLCID('English')
SELECT cia.AssignmentID AS id INTO #ASSIGNID
@Ioan-Popovici
Ioan-Popovici / Remove-PSModuleExample1.ps1
Created May 17, 2016 08:05
Powershell Error Handling without Try/Catch
## Powershell Error Handling without Try/Catch
# Declaring module Paths
$OSDScriptsPath1 = "C:\Windows\System32\WindowsPowerShell\v1.0\Modules\OSDScripts"
$OSDScriptsPath2 = "C:\Program Files\WindowsPowerShell\Modules\OSDScripts"
# Removing module using SilentlyContinue parameter and Err variable to store execution errors
Remove-Item -Path $OSDScriptsPath1 -Recurse -Force -ErrorAction SilentlyContinue -ErrorVariable +Err
Remove-Item -Path $OSDScriptsPath2 -Recurse -Force -ErrorAction SilentlyContinue -ErrorVariable +Err
@Ioan-Popovici
Ioan-Popovici / Remove-PSModuleExample2.ps1
Last active May 24, 2016 08:02
Powershell Error Handling with Try/Catch
## Powershell Error Handling with Try/Catch
# Declaring module Paths
$OSDScriptsPath1 = "C:\Windows\System32\WindowsPowerShell\v1.0\Modules\OSDScripts"
$OSDScriptsPath2 = "C:\Program Files\WindowsPowerShell\Modules\OSDScripts"
# Removing module using -ErrorAction Stop parameter and Err variable to store execution errors
# We use -ErrorAction Stop in order to treat all errors as Terminating Errors
Try {
Remove-Item -Path $OSDScriptsPath1 -Recurse -Force -ErrorAction Stop -ErrorVariable +Err
@Ioan-Popovici
Ioan-Popovici / Remove-PSModuleExample3.ps1
Last active May 24, 2016 08:01
Powershell Error Handling with Try/Catch, using multiple commands or variables
## Powershell Error Handling with Try/Catch, using multiple commands or variables
# Declaring module Paths as array
$OSDScriptsPaths =@(
"C:\Windows\System32\WindowsPowerShell\v1.0\Modules\OSDScripts",
"C:\Program Files\WindowsPowerShell\Modules\OSDScripts"
)
# Parse OSDScriptsPaths array and for each item try to remove the module using -ErrorAction Stop parameter and Err variable to store execution errors
# We use -ErrorAction Stop in order to treat all errors as Terminating Errors

Keybase proof

I hereby claim:

  • I am JhonnyTerminus on github.
  • I am ioanpopovici (https://keybase.io/ioanpopovici) on keybase.
  • I have a public key whose fingerprint is F0FD 54F5 DE1A 325D 8474 CA62 FE1A 5505 3EEA 4CBB

To claim this, I am signing this object: