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:
<# | |
.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'. |
//===================================================== | |
//---------------| 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 |
<# | |
.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 |
<# | |
.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 |
SELECT CI_ID, | |
title | |
FROM v_AuthListInfo | |
-- Naming Filtering if you want it | |
WHERE title LIKE '%required%' | |
AND title NOT LIKE '%office%' |
/* | |
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 |
## 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 |
## 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 |
## 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 |
I hereby claim:
To claim this, I am signing this object: