PowerShell – Create Zip and Backup File

  Notes Add-Type Join-Path Copy-Item Test-Path Remove-Item io.compression.zipfile Get Basic Details of a Loaded Assembly [appdomain]::currentdomain.GetAssemblies() | Where-Object Location -match ‘mscorlib’ Discover The Types/Classes Inside a Given Assembly ([appdomain]::currentdomain.GetAssemblies() | Where-Object Location -Match ‘mscorlib’).gettypes() To Discover the Members Within a Class (([appdomain]::currentdomain.GetAssemblies() | Where-Object location -match ‘mscorlib’).gettypes() | Where-Object name -eq ‘string’).getmembers() | Format-Table name, Read More …

PowerShell – Automate Cleanmgr.exe

/sagerun:1 ‘ Active Setup Temp Folders ‘ Content Indexer Cleaner ‘ Downloaded Program Files ‘ GameNewsFiles ‘ GameStatisticsFiles ‘ GameUpdateFiles ‘ Internet Cache Files ‘ Memory Dump Files ‘ Microsoft Office Temp Files ‘ Offline Pages Files ‘ Old ChkDsk Files ‘ Previous Installations ‘ Recycle Bin ‘ Service Pack Cleanup ‘ Setup Log Files Read More …

Batch – Return Major Build Version

Command Line FOR /f “tokens=1,2,3,4 delims=[.]” %a IN (‘ver’) DO ECHO %d In Script FOR /f “tokens=1,2,3,4 delims=[.]” %%a IN (‘ver’) DO SET wBuild=%%d ECHO %wBuild%   Notes for if %wBuild% LSS 19041 exit if %wBuild% LEQ 18362 exit if %wBuild% EQU 18362 exit :: 1903 if %wBuild% EQU 17763 exit :: 1809 if %wBuild% Read More …

AutoIt – Copy Current Page to Clipboard – Search for String

#include #include ; wait Sleep(5000) ; loop routine While 1 ; Click at the current mouse position. MouseClick($MOUSE_CLICK_LEFT) Sleep(5000) ; select all Send (“^a”) Sleep(1000) ; copy to clipboard Send (“^c”) Sleep(1000) ; return clipboard to string $sData = ClipGet() ; what to look for $searchstring = “AddSearchStringHere” ; logic for detection If StringInStr($sData, $searchstring) Read More …

SCCM Agent: CcmSetup failed with error code 0x80070643

I ran into an issue where I could not install the CM agent. This was the fix. Repair WMI Repair MOF Repair system files Reset Windows Updates   CCMSetup.log Errors File C:\WINDOWS\ccmsetup\{1990B09E-077D-46F9-B575-2AB675E44670}\client.msi installation failed. Error text: ExitCode: 1603 Action: SmsClientInstallSucceeded. ErrorMessages: An error occurred during the installation of assembly ‘Microsoft.ConfigurationManager.WinRTProvider.dll,Version=”5.0.0.0″,Culture=”neutral”,PublicKeyToken=”31bf3856ad364e35″‘. Please refer to Help and Read More …

SCCM – WQL – Return PKI-Client Certificate Type

To return the Client Certificate type (PKI or Self-Signed), use this code in the CM Console: Go to CM Console > Monitoring > Overview > Queries > Create Query Code SELECT DISTINCT SMS_R_System.Name, SMS_CombinedDeviceResources.UserName, SMS_CombinedDeviceResources.Domain, SMS_G_System_OPERATING_SYSTEM.BuildNumber, SMS_CombinedDeviceResources.ClientCertType FROM SMS_CombinedDeviceResources INNER JOIN SMS_R_System ON SMS_R_System.ResourceID = SMS_CombinedDeviceResources.ResourceID INNER JOIN SMS_G_System_OPERATING_SYSTEM ON SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_CombinedDeviceResources.ResourceID   Screenshot