├── .DS_Store ├── .gitignore ├── 2013RevitBuildingPremiumUninstaller.ps1 ├── 2014AutodeskUninstaller.ps1 ├── ADGroupUserInfo.ps1 ├── ActivateOfficeWindows.ps1 ├── ActiveSetup.ps1 ├── AddRemoveProgramEntries.ps1 ├── AddRemovePrograms.ps1 ├── AddUserToLocalAdminGroup.ps1 ├── AdministratorReport.ps1 ├── AdobeReaderAutomaticUpdate.ps1 ├── AntiVirusScan.ps1 ├── AntiVirusScanEmail.ps1 ├── AppChecker.ps1 ├── ApplicationList.ps1 ├── ApplicationShortcuts.ps1 ├── ApplicationUninstallScript.ps1 ├── ApplicationVirusDetectionMethod.ps1 ├── ApplicationVirusDetectionMethodEmail.ps1 ├── AutoRedact_Plug-In_1.9.6.0.xml ├── AutodeskBDSUninstaller.ps1 ├── BIOSSettings.ps1 ├── BackupBitlockerRecoverykey.ps1 ├── BitlockerEncryptionReporting.ps1 ├── BitlockerRecoveryKey.ps1 ├── BitlockerRecoveryPasswordADBackupCleanup.ps1 ├── BitlockerSAK_CheckTPM.ps1 ├── BitlockerSystem.ps1 ├── Bldg_Premium_Full.vbs ├── BootEnvironment.ps1 ├── CacheInfo.mif ├── CachedMode.ps1 ├── ChangeSMSCacheSize.au3 ├── CiscoJabberChat.ps1 ├── CiscoJabberChatCleanup.ps1 ├── ClearDellBIOSPassword.ps1 ├── ClearPrintSpooler.ps1 ├── ClearTPM.ps1 ├── ConfigMgrRebootReport.ps1 ├── ConfigMgrSQLFirewallSettings.ps1 ├── ConfigMgrUpgrade.ps1 ├── ConfigurePowerShell.ps1 ├── CopyProfile.ps1 ├── CreateUSB.vbs ├── DCSU.ps1 ├── DPCleanup.ps1 ├── DefaultPrinterReport.ps1 ├── DellBIOSDriverUpdate.ps1 ├── DellBIOSReportingTool.ps1 ├── DellBIOSUpdater.ps1 ├── DellBIOSVerifier.ps1 ├── DellCommandUpdate.ps1 ├── DellDriverUpdate.ps1 ├── DisableOfflineFiles.reg ├── DisableWindowsMediaCenter.ps1 ├── EmailEnvVariable.ps1 ├── EnableBitlocker.ps1 ├── EnableDisableOfflineFiles.vbs ├── ExchangeModeReporting.ps1 ├── FindRegistryUninstall.ps1 ├── FlashBIOS.vbs ├── Get-MSUFileInfo.ps1 ├── GetDefaultPrinter.ps1 ├── GetFileProperties.ps1 ├── GetLocalAdministrators.ps1 ├── GetPrinterList.ps1 ├── GetSoftwareNameGUID.ps1 ├── HWInventory.ps1 ├── IEActiveX.ps1 ├── ImportADExtensions.ps1 ├── ImportSCCMModule.ps1 ├── InactiveSCCMSystemsReport.ps1 ├── InitializeTPM.ps1 ├── InstallAcrobat.ps1 ├── InstallActiveDirectoryModule.ps1 ├── InstallAutodeskRevit.vbs ├── InstallCCTK.vbs ├── InstallCCTK_old.vbs ├── InstallChrome.ps1 ├── InstallConfigMgrModule.ps1 ├── InstallDotNet47.ps1 ├── InstallEndPoint_build.ps1 ├── InstallFirefox.ps1 ├── InstallFlash.ps1 ├── InstallFlash.vbs ├── InstallFonts.ps1 ├── InstallFonts.vbs ├── InstallJava.ps1 ├── InstallJava.vbs ├── InstallOffice.vbs ├── InstallOfficeUpdates.vbs ├── InstallOnlineUpdates.ps1 ├── InstallOpenLM.cmd ├── InstallPowerShellGallery.ps1 ├── InstallQuickTime.vbs ├── InstallReader.ps1 ├── InstallReaderX.vbs ├── InstallSCCMClient_Standalone.ps1 ├── Install_CMTrace.ps1 ├── Install_wmf4.ps1 ├── InstalledApplications.ps1 ├── InstallerTemplate.vbs ├── Invoke-MSI.ps1 ├── LGPO.ps1 ├── LICENSE ├── LastReboot.ps1 ├── LastRebootTime.ps1 ├── LicensedSoftwareVerification.ps1 ├── ListUpdates.vbs ├── LocalAdministrators.ps1 ├── LocalAdministratorsDetection.ps1 ├── LocalAdministratorsReport.ps1 ├── LocalAdministratorsReporting.ps1 ├── LocalAdmins.ps1 ├── LoggedOffSystems.vbs ├── LogonLogoff.ps1 ├── LogonTimes.ps1 ├── MDTBuildReportingTool.ps1 ├── MECMADCleanup.ps1 ├── MSIAnalyzer.ps1 ├── MSPInfo.ps1 ├── MandatoryReboot.ps1 ├── MandatoryRebootCustomDetection.ps1 ├── MappedDriveReport.ps1 ├── MaxResolution.ps1 ├── Microsoft Office 2010 Deployment.mpt ├── MicrosoftSpectrePatchCompatibility.ps1 ├── MissingBitlockerKeys.ps1 ├── ModifyINI.vbs ├── MountWIM.vbs ├── MouseMover.ps1 ├── MoveComputerToOU.ps1 ├── MoveInstallationProgressWindow_x64.au3 ├── MoveInstallationProgressWindow_x86.au3 ├── NICAdvancedProperties.ps1 ├── NICPowerManagement.ps1 ├── OfficeUpdater.ps1 ├── OnlineUpdate.ps1 ├── OperatingSystemDetection.ps1 ├── PPI.ps1 ├── Pause.vbs ├── PendingRebootReporting.ps1 ├── Permissioning.ps1 ├── PingInstall.ps1 ├── PingUninstall.ps1 ├── PowerShellRunAsAdmin.reg ├── PowerShellSCCMConnect1.ps1 ├── PowerShellVerbs.xlsx ├── PrinterInstaller.ps1 ├── ProfileRobocopy.vbs ├── ProfileSizeReporting.ps1 ├── QueryEventViewerLogs.ps1 ├── README.md ├── RebootManagement.ps1 ├── RebootReporting.ps1 ├── RemoveOutlookDataFiles.ps1 ├── ResetNetworkAdaptor.ps1 ├── RestartComputer.ps1 ├── RetrieveBitlockerRecoveryKey.ps1 ├── Revit2013Hotfix.ps1 ├── RobocopyProfile.ps1 ├── SCCMADCleanup.ps1 ├── SCCMADReport.ps1 ├── SCCMActions.ps1 ├── SCCMBootImage.ps1 ├── SCCMClientInstaller.ps1 ├── SCCMDuplicateCleanup.ps1 ├── SCCMHardwareInventory.ps1 ├── SMARTReporting.ps1 ├── SMSCache.vbs ├── SQLBackupVerification.ps1 ├── ScreenResolution.au3 ├── SecureBoot.ps1 ├── SecureScreenStopper.EXE ├── SecureScreenStopper.ps1 ├── Set-PowerScheme.ps1 ├── SetDellBIOSPassword.ps1 ├── SetPageFileSize.vbs ├── SoftwareUpdateGroupCreator.ps1 ├── Sysprep.vbs ├── SystemInformationWMI.ps1 ├── TakeOwnership.ps1 ├── TrimbleSketchupInstaller.vbs ├── TrustedSitesReport.ps1 ├── TurnOnTPM.ps1 ├── UAC.vbs ├── USMT PC-to-PC.vbs ├── USMTCapture.vbs ├── USMT_Capture.vbs ├── Uninstall-InnoSetup.ps1 ├── UninstallBuilt-InApps.ps1 ├── UninstallCS3.vbs ├── UninstallChrome.ps1 ├── UninstallFirefox.ps1 ├── UninstallFlash.ps1 ├── UninstallJava.ps1 ├── UninstallMSIByName.ps1 ├── UninstallMSIbyGUID.ps1 ├── UninstallPrinters.ps1 ├── UninstallQuicktime.ps1 ├── UninstallReader.ps1 ├── UnmountWIM.vbs ├── UpdateBIOSWinPE.ps1 ├── UpdateDriversBIOS.ps1 ├── UpdateList.ps1 ├── UpdateWIM.ps1 ├── UserLoggedOn.vbs ├── VMWareConfigMgr.ps1 ├── ValidateSystems.ps1 ├── VerifyBaseBuild.vbs ├── VerifyBuild.ps1 ├── VerifyGUID.ps1 ├── VerifyReboot.ps1 ├── VerifyWindowsFeature.ps1 ├── WOL.ps1 ├── WakeOnLAN.ps1 ├── WhosLoggedOn.ps1 ├── Windows10AppDeprovisioning.ps1 ├── WindowsFeatures.ps1 ├── WindowsUpdatesReport.ps1 ├── ZTIBIOS.vbs ├── ZTIConditionalReboot.ps1 ├── ZTIDellDriverUpdate.ps1 ├── ZTIWindowsUpdates.ps1 ├── ZertoUnprotectedSystems.ps1 ├── mms.cfg └── multiplatform.ini /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicksITBlogs/PowerShell/HEAD/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | DellBIOSUpdater.TempPoint.ps1 3 | BIOSVerifier.TempPoint.ps1 4 | DellBIOSVerifier.TempPoint.ps1 5 | InstallPowerShellGallery.TempPoint.ps1 6 | UninstallMSIByGUID.TempPoint.ps1 7 | -------------------------------------------------------------------------------- /2014AutodeskUninstaller.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicksITBlogs/PowerShell/HEAD/2014AutodeskUninstaller.ps1 -------------------------------------------------------------------------------- /ADGroupUserInfo.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | AD Security Group User Additions 4 | 5 | .DESCRIPTION 6 | This script retrieves a list of users added to a specified AD security group, which includes the date it was last modified. This info can be used to track whether a new user has been recently added to a security group, especially a group that elevates priviledges. This can be used as a tool to help fight cyber-crime. 7 | 8 | .PARAMETER NumberOfDays 9 | Number of days to look back for users having been added to the designated AD security group 10 | 11 | .PARAMETER SecurityGroup 12 | Name of the AD security group 13 | 14 | .NOTES 15 | =========================================================================== 16 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 17 | Created on: 9/1/2020 11:03 AM 18 | Created by: Mick Pletcher 19 | Filename: ADGroupUserInfo.ps1 20 | =========================================================================== 21 | #> 22 | 23 | [CmdletBinding()] 24 | param 25 | ( 26 | [ValidateNotNullOrEmpty()] 27 | [int]$NumberOfDays, 28 | [ValidateNotNullOrEmpty()] 29 | [string]$SecurityGroup 30 | ) 31 | 32 | Function Get-ADGroupMemberDate { 33 | 34 | [cmdletbinding()] 35 | Param ( 36 | [parameter(ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True, Mandatory = $True)] 37 | [string]$Group 38 | 39 | ) 40 | 41 | Begin { 42 | [regex]$pattern = '^(?\w+)\s+member(?:\s(?\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})\s+(?:.*\\)?(?\w+|(?:(?:\w{8}-(?:\w{4}-){3}\w{12})))\s+(?:\d+)\s+(?:\d+)\s+(?\d+))?' 43 | $DomainController = ($env:LOGONSERVER -replace "\\\\") 44 | If (!$DomainController) { 45 | Throw "Computer from which script is run is not joined to domain and domain controller can not be identified." 46 | Break 47 | } 48 | } 49 | Process { 50 | Write-Verbose "Checking distinguished name of the group $Group" 51 | Try { 52 | $distinguishedName = (Get-ADGroup -Identity $Group).DistinguishedName 53 | } Catch { 54 | Write-Warning "$group can not be found!" 55 | Break 56 | } 57 | $RepadminMetaData = (repadmin /showobjmeta $DomainController $distinguishedName | Select-String "^\w+\s+member" -Context 2) 58 | $Array = @() 59 | ForEach ($rep in $RepadminMetaData) { 60 | If ($rep.line -match $pattern) { 61 | $object = New-Object PSObject -Property @{ 62 | Username = [regex]::Matches($rep.context.postcontext, "CN=(?.*?),.*") | ForEach-Object { 63 | $_.Groups['Username'].Value 64 | } 65 | LastModified = If ($matches.DateTime) { 66 | [datetime]$matches.DateTime 67 | } Else { 68 | $Null 69 | } 70 | DomainController = $matches.dc 71 | Group = $group 72 | State = $matches.state 73 | ModifiedCounter = $matches.modified 74 | } 75 | $Array += $object 76 | } 77 | } 78 | Return $Array 79 | } 80 | End { 81 | } 82 | } 83 | 84 | $Users = Get-ADGroupMemberDate -Group $SecurityGroup | Select Username, LastModified 85 | $NewUsers = @() 86 | #Find users added to the AD Group within the designated number of days 87 | Foreach ($User in $Users) { 88 | If ((New-TimeSpan -Start $User.LastModified -End (Get-Date)).Days -lt $NumberOfDays) { 89 | $NewUsers += $User 90 | } 91 | } 92 | If ($NewUsers.Count -gt 0) { 93 | Write-Output $NewUsers 94 | } else { 95 | Exit 1 96 | } 97 | -------------------------------------------------------------------------------- /ActiveSetup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Author: Mick Pletcher 3 | Date: 06 March 2014 4 | Synopsis: This will generate the active setup registry key to 5 | deploy to machines so it iterates through every user that 6 | logs onto a machine. 7 | Description: This will prompt for the title, brief description, version, and 8 | command line execution string. It then generates the .reg file 9 | and places it in the same directory as the script was executed from. 10 | #> 11 | 12 | Function GetRelativePath{ 13 | 14 | #Declare Local Memory 15 | Set-Variable -Name RelativePath -Scope Local -Force 16 | 17 | $RelativePath = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\" 18 | Return $RelativePath 19 | 20 | #Cleanup Local Memory 21 | Remove-Variable -Name RelativePath -Scope Local -Force 22 | 23 | } 24 | 25 | Function GenerateGUID { 26 | 27 | #Declare Local Memory 28 | Set-Variable -Name GetGUID -Scope Local -Force 29 | 30 | $GetGUID = [guid]::NewGuid() 31 | $GetGUID = $GetGUID.ToString().ToUpper() 32 | 33 | return $GetGUID 34 | 35 | #Cleanup Local Memory 36 | Remove-Variable -Name GetGUID -Scope Local -Force 37 | 38 | } 39 | 40 | Function GetKeyInfo { 41 | 42 | #Declare Local Memory 43 | Set-Variable -Name ComponentID -Scope Local -Force 44 | Set-Variable -Name Description -Scope Local -Force 45 | Set-Variable -Name StubPath -Scope Local -Force 46 | Set-Variable -Name Version -Scope Local -Force 47 | 48 | $ComponentID = Read-Host "Enter the title" 49 | $Description = Read-Host "Enter brief description" 50 | $Version = Read-Host "Enter the version number" 51 | $StubPath = Read-Host "Enter the command line execution string" 52 | $StubPath = $StubPath -replace '\\','\\' 53 | Return $ComponentID, $Description, $Version, $StubPath 54 | 55 | #Cleanup Local Memory 56 | Remove-Variable -Name ComponentID -Scope Local -Force 57 | Remove-Variable -Name Description -Scope Local -Force 58 | Remove-Variable -Name StubPath -Scope Local -Force 59 | Remove-Variable -Name Version -Scope Local -Force 60 | 61 | } 62 | 63 | Function GenerateRegKey ($RelativePath, $GUID, $KeyInfo) { 64 | 65 | #Declare Local Memory 66 | Set-Variable -Name File -Scope Local -Force 67 | Set-Variable -Name Text -Scope Local -Force 68 | 69 | $File = $RelativePath+"ActiveSetup.reg" 70 | If (Test-Path $File) { 71 | Remove-Item -Path $File -Force 72 | } 73 | New-Item -Name ActiveSetup.reg -Path $RelativePath -ItemType file -Force 74 | $Text = "Windows Registry Editor Version 5.00" 75 | Add-Content -Path $File -Value $Text -Force 76 | $Text = [char]13 77 | Add-Content -Path $File -Value $Text -Force 78 | $Text = "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{"+$GUID+"}]" 79 | Add-Content -Path $File -Value $Text -Force 80 | $Text = "@="+[char]34+$KeyInfo[1]+[char]34 81 | Add-Content -Path $File -Value $Text -Force 82 | $Text = [char]34+"ComponentID"+[char]34+"="+[char]34+$KeyInfo[0]+[char]34 83 | Add-Content -Path $File -Value $Text -Force 84 | $Text = [char]34+"StubPath"+[char]34+"="+[char]34+$KeyInfo[3]+[char]34 85 | Add-Content -Path $File -Value $Text -Force 86 | $Text = [char]34+"Version"+[char]34+"="+[char]34+$KeyInfo[2]+[char]34 87 | Add-Content -Path $File -Value $Text -Force 88 | 89 | #Cleanup Local Memory 90 | Remove-Variable -Name File -Scope Local -Force 91 | Remove-Variable -Name Text -Scope Local -Force 92 | 93 | } 94 | 95 | #Declare Global Memory 96 | Set-Variable -Name GUID -Scope Local -Force 97 | Set-Variable -Name KeyInfo -Scope Local -Force 98 | Set-Variable -Name RelativePath -Scope Local -Force 99 | 100 | cls 101 | $RelativePath = GetRelativePath 102 | $GUID = GenerateGUID 103 | $KeyInfo = GetKeyInfo 104 | GenerateRegKey $RelativePath $GUID $KeyInfo 105 | 106 | #Cleanup Global Memory 107 | Remove-Variable -Name GUID -Scope Local -Force 108 | Remove-Variable -Name KeyInfo -Scope Local -Force 109 | Remove-Variable -Name RelativePath -Scope Local -Force 110 | -------------------------------------------------------------------------------- /AddRemoveProgramEntries.ps1: -------------------------------------------------------------------------------- 1 | Function AddRemovePrograms($KeyName, $DisplayName, $Version){ 2 | 3 | #Define Local Memory 4 | New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT 5 | Set-Variable -Name AddRemKey -Scope Local -Force 6 | Set-Variable -Name guid -Scope Local -Force 7 | Set-Variable -Name ProductsKey -Scope Local -Force 8 | 9 | If (!(Test-Path c:\windows\GSPBox_Icon.bmp)){ 10 | Copy-Item -Path \\global.gsp\data\clients\na_clients\Build\Add-ins\GSPBox_Icon.bmp -Destination c:\Windows -Force 11 | } 12 | $AddRemKey = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" 13 | $ProductsKey = "HKCR:\Installer\Products\" 14 | New-Item -Path $AddRemKey -Name $KeyName –Force 15 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name DisplayName -Value $DisplayName -PropertyType String 16 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name DisplayVersion -Value $Version -PropertyType String 17 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name UninstallString -Value " " -PropertyType String 18 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name Publisher -Value "Gresham, Smith and Partners" -PropertyType String 19 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name DisplayIcon -Value "c:\windows\GSPBox_Icon.bmp" -PropertyType String 20 | $guid = [guid]::NewGuid().ToString("N") 21 | $guid.ToString() 22 | $guid = $guid.ToUpper() 23 | New-Item -Path $ProductsKey -Name $guid –Force 24 | New-ItemProperty -Path $ProductsKey"\"$guid -Name ProductName -Value $DisplayName -PropertyType String -Force 25 | 26 | #Cleanup Local Memory 27 | remove-psdrive -name HKCR 28 | Remove-Variable -Name AddRemKey -Scope Local -Force 29 | Remove-Variable -Name guid -Scope Local -Force 30 | Remove-Variable -Name ProductsKey -Scope Local -Force 31 | } -------------------------------------------------------------------------------- /AddRemovePrograms.ps1: -------------------------------------------------------------------------------- 1 | #******************************************************************************* 2 | # Author: Mick Pletcher 3 | # Date: 12 June 2013 4 | # 5 | # Program: Add/Remove Programs 6 | # Description: This script will either list all applications in the Add/Remove 7 | # programs, which is pulled from both the registry. On a 64-bit 8 | # machine, it pulls from both the x86 and x64 add/remove programs 9 | # registry entries. You will also have the option to search for 10 | # a specific application. 11 | #******************************************************************************* 12 | 13 | cls 14 | $Global:OS 15 | 16 | Function GetOSArchitecture{ 17 | $Global:OS=Get-WMIObject win32_operatingsystem 18 | #$Global:OS.OSArchitecture 19 | #Answers: 32-bit, 64-bit 20 | } 21 | 22 | $DisplayOutput = $false 23 | GetOSArchitecture 24 | [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") 25 | [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null 26 | $Output = [System.Windows.Forms.MessageBox]::Show("Search for a specific program?" , "Status" , 4) 27 | If ($Output -eq "Yes"){ 28 | $ProgramName = [Microsoft.VisualBasic.Interaction]::InputBox("Enter specific software name:") 29 | $ProgramName = "*"+$ProgramName+"*" 30 | } 31 | If ($Global:OS.OSArchitecture -eq "32-bit"){ 32 | $RegPath = "HKLM:\software\microsoft\windows\currentversion\uninstall\" 33 | $Results = Get-ChildItem $RegPath -Recurse -ErrorAction SilentlyContinue 34 | foreach ($item in $Resultsx86){ 35 | If (($item.GetValue("DisplayName") -ne $null) -and ($item.GetValue("UninstallString") -ne $null)) { 36 | Write-Host 37 | Write-Host 38 | Write-Host " Software: "$item.GetValue("DisplayName") 39 | Write-Host " Version: "$item.GetValue("DisplayVersion") 40 | Write-Host "Uninstaller: "$item.GetValue("UninstallString") 41 | } 42 | } 43 | } 44 | If ($Global:OS.OSArchitecture -eq "64-bit"){ 45 | $RegPathx86 = "HKLM:\software\wow6432node\microsoft\windows\currentversion\uninstall\" 46 | $RegPathx64 = "HKLM:\software\microsoft\windows\currentversion\uninstall\" 47 | $Resultsx86 = Get-ChildItem $RegPathx86 -Recurse -ErrorAction SilentlyContinue 48 | $Resultsx64 = Get-ChildItem $RegPathx64 -Recurse -ErrorAction SilentlyContinue 49 | foreach ($item in $Resultsx86){ 50 | If (($item.GetValue("DisplayName") -ne $null) -and ($item.GetValue("UninstallString") -ne $null)) { 51 | If ($Output -eq "Yes"){ 52 | If ($item.GetValue("DisplayName") -like $ProgramName){ 53 | $DisplayOutput = $true 54 | } 55 | }else{ 56 | $DisplayOutput = $true 57 | } 58 | If ($DisplayOutput -eq $true){ 59 | Write-Host 60 | Write-Host 61 | Write-Host " Software: "$item.GetValue("DisplayName") 62 | Write-Host " Version: "$item.GetValue("DisplayVersion") 63 | Write-Host "Uninstaller: "$item.GetValue("UninstallString") 64 | } 65 | } 66 | $DisplayOutput = $false 67 | } 68 | $DisplayOutput = $false 69 | foreach ($item in $Resultsx64){ 70 | If (($item.GetValue("DisplayName") -ne $null) -and ($item.GetValue("UninstallString") -ne $null)) { 71 | If ($Output -eq "Yes"){ 72 | If ($item.GetValue("DisplayName") -like $ProgramName){ 73 | $DisplayOutput = $true 74 | } 75 | }else{ 76 | $DisplayOutput = $true 77 | } 78 | If ($DisplayOutput -eq $true){ 79 | Write-Host 80 | Write-Host 81 | Write-Host " Software: "$item.GetValue("DisplayName") 82 | Write-Host " Version: "$item.GetValue("DisplayVersion") 83 | Write-Host "Uninstaller: "$item.GetValue("UninstallString") 84 | } 85 | } 86 | $DisplayOutput = $false 87 | } 88 | } -------------------------------------------------------------------------------- /AdministratorReport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Administrator Report 4 | 5 | .DESCRIPTION 6 | This tool is intended to keep staff informed of new administrator accounts. This script queries for a list of users in the specified administrator group(s). It then produces a list of the administrator users that got created within the specified number of days. 7 | 8 | .PARAMETER Days 9 | Number of days since the administrator account was created 10 | 11 | .NOTES 12 | =========================================================================== 13 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2021 v5.8.195 14 | Created on: 11/9/2021 1:37 PM 15 | Created by: Mick Pletcher 16 | Filename: AdministratorReport.ps1 17 | =========================================================================== 18 | #> 19 | Param 20 | ( 21 | [ValidateNotNullOrEmpty()][int]$Days = 1 22 | ) 23 | 24 | #Retrieves a list of users from AD and filters them by association with the specied security groups. The match can be associated with multiple groups separated with a pipe 25 | #Example: Where-Object {$_.MemberOf -match '|Domain Admins|System Admins|'} 26 | $Users = Get-ADUser -Filter * -Properties MemberOf | Where-Object {$_.MemberOf -match 'Super Admins|Domain Admins'} 27 | #Filter out all accounts that are older than the specified $Days 28 | $Users | ForEach-Object { 29 | If ((New-TimeSpan -Start ((Get-ADUser -Identity $_.SamAccountName -Properties whenCreated).whenCreated) -End (Get-Date)).Days -le $Days) { 30 | $NewUsers += $_.Name 31 | } 32 | 33 | } 34 | If (($NewUsers -ne $null) -and ($NewUsers -ne '')) { 35 | Write-Output $NewUsers 36 | } Else { 37 | Exit 1 38 | } 39 | Exit 0 40 | -------------------------------------------------------------------------------- /AdobeReaderAutomaticUpdate.ps1: -------------------------------------------------------------------------------- 1 | #******************************************************************************* 2 | # Author: Mick Pletcher 3 | # Date: 27 March 2013 4 | # 5 | # Program: Adobe Reader Automatic Update 6 | #******************************************************************************* 7 | Clear-Host 8 | $Global:OS 9 | Function GetOSArchitecture{ 10 | $Global:OS=Get-WMIObject win32_operatingsystem 11 | $Global:OS.OSArchitecture 12 | } 13 | GetOSArchitecture 14 | If($Global.OS.OSArchitecture -ne "32-bit"){ 15 | New-Item -Path "HKLM:\SOFTWARE\Wow6432Node\Adobe" -Name "Adobe ARM" –Force 16 | New-Item -Path "HKLM:\SOFTWARE\Wow6432Node\Adobe\Adobe ARM" -Name 1.0 –Force 17 | New-Item -Path "HKLM:\SOFTWARE\Wow6432Node\Adobe\Adobe ARM\1.0" -Name ARM –Force 18 | New-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Adobe\Adobe ARM\1.0\ARM" -Name iCheck -Value 3 -PropertyType DWORD 19 | New-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Adobe\Adobe ARM\1.0\ARM" -Name iCheckReader -Value 3 -PropertyType DWORD 20 | } else{ 21 | New-Item -Path "HKLM:\SOFTWARE\Adobe" -Name "Adobe ARM" –Force 22 | New-Item -Path "HKLM:\SOFTWARE\Adobe\Adobe ARM" -Name 1.0 –Force 23 | New-Item -Path "HKLM:\SOFTWARE\Adobe\Adobe ARM\1.0" -Name ARM –Force 24 | New-ItemProperty -Path "HKLM:\SOFTWARE\Adobe\Adobe ARM\1.0\ARM" -Name iCheck -Value 3 -PropertyType DWORD 25 | New-ItemProperty -Path "HKLM:\SOFTWARE\Adobe\Adobe ARM\1.0\ARM" -Name iCheckReader -Value 3 -PropertyType DWORD 26 | } -------------------------------------------------------------------------------- /AntiVirusScan.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2015 v4.2.98 5 | Created on: 11/19/2015 3:26 PM 6 | Created by: Mick Pletcher 7 | Filename: AntiVirusScan.ps1 8 | =========================================================================== 9 | .DESCRIPTION 10 | This script will initiate a full or quick scan, whichever one is uncommented 11 | out below. It will then write a log to the event viewer logs showing the 12 | scan was executed. The final step is to execute a machine policy update so 13 | the SCCM server is updated on the status of the system. 14 | #> 15 | 16 | Import-Module $env:ProgramFiles"\Microsoft Security Client\MpProvider" 17 | <#Full Scan#> 18 | Start-MProtScan -ScanType "FullScan" 19 | New-EventLog –LogName System –Source "Antimalware Full Scan" 20 | Write-EventLog -LogName System -Source "Antimalware Full Scan" -EntryType Information -EventId 1118 -Message "Antimalware full system scan was performed" -Category "" 21 | 22 | <#Quick Scan 23 | Start-MProtScan -ScanType "QuickScan" 24 | New-EventLog –LogName System –Source "Antimalware Quick Scan" 25 | Write-EventLog -LogName System -Source "Antimalware Quick Scan" -EntryType Information -EventId 1118 -Message "Antimalware quick system scan was performed" -Category "" 26 | #> 27 | 28 | $WMIPath = "\\" + $env:COMPUTERNAME + "\root\ccm:SMS_Client" 29 | $SMSwmi = [wmiclass]$WMIPath 30 | $strAction = "{00000000-0000-0000-0000-000000000021}" 31 | [Void]$SMSwmi.TriggerSchedule($strAction) 32 | Exit 0 33 | -------------------------------------------------------------------------------- /ApplicationList.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Optional Application Report 4 | 5 | .DESCRIPTION 6 | This script will query the MDT reference and production task sequences for a list of applications that are installed in the build. It will then query the system's add/remove programs list removing the build apps. This provides the build team with a list of apps to install in addition to the ones included in the build. 7 | 8 | .PARAMETER ReferenceTS 9 | Link to the reference task sequence 10 | 11 | .PARAMETER ProductionTS 12 | Link to the production task sequence 13 | 14 | .PARAMETER ARPExclusionsFile 15 | A description of the ARPExclusionsFile parameter. 16 | 17 | .PARAMETER TSExclusionsFile 18 | File containing list of exclusions for task sequence items 19 | 20 | .PARAMETER OutputDIR 21 | Directory to output the text file containing the list of applications 22 | 23 | .PARAMETER ExclusionsFile 24 | A description of the ExclusionsFile parameter. 25 | 26 | .PARAMETER Exclusions 27 | Text file containing a list of applications to exclude 28 | 29 | .NOTES 30 | =========================================================================== 31 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.145 32 | Created on: 9/18/2018 10:38 AM 33 | Created by: Mick Pletcher 34 | Filename: OptionalApplicationReport.ps1 35 | =========================================================================== 36 | #> 37 | [CmdletBinding()] 38 | param 39 | ( 40 | [ValidateNotNullOrEmpty()][string]$ReferenceTS = '\\DeploymentShare\Control\WIN10REF\ts.xml', 41 | [ValidateNotNullOrEmpty()][string]$ProductionTS = '\\DeploymentShareTST\Control\WINDOWS10PROD\ts.xml', 42 | [string]$ARPExclusionsFile = "\\InstalledApplications\ARPExclusions.txt", 43 | [string]$TSExclusionsFile = "\\InstalledApplications\TSExclusions.txt", 44 | [string]$OutputDIR = '\\NAS\ApplicationLists\' 45 | ) 46 | 47 | $Applications = @() 48 | $TSExclusions = Get-Content -Path $TSExclusionsFile 49 | $ARPExclusions = Get-Content -Path $ARPExclusionsFile 50 | $Installed = (Get-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*, REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*).DisplayName | Where-Object { ($_ -notlike '*Update for*') -and ($_ -notlike '*MUI*') -and ($_ -notlike '*Intel(R)*') } | ForEach-Object { If ($_ -notin $ARPExclusions) { $_ } } | Sort-Object -Unique 51 | $TS = Get-Content -Path $ReferenceTS, $ProductionTS | Where-Object { $_ -like '*BDD_InstallApplication*' } | ForEach-Object { $_.split('=')[2].Replace('description', '').Replace('"', '').Trim() } | ForEach-Object { If ($_ -notin $TSExclusions) { $_ } } | Sort-Object 52 | foreach ($App in $Installed) { 53 | If ($App -notin $TS) { 54 | $Applications += $App 55 | } 56 | } 57 | $Applications | Sort-Object -Unique | Out-file -FilePath ($OutputDIR + $env:COMPUTERNAME + '.txt') 58 | -------------------------------------------------------------------------------- /ApplicationUninstallScript.ps1: -------------------------------------------------------------------------------- 1 | Function UninstallOldApplication($Description) { 2 | #Declare Local Memory 3 | Set-Variable -Name AppName -Scope Local -Force 4 | Set-Variable -Name Arguments -Scope Local -Force 5 | Set-Variable -Name Code -Scope Local -Force 6 | Set-Variable -Name GUID -Scope Local -Force 7 | Set-Variable -Name Output -Scope Local -Force 8 | #Change '%application%' to whatever app you are calling 9 | $Description = [char]34+"description like"+[char]32+[char]39+[char]37+$Description+[char]37+[char]39+[char]34 10 | $Output = wmic product where $Description get IdentifyingNumber 11 | $Output1 = wmic product where $Description get Description 12 | $Output1 | ForEach-Object { 13 | $_ = $_.Trim() 14 | if(($_ -ne "Description")-and($_ -ne "")){ 15 | $AppName = $_ 16 | } 17 | } 18 | Write-Host "Uninstalling"$AppName"....." -NoNewline 19 | $Output | ForEach-Object { 20 | $_ = $_.Trim() 21 | if(($_ -ne "IdentifyingNumber")-and($_ -ne "")){ 22 | $GUID = $_ 23 | } 24 | } 25 | $Arguments = "/X"+[char]32+$GUID+[char]32+"/qb- /norestart" 26 | $Code = (Start-Process -FilePath "msiexec.exe" -ArgumentList $Arguments -Wait -Passthru).ExitCode 27 | If ($Code -eq 0) { 28 | Write-Host "Uninstalled" -ForegroundColor Yellow 29 | } else { 30 | Write-Host "Failed" -ForegroundColor Red 31 | } 32 | #Cleanup Local Memory 33 | Remove-Variable -Name AppName -Scope Local -Force 34 | Remove-Variable -Name Arguments -Scope Local -Force 35 | Remove-Variable -Name Code -Scope Local -Force 36 | Remove-Variable -Name GUID -Scope Local -Force 37 | Remove-Variable -Name Output -Scope Local -Force 38 | Remove-Variable -Name Output1 -Scope Local -Force 39 | } -------------------------------------------------------------------------------- /ApplicationVirusDetectionMethod.ps1: -------------------------------------------------------------------------------- 1 | $LastInfection = get-winevent -filterhashtable @{ logname = 'system'; ID = 1116 } -maxevents 1 -ErrorAction SilentlyContinue 2 | $LastFullScan = get-winevent -filterhashtable @{ logname = 'system'; ID = 1118 } -maxevents 1 -ErrorAction SilentlyContinue 3 | If (($LastFullScan.TimeCreated -lt $LastInfection.TimeCreated) -or ($LastInfection -eq $null)) { 4 | Start-Sleep -Seconds 5 5 | exit 0 6 | } else { 7 | Write-Host "No Infection" 8 | Start-Sleep -Seconds 5 9 | exit 0 10 | } 11 | -------------------------------------------------------------------------------- /ApplicationVirusDetectionMethodEmail.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.127 5 | Created on: 8/5/2016 11:11 AM 6 | Created by: Mick Pletcher 7 | Filename: ApplicationVirusDetectionMethod.ps1 8 | =========================================================================== 9 | .DESCRIPTION 10 | #> 11 | 12 | 13 | $LastInfection = get-winevent -filterhashtable @{ logname = 'system'; ID = 1116 } -maxevents 1 -ErrorAction SilentlyContinue 14 | $LastScan = Get-WinEvent -FilterHashtable @{ logname = 'system'; ProviderName = 'Microsoft Antimalware'; ID = 1001 } -MaxEvents 1 15 | If ($LastScan.TimeCreated -lt $LastInfection.TimeCreated) { 16 | #No scan since last infection 17 | Start-Sleep -Seconds 5 18 | exit 0 19 | } else { 20 | #No infection since last scan 21 | Write-Host "No Infection" 22 | Start-Sleep -Seconds 5 23 | exit 0 24 | } 25 | -------------------------------------------------------------------------------- /AutoRedact_Plug-In_1.9.6.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 |
130 | 131 |
132 | 133 |
134 | 135 |
136 | 137 |
138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 |
156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 |
170 | -------------------------------------------------------------------------------- /BitlockerSystem.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2015 v4.2.99 5 | Created on: 2/25/2016 4:29 PM 6 | Created by: Mick Pletcher 7 | Filename: BitlockerSystem.ps1 8 | =========================================================================== 9 | .DESCRIPTION 10 | This script waits for the bitlocker process to begin. If the bitlocker 11 | process does not begin within 5 minutes, the script exits with an error 12 | code 1. If the process does begin, then the script waits until 13 | bitlocker is complete with encrypting the system. 14 | #> 15 | 16 | 17 | #Declare Variables 18 | Set-Variable -Name CurrentTime -Scope Local -Force 19 | Set-Variable -Name Difference -Scope Local -Force 20 | Set-Variable -Name Output1 -Scope Local -Force 21 | Set-Variable -Name Output2 -Scope Local -Force 22 | Set-Variable -Name Output3 -Scope Local -Force 23 | Set-Variable -Name Process -Value $null -Scope Local -Force 24 | Set-Variable -Name StartTime -Scope Local -Force 25 | 26 | Clear-Host 27 | $StartTime = Get-Date 28 | $Output1 = "Waiting for Bitlocker Encryption to begin....." 29 | $Output1 30 | While ($Process -eq $null) { 31 | Start-Sleep -Seconds 5 32 | $Process = Get-Process -Name fvenotify -ErrorAction SilentlyContinue 33 | $CurrentTime = Get-Date 34 | $Difference = (New-TimeSpan -Start $StartTime -End $CurrentTime).minutes 35 | If ($Difference -eq 5) { 36 | Exit 1 37 | } 38 | } 39 | $Output1 = $Output1 + "Completed" 40 | Clear-Host 41 | $Output1 42 | $Output2 = "Bitlockering System....." 43 | $Output2 44 | while ($Process -ne $null) { 45 | $Process = $null 46 | $Process = Get-Process -Name fvenotify -ErrorAction SilentlyContinue 47 | $Output3 = manage-bde -status $env:HOMEDRIVE 48 | Clear-Host 49 | $Output1 50 | $Output2 51 | Write-Host 52 | $Output3[9].TRIM() 53 | Start-Sleep -Seconds 60 54 | } 55 | Write-Host "Complete" -ForegroundColor Yellow 56 | 57 | #Cleanup Variables 58 | Remove-Variable -Name CurrentTime -Scope Local -Force 59 | Remove-Variable -Name Difference -Scope Local -Force 60 | Remove-Variable -Name Output1 -Scope Local -Force 61 | Remove-Variable -Name Output2 -Scope Local -Force 62 | Remove-Variable -Name Output3 -Scope Local -Force 63 | Remove-Variable -Name Process -Scope Local -Force 64 | Remove-Variable -Name StartTime -Scope Local -Force 65 | -------------------------------------------------------------------------------- /BootEnvironment.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Check Boot Environment 4 | 5 | .DESCRIPTION 6 | This script reads the setupact.log file to determine if the system is configured for BIOS or UEFI. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 11 | Created on: 9/25/2020 11:59 AM 12 | Created by: Mick Pletcher 13 | Filename: BootEnvironment.ps1 14 | =========================================================================== 15 | #> 16 | 17 | Try { 18 | $Output = (Get-Content -Path (((Get-ChildItem -Path ($env:windir + '\Panther') -Recurse -Filter setupact.log -ErrorAction SilentlyContinue)[0]).FullName) -ErrorAction SilentlyContinue | Where-Object {$_ -like "*Detected boot environment*"}).Replace("Detected boot environment:", "~").Split("~")[1].Trim() 19 | If ($Output -eq 'BIOS') { 20 | Write-Output 'BIOS' 21 | Exit 0 22 | } elseif ($Output -eq 'UEFI') { 23 | Write-Output 'UEFI' 24 | Exit 1 25 | } 26 | } Catch { 27 | Write-Output 'Unknown' 28 | Exit 2 29 | } 30 | -------------------------------------------------------------------------------- /CacheInfo.mif: -------------------------------------------------------------------------------- 1 | Start Component 2 | Name = "SMS Client Info" 3 | Start group 4 | Name = "SMS Cache" 5 | ID = 1 6 | Class = "SMSCache" 7 | Start Attribute 8 | Name = "In Use" 9 | ID = 1 10 | Type = String(10) 11 | Value = "INUSE" 12 | End Attribute 13 | Start Attribute 14 | Name = "Size" 15 | ID = 2 16 | Type = String(10) 17 | Value = "CACHESIZE" 18 | End Attribute 19 | End group 20 | End Component -------------------------------------------------------------------------------- /ChangeSMSCacheSize.au3: -------------------------------------------------------------------------------- 1 | ;Change SMS 2003 Cache Size 2 | ; Author: Mick Pletcher 3 | ; Date: 06 March 2012 4 | ; 5 | ; Open SMS 2003 CPL 6 | Run( "control C:\Windows\SysWOW64\CCM\smscfgrc.cpl" ) 7 | ; 8 | ; Activate Tabs 9 | WinWait( "Systems Management Properties" ) 10 | WinActivate( "Systems Management Properties" ) 11 | Send( "{TAB}" ) 12 | Sleep( 250 ) 13 | Send( "{TAB}" ) 14 | Sleep( 250 ) 15 | Send( "{TAB}" ) 16 | Sleep( 250 ) 17 | ; 18 | ; Go to advanced Window 19 | WinWait( "Systems Management Properties" ) 20 | WinActivate( "Systems Management Properties" ) 21 | Send( "{RIGHT}" ) 22 | Sleep( 250 ) 23 | Send( "{RIGHT}" ) 24 | Sleep( 250 ) 25 | Send( "{RIGHT}" ) 26 | Sleep( 250 ) 27 | ; 28 | ; Change Cache Size 29 | WinWait( "Systems Management Properties" ) 30 | WinActivate( "Systems Management Properties" ) 31 | Send( "{TAB}" ) 32 | Sleep( 250 ) 33 | Send( "{TAB}" ) 34 | Sleep( 250 ) 35 | Send( "{TAB}" ) 36 | Sleep( 250 ) 37 | Send( "{TAB}" ) 38 | Sleep( 250 ) 39 | Send( "5000" ) 40 | Sleep( 250 ) 41 | Send( "{Enter}" ) 42 | Sleep( 250 ) 43 | Send( "{Enter}" ) 44 | Sleep( 250 ) -------------------------------------------------------------------------------- /ClearDellBIOSPassword.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Clear Dell BIOS Password 4 | 5 | .DESCRIPTION 6 | Clear the BIOS Password 7 | 8 | .PARAMETER Password 9 | BIOS Password 10 | 11 | .NOTES 12 | =========================================================================== 13 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.207 14 | Created on: 6/29/2022 8:24 AM 15 | Created by: Mick Pletcher 16 | Filename: ClearBIOSPassword.ps1 17 | =========================================================================== 18 | #> 19 | param 20 | ( 21 | [ValidateNotNullOrEmpty()] 22 | [string]$Password 23 | ) 24 | #Install Dell BIOS Provider PowerShell Module 25 | Try { 26 | Import-Module -Name DellBIOSProvider 27 | } Catch { 28 | Find-Module -Name DellBIOSProvider | Install-Module -Force 29 | Import-Module -Name DellBIOSProvider 30 | } 31 | #Clear BIOS Password if set 32 | Write-Host "Clearing BIOS Password....." -NoNewline 33 | If ((Get-Item -Path DellSmbios:\Security\IsAdminPasswordSet).CurrentValue -eq $true) { 34 | Set-Item DellSmbios:\Security\AdminPassword "" -Password $Password 35 | } 36 | If ((Get-Item -Path DellSmbios:\Security\IsAdminPasswordSet).CurrentValue -eq $false) { 37 | Write-Host "Success" -ForegroundColor Yellow 38 | } else { 39 | Write-Host "Failed" -ForegroundColor Red 40 | } -------------------------------------------------------------------------------- /ClearPrintSpooler.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Delete Print Jobs for Specific Printer 4 | 5 | .DESCRIPTION 6 | This script will delete print jobs for a specific printer. It gets a list of print jobs in the %SYSTEM32\Spool\PRINTERS directory. It reads the contents of the .SHD files, which have the names of the printer inside them. It then filters out those jobs that are not queued for the specified printer and deletes them. It stops the spooler before the deletion and then restarts it. 7 | 8 | .PARAMETER PrinterName 9 | Full or partial name of the printer to filter for 10 | 11 | .EXAMPLE 12 | Delete all printer jobs for printer named Workshare 13 | powershell.exe -file ClearPrintSpooler.ps1 -PrinterName "Workshare" 14 | 15 | .NOTES 16 | =========================================================================== 17 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.135 18 | Created on: 2/22/2017 10:46 AM 19 | Created by: Mick Pletcher 20 | Filename: ClearPrintSpooler.ps1 21 | =========================================================================== 22 | #> 23 | [CmdletBinding()] 24 | param 25 | ( 26 | [ValidateNotNullOrEmpty()][string]$PrinterName 27 | ) 28 | 29 | Clear-Host 30 | #Get list of print jobs 31 | $Files = Get-ChildItem -Path $env:windir"\system32\spool\printers" -Filter *.SHD 32 | #Initialize variable to contain list of files to delete 33 | $DeleteFiles = @() 34 | foreach ($File in $Files) { 35 | #Read contents of binary file 36 | $Contents = [System.IO.File]::ReadAllBytes($File.FullName) 37 | #Filter out all contents that are not A-Z and a-z in the ASCII number fields 38 | $Contents = $Contents | Where-Object { (($_ -ge 65) -and ($_ -le 90)) -or (($_ -ge 97) -and ($_ -le 122)) } 39 | #Convert string to ASCII 40 | foreach ($Value in $Contents) { 41 | $Output += [char]$Value 42 | } 43 | #Add base file name to the $DeleteFiles list if the $PrinterName is in the converted string 44 | If ($Output -like "*$PrinterName*") { 45 | $DeleteFiles += $File.BaseName 46 | } 47 | } 48 | #Delete all files that met the searched criteria 49 | foreach ($File in $DeleteFiles) { 50 | #Stop Print Spooler Service 51 | Stop-Service -Name Spooler -Force | Out-Null 52 | #Create Filter to search for files 53 | $FileFilter = $File + ".*" 54 | #Get list of files 55 | $Filenames = Get-ChildItem -Path $env:windir"\system32\spool\printers" -Filter $FileFilter 56 | #Delete each file 57 | foreach ($Filename in $Filenames) { 58 | Remove-Item -Path $Filename.FullName -Force | Out-Null 59 | } 60 | #Start Print Spooler Service 61 | Start-Service -Name Spooler | Out-Null 62 | } 63 | -------------------------------------------------------------------------------- /ClearTPM.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Initialize TPM 4 | 5 | .DESCRIPTION 6 | This script will turn on the PPI Bypass for TPM clear and Initialize the TPM. 7 | 8 | .PARAMETER Password 9 | BIOS Password 10 | 11 | .NOTES 12 | =========================================================================== 13 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.207 14 | Created on: 6/28/2022 10:02 AM 15 | Created by: Mick Pletcher 16 | Filename: DellBIOS04.ps1 17 | =========================================================================== 18 | #> 19 | param 20 | ( 21 | [ValidateNotNullOrEmpty()] 22 | [string]$Password 23 | ) 24 | 25 | #Install Dell BIOS Provider PowerShell Module 26 | Try { 27 | Import-Module -Name DellBIOSProvider 28 | } Catch { 29 | Find-Module -Name DellBIOSProvider | Install-Module -Force 30 | Import-Module -Name DellBIOSProvider 31 | } 32 | #PPI Bypass for TPM Clear 33 | Set-Item -Path DellSMBIOS:\TPMSecurity\TpmPpiClearOverride Enabled -Password $Password 34 | #Clear TPM 35 | Clear-Tpm 36 | -------------------------------------------------------------------------------- /ConfigMgrRebootReport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | ConfigMgr Reboot Report 4 | 5 | .DESCRIPTION 6 | This script will query ConfigMgr for a list of machines that are waiting for a reboot. 7 | 8 | .PARAMETER Collection 9 | Name of the collection to query 10 | 11 | .PARAMETER SQLServer 12 | Name of the SQL server 13 | 14 | .PARAMETER SQLDatabase 15 | A description of the SQLDatabase parameter. 16 | 17 | .PARAMETER SQLInstance 18 | Name of the SQL Database 19 | 20 | .PARAMETER SCCMFQDN 21 | Fully Qualified Domain Name of the ConfigMgr server 22 | 23 | .NOTES 24 | =========================================================================== 25 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 26 | Created on: 05/01/2020 09:39 AM 27 | Created by: Mick Pletcher 28 | Filename: ConfigMgrRebootReport.ps1 29 | =========================================================================== 30 | #> 31 | [CmdletBinding()] 32 | param 33 | ( 34 | [ValidateNotNullOrEmpty()] 35 | [string]$Collection = '', 36 | [ValidateNotNullOrEmpty()] 37 | [string]$SQLServer = '', 38 | [ValidateNotNullOrEmpty()] 39 | [string]$SQLDatabase = '' 40 | ) 41 | 42 | $RebootListQuery = 'SELECT * FROM dbo.vSMS_CombinedDeviceResources WHERE ClientState <> 0' 43 | $RebootList = (Invoke-Sqlcmd -ServerInstance $SQLServer -Database $SQLDatabase -Query $RebootListQuery).Name | Sort-Object 44 | $CollectionQuery = 'SELECT * FROM' + [char]32 + 'dbo.' + ((Invoke-Sqlcmd -ServerInstance $SQLServer -Database $SQLDatabase -Query ('SELECT ResultTableName FROM dbo.v_Collections WHERE CollectionName = ' + [char]39 + $Collection + [char]39)).ResultTableName) 45 | $CollectionList = (Invoke-Sqlcmd -ServerInstance $SQLServer -Database $SQLDatabase -Query $CollectionQuery).Name | Sort-Object 46 | $List = @() 47 | $RebootList | ForEach-Object { If ($_ -in $CollectionList) { $List += $_ } } 48 | If ($List -ne '') { 49 | Write-Output $List 50 | } else { 51 | Exit 1 52 | } 53 | -------------------------------------------------------------------------------- /ConfigMgrSQLFirewallSettings.ps1: -------------------------------------------------------------------------------- 1 | If ((Get-NetFirewallRule -Name "ConfigMgr Port 135 UDP" -ErrorAction SilentlyContinue) -eq $null) { 2 | New-NetFirewallRule -Name "ConfigMgr Port 135 UDP" -DisplayName "ConfigMgr Port 135 UDP" -Description "Site Server" -Group "Configuration Manager" -Profile "Domain" -Protocol UDP -LocalPort 135 -Enabled True 3 | } 4 | If ((Get-NetFirewallRule -Name "ConfigMgr Port 135 TCP" -ErrorAction SilentlyContinue) -eq $null) { 5 | New-NetFirewallRule -Name "ConfigMgr Port 135 TCP" -DisplayName "ConfigMgr Port 135 TCP" -Description "Site Server" -Group "Configuration Manager" -Profile "Domain" -Protocol TCP -LocalPort 135 -Enabled True 6 | } 7 | If ((Get-NetFirewallRule -Name "ConfigMgr Port 1433 TCP" -ErrorAction SilentlyContinue) -eq $null) { 8 | New-NetFirewallRule -Name "ConfigMgr Port 1433 TCP" -DisplayName "ConfigMgr Port 1433 TCP" -Description "Asset Intelligence Synchronization Point, App Catalog Web Service Point, Endpoint Protection, Enrollment Point, MP, Reporting point, Site Server, SMS Provider, SQL Server, SMP" -Group "Configuration Manager" -Profile "Domain" -Protocol TCP -LocalPort 1433 -Enabled True 9 | } 10 | If ((Get-NetFirewallRule -Name "ConfigMgr Port 4022 TCP" -ErrorAction SilentlyContinue) -eq $null) { 11 | New-NetFirewallRule -Name "ConfigMgr Port 4022 TCP" -DisplayName "ConfigMgr Port 4022 TCP" -Description "SQL Server" -Group "Configuration Manager" -Profile "Domain" -Protocol TCP -LocalPort 4022 -Enabled True 12 | } 13 | If ((Get-NetFirewallRule -Name "ConfigMgr Port 445 TCP" -ErrorAction SilentlyContinue) -eq $null) { 14 | New-NetFirewallRule -Name "ConfigMgr Port 445 TCP" -DisplayName "ConfigMgr Port 445 TCP" -Description "Site Server" -Group "Configuration Manager" -Profile "Domain" -Protocol TCP -LocalPort 445 -Enabled True 15 | } 16 | -------------------------------------------------------------------------------- /DPCleanup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | ConfigMgr Distribution Point Cleanup 4 | 5 | .DESCRIPTION 6 | This script will cleanup the remnants of a distribution point after it has been deleted in Configuration Manager. This is sometimes necessary when needing to repush a distribution point to the same server. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 11 | Created on: 6/12/2020 2:01 PM 12 | Created by: Mick Pletcher 13 | Filename: DPCleanup.ps1 14 | =========================================================================== 15 | #> 16 | 17 | [CmdletBinding()] 18 | param () 19 | 20 | #Uninstall ConfigMgr Client 21 | If ((Test-Path ($env:windir + '\ccmsetup\ccmsetup.exe')) -eq $true) { 22 | Start-Process ($env:windir + '\ccmsetup\ccmsetup.exe') -ArgumentList "/uninstall" -Wait 23 | } 24 | #Retrieve the path to the distribution point directories 25 | If ((Test-Path 'REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\DP') -eq $true) { 26 | $ContentLibraryPath = ((Get-ItemProperty -Path 'REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\DP').ContentLibraryPath).split('\')[0] + '\' 27 | } else { 28 | Write-Host 'Cannot find path to distribution point content' 29 | Exit 1 30 | } 31 | #Delete the distribution point directories 32 | (Get-ChildItem -Path $ContentLibraryPath | Where-Object {($_.Name -like 'SMS*') -or ($_.Name -like 'SCCM*')}) | ForEach-Object {Remove-item -Path $_.FullName -Recurse -Force} 33 | #Delete registry keys associated with ConfigMgr 34 | If ((Test-Path "REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS") -eq $true) { 35 | Remove-Item -Path "REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS" -Recurse -Force -ErrorAction SilentlyContinue 36 | } 37 | -------------------------------------------------------------------------------- /DefaultPrinterReport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Default Printer Report 4 | 5 | .DESCRIPTION 6 | This script will retrieve a list of all user profiles and report to a text file inside each user profile what the default printer is. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 11 | Created on: 2/4/2019 8:56 AM 12 | Created by: Mick Pletcher 13 | Filename: DefaultPrinterReport.ps1 14 | =========================================================================== 15 | #> 16 | 17 | [CmdletBinding()] 18 | param () 19 | 20 | $Profiles = (Get-ChildItem -Path REGISTRY::HKEY_USERS -Exclude *Classes | Where-Object {$_.Name -like '*S-1-5-21*'}).Name 21 | $ProfileArray = @() 22 | foreach ($Item in $Profiles) { 23 | $object = New-Object -TypeName System.Management.Automation.PSObject 24 | $object | Add-Member -MemberType NoteProperty -Name Profile -Value ((Get-ItemProperty -Path ('REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\' + ($Item.split('\')[1].Trim())) -Name ProfileImagePath).ProfileImagePath).Split('\')[2] 25 | $object | Add-Member -MemberType NoteProperty -Name DefaultPrinter -Value ((Get-ItemProperty -Path ('REGISTRY::' + $Item + '\Software\Microsoft\Windows NT\CurrentVersion\Windows') -Name Device).Device).Split(',')[0] 26 | $ProfileArray += $object 27 | } 28 | $ProfileArray 29 | foreach ($Item in $ProfileArray) { 30 | Export-Csv -InputObject $Item -Path ($env:SystemDrive + '\users\' + $Item.Profile + '\DefaultPrinter.csv') -NoTypeInformation -Force 31 | } 32 | -------------------------------------------------------------------------------- /DellBIOSVerifier.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | BIOS Update Verifier 4 | 5 | .DESCRIPTION 6 | This script will be executed as the final task within the task sequence. It will query the BIOS to verify the patch was successful. If successful, it will return an error code 0 back to SCCM. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.143 11 | Created on: 1/18/2018 2:05 PM 12 | Created by: Mick Pletcher 13 | Filename: BIOSVerifier.ps1 14 | =========================================================================== 15 | #> 16 | [CmdletBinding()] 17 | param () 18 | function Get-RelativePath { 19 | <# 20 | .SYNOPSIS 21 | Get the relative path 22 | 23 | .DESCRIPTION 24 | Returns the location of the currently running PowerShell script 25 | 26 | .NOTES 27 | Additional information about the function. 28 | #> 29 | 30 | [CmdletBinding()][OutputType([string])] 31 | param () 32 | 33 | $Path = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent) + "\" 34 | Return $Path 35 | } 36 | 37 | $RelativePath = Get-RelativePath 38 | $InstalledVersion = [string]((Get-WmiObject Win32_BIOS).SMBIOSBIOSVersion) 39 | $Model = ((Get-WmiObject Win32_ComputerSystem).Model).split(" ")[1] 40 | [string]$BIOSVersion = (Get-ChildItem -Path $RelativePath | Where-Object { $_.Name -eq $Model } | Get-ChildItem -Filter *.exe) 41 | $BIOSVersion = ($BIOSVersion.split("-")[1]).split(".")[0] 42 | If ($BIOSVersion -eq $InstalledVersion) { 43 | Exit 0 44 | } else { 45 | Exit 5 46 | } 47 | -------------------------------------------------------------------------------- /DellDriverUpdate.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Update Dell Drivers 4 | 5 | .DESCRIPTION 6 | Update Dell drivers using the Dell Command Update. 7 | 8 | .PARAMETER Logging 9 | Specifies if logging is to take place 10 | 11 | .PARAMETER LogLocation 12 | Location where to write the driver logs 13 | 14 | .NOTES 15 | =========================================================================== 16 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.135 17 | Created on: 2/3/2017 2:21 PM 18 | Created by: Mick Pletcher 19 | Filename: DriverUpdate.ps1 20 | =========================================================================== 21 | #> 22 | [CmdletBinding()] 23 | param 24 | ( 25 | [switch]$Logging, 26 | [string]$LogLocation 27 | ) 28 | function Get-Architecture { 29 | <# 30 | .SYNOPSIS 31 | Get-Architecture 32 | 33 | .DESCRIPTION 34 | Returns whether the system architecture is 32-bit or 64-bit 35 | 36 | .EXAMPLE 37 | Get-Architecture 38 | 39 | .NOTES 40 | Additional information about the function. 41 | #> 42 | 43 | [CmdletBinding()][OutputType([string])] 44 | param () 45 | 46 | $OSArchitecture = (Get-WmiObject -Class Win32_OperatingSystem | Select-Object OSArchitecture).OSArchitecture 47 | Return $OSArchitecture 48 | #Returns 32-bit or 64-bit 49 | } 50 | 51 | function Get-DellCommandUpdateLocation { 52 | <# 53 | .SYNOPSIS 54 | Find dcu-cli.exe 55 | 56 | .DESCRIPTION 57 | Locate dcu-cli.exe as it may reside in %PROGRAMFILES% or %PROGRAMFILES(X86)% 58 | 59 | #> 60 | 61 | [CmdletBinding()][OutputType([string])] 62 | param () 63 | 64 | $Architecture = Get-Architecture 65 | If ($Architecture -eq "32-bit") { 66 | $File = Get-ChildItem -Path $env:ProgramFiles -Filter "dcu-cli.exe" -ErrorAction SilentlyContinue -Recurse 67 | } else { 68 | $File = Get-ChildItem -Path ${env:ProgramFiles(x86)} -Filter "dcu-cli.exe" -ErrorAction SilentlyContinue -Recurse 69 | } 70 | Return $File.FullName 71 | } 72 | 73 | function Invoke-DriverUpdate { 74 | <# 75 | .SYNOPSIS 76 | Execute Dell Command Update 77 | 78 | .DESCRIPTION 79 | This will initiate the Dell Command Update using the dcu-cli.exe 80 | 81 | .PARAMETER Executable 82 | dcu-cli.exe 83 | 84 | .NOTES 85 | Additional information about the function. 86 | #> 87 | 88 | [CmdletBinding()] 89 | param 90 | ( 91 | [ValidateNotNullOrEmpty()]$Executable 92 | ) 93 | 94 | If ($Logging.IsPresent) { 95 | $Model = (Get-WmiObject -Class Win32_ComputerSystem).Model 96 | If ($LogLocation[$LogLocation.Length - 1] -ne "\") { 97 | $Location = $LogLocation + "\" + $Model 98 | } else { 99 | $Location = $LogLocation + $Model 100 | } 101 | If ((Test-Path $LogLocation) -eq $false) { 102 | New-Item -Path $LogLocation -ItemType Directory -Force | Out-Null 103 | } 104 | If ((Test-Path $Location) -eq $false) { 105 | New-Item -Path $Location -ItemType Directory -Force | Out-Null 106 | } 107 | $Location += "\" + $env:COMPUTERNAME 108 | If ((Test-Path $Location) -eq $true) { 109 | Remove-Item -Path $Location -Recurse -Force 110 | } 111 | $Arguments = "/log" + [char]32 + [char]34 + $Location + [char]34 112 | } else { 113 | $Arguments = [char]32 114 | } 115 | Start-Process -FilePath $Executable -ArgumentList $Arguments -Wait -Passthru | Out-Null 116 | } 117 | 118 | 119 | Clear-Host 120 | #Find dcu-cli.exe 121 | $EXE = Get-DellCommandUpdateLocation 122 | #Install Dell drivers 123 | Invoke-DriverUpdate -Executable $EXE 124 | -------------------------------------------------------------------------------- /DisableOfflineFiles.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\NetCache] 3 | "DisableFRAdminPin"=dword:00000001 4 | -------------------------------------------------------------------------------- /DisableWindowsMediaCenter.ps1: -------------------------------------------------------------------------------- 1 | #******************************************************************************* 2 | # Author: Mick Pletcher 3 | # Date: 16 August 2013 4 | # 5 | # Program: Windows Media Center 6 | #******************************************************************************* 7 | cls 8 | 9 | #Declare Global Memory 10 | Set-Variable -Name a -Scope Global -Force 11 | Set-Variable -Name Output -Scope Global -Force 12 | 13 | Function AddRemovePrograms($KeyName, $DisplayName, $Version){ 14 | 15 | #Define Local Memory 16 | New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT 17 | Set-Variable -Name AddRemKey -Scope Local -Force 18 | Set-Variable -Name guid -Scope Local -Force 19 | Set-Variable -Name ProductsKey -Scope Local -Force 20 | 21 | If (!(Test-Path c:\windows\GSPBox_Icon.bmp)){ 22 | Copy-Item -Path \\global.gsp\data\clients\na_clients\Build\Add-ins\GSPBox_Icon.bmp -Destination c:\Windows -Force 23 | } 24 | $AddRemKey = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" 25 | $ProductsKey = "HKCR:\Installer\Products\" 26 | New-Item -Path $AddRemKey -Name $KeyName –Force 27 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name DisplayName -Value $DisplayName -PropertyType String 28 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name DisplayVersion -Value $Version -PropertyType String 29 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name UninstallString -Value " " -PropertyType String 30 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name Publisher -Value "Gresham, Smith and Partners" -PropertyType String 31 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name DisplayIcon -Value "c:\windows\GSPBox_Icon.bmp" -PropertyType String 32 | $guid = [guid]::NewGuid().ToString("N") 33 | $guid.ToString() 34 | $guid = $guid.ToUpper() 35 | New-Item -Path $ProductsKey -Name $guid –Force 36 | New-ItemProperty -Path $ProductsKey"\"$guid -Name ProductName -Value $DisplayName -PropertyType String -Force 37 | 38 | #Cleanup Local Memory 39 | remove-psdrive -name HKCR 40 | Remove-Variable -Name AddRemKey -Scope Local -Force 41 | Remove-Variable -Name guid -Scope Local -Force 42 | Remove-Variable -Name ProductsKey -Scope Local -Force 43 | 44 | } 45 | 46 | Invoke-Command {dism.exe /online /disable-feature /featurename:MediaCenter /norestart} 47 | $a = Invoke-Command {dism.exe /online /get-featureinfo /featurename:MediaCenter} 48 | $Output = $a | Select-String "State : Disabled" 49 | Write-Host $Output 50 | If ($Output -like "State : Disabled"){ 51 | AddRemovePrograms "MediaCenter" "MediaCenter" "Disabled" 52 | } 53 | 54 | #Cleanup Global Memory 55 | Remove-Variable -Name a -Scope Global -Force 56 | Remove-Variable -Name Output -Scope Global -Force -------------------------------------------------------------------------------- /EmailEnvVariable.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Email Address Environment Variable 4 | 5 | .DESCRIPTION 6 | This script will assign the user's email address to the environment variable EmailAddress. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.128 11 | Created on: 10/12/2016 1:14 PM 12 | Created by: Mick Pletcher 13 | Filename: EmailEnvVariable.ps1 14 | =========================================================================== 15 | 16 | .PARAMETER 17 | A description of the parameter. 18 | #> 19 | [CmdletBinding()] 20 | param () 21 | 22 | Import-Module ActiveDirectory 23 | #Delete Environment Variable 24 | [System.Environment]::SetEnvironmentVariable("EmailAddress", $null, 'User') 25 | #Get the email address associated with the username 26 | $EmailAddress = (Get-ADUser $env:USERNAME -Properties mail).mail 27 | #Create a user based environment variable called email address 28 | [System.Environment]::SetEnvironmentVariable("EmailAddress", $EmailAddress, 'User') 29 | -------------------------------------------------------------------------------- /EnableDisableOfflineFiles.vbs: -------------------------------------------------------------------------------- 1 | '******************************************************************************* 2 | ' Program: EnableDisableOfflineFiles.vbs 3 | ' Author: Mick Pletcher 4 | ' Date: 25 June 2012 5 | ' Modified: 6 | ' 7 | ' Description: This will enable or disable the Offline File Cache 8 | ' 1) Set Offline File Cache 9 | '******************************************************************************* 10 | Option Explicit 11 | 12 | REM Set Offline File Cache 13 | SetOfflineFileCache() 14 | 15 | '******************************************************************************* 16 | '******************************************************************************* 17 | Sub SetOfflineFileCache() 18 | 19 | REM Define Local Constants 20 | CONST Disable = "False" 21 | CONST Enable = "True" 22 | 23 | REM Define Local Objects 24 | DIM oShell : SET oShell = CreateObject("Wscript.Shell") 25 | 26 | REM Define Local Variables 27 | ' Change the variable at the end of the Install Variable to either Enable or Disable 28 | DIM Install : Install = "wmic path win32_offlinefilescache call enable" & Chr(32) & Disable 29 | 30 | oShell.Run Install, 1, True 31 | 32 | REM Cleanup Local Variables 33 | Set Install = Nothing 34 | Set oShell = Nothing 35 | 36 | End Sub 37 | -------------------------------------------------------------------------------- /FindRegistryUninstall.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Uninstall Finder 4 | 5 | .DESCRIPTION 6 | This script will retrieve the x86 and x64 uninstall registry key(s) for a specific applicaton. This is very helpful for Configuration Manager admins when needing to create packages, especially uninstall packages. 7 | 8 | .PARAMETER ApplicationName 9 | Name of the application as it appears in Add/Remove Programs 10 | 11 | .PARAMETER Like 12 | Select this if using a partial name or wanting multiple listings to appear 13 | 14 | .NOTES 15 | =========================================================================== 16 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.209 17 | Created on: 8/3/2022 11:44 AM 18 | Created by: Mick Pletcher 19 | Filename: FindRegistryUninstall.ps1 20 | =========================================================================== 21 | #> 22 | [CmdletBinding()] 23 | param 24 | ( 25 | [ValidateNotNullOrEmpty()] 26 | [string]$ApplicationName, 27 | [switch]$Like 28 | ) 29 | 30 | If ($Like.IsPresent) { 31 | Get-ChildItem -Path REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -like ('*' + $ApplicationName + '*') } 32 | } else { 33 | Get-ChildItem -Path REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -eq $ApplicationName } 34 | } 35 | -------------------------------------------------------------------------------- /GetDefaultPrinter.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Get Default Printer 4 | .DESCRIPTION 5 | Gets the default printer and writes the printer to a text file in the %APPDATA% folder. If 6 | this is executed through SCCM, it must be run as the user. 7 | .Author 8 | Mick Pletcher 9 | .Date 10 | 06 April 2015 11 | .EXAMPLE 12 | powershell.exe -executionpolicy bypass -file GetDefaultPrinter.ps1 13 | #> 14 | 15 | #Declare Global Variables 16 | Set-Variable -Name DefaultPrinter -Scope Global -Force 17 | 18 | cls 19 | If ((Test-Path $env:APPDATA"\DefaultPrinter.txt") -eq $true) { 20 | Remove-Item -Path $env:APPDATA"\DefaultPrinter.txt" -Force 21 | } 22 | $DefaultPrinter = Get-WmiObject -Class win32_printer -ComputerName "localhost" -Filter "Default='true'" | Select-Object ShareName 23 | Write-Host "Default Printer: " -NoNewline 24 | If ($DefaultPrinter.ShareName -ne $null) { 25 | $DefaultPrinter.ShareName | Out-File -FilePath $env:APPDATA"\DefaultPrinter.txt" -Force -Encoding "ASCII" 26 | Write-Host $DefaultPrinter.ShareName 27 | } else { 28 | $DefaultPrinter = "No Default Printer" 29 | $DefaultPrinter | Out-File -FilePath $env:APPDATA"\DefaultPrinter.txt" -Force -Encoding "ASCII" 30 | Write-Host $DefaultPrinter 31 | } 32 | 33 | #Cleanup Global Variables 34 | Remove-Variable -Name DefaultPrinter -Scope Global -Force 35 | 36 | # SIG # Begin signature block 37 | # MIID9QYJKoZIhvcNAQcCoIID5jCCA+ICAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB 38 | # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR 39 | # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUhdw3sg/U/uQ/R/tHR/0rdJFl 40 | # PFygggITMIICDzCCAXygAwIBAgIQ7HIUNzqOT5xDLZzmAt84bjAJBgUrDgMCHQUA 41 | # MBgxFjAUBgNVBAMTDU1pY2sgUGxldGNoZXIwHhcNMTQwNzE2MTM1NTA1WhcNMzkx 42 | # MjMxMjM1OTU5WjAYMRYwFAYDVQQDEw1NaWNrIFBsZXRjaGVyMIGfMA0GCSqGSIb3 43 | # DQEBAQUAA4GNADCBiQKBgQCScgjcWXrW4VkX2SFeT8Qse6Vxpr0KEiP1htaEeI4Y 44 | # hnYkdu+BsI8EvDRcXtBl8jbb+2hrwhLPCIs73ha/mJ8Bi93aG1lZxBj0skknENwc 45 | # WRnppmmfPR6ZB3YPJ/JI1LMKUenKE5LgriojqfKLR1bX27IO8NK6EAcicZqwidLr 46 | # zwIDAQABo2IwYDATBgNVHSUEDDAKBggrBgEFBQcDAzBJBgNVHQEEQjBAgBAmjhAc 47 | # F97GTTLK+hLMy2UQoRowGDEWMBQGA1UEAxMNTWljayBQbGV0Y2hlcoIQ7HIUNzqO 48 | # T5xDLZzmAt84bjAJBgUrDgMCHQUAA4GBAG8Ll2EtPpoJxDEBWHbN2+Kaae0lB9il 49 | # CNTJwUB09Xqul7CFMKOOUt2zU+VsPQAHaJb2VY5ajgJRU22KFwAUk0KFbMxGibDc 50 | # giw5FkzyAHqGyDZjwdPPFs7PJ1Ulnq3qc/JF/fXH5De02Dt7NEZQsTO+SMJWYjHE 51 | # vb6aRW4Q0oDwMYIBTDCCAUgCAQEwLDAYMRYwFAYDVQQDEw1NaWNrIFBsZXRjaGVy 52 | # AhDschQ3Oo5PnEMtnOYC3zhuMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQow 53 | # CKACgAChAoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcC 54 | # AQsxDjAMBgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBQP5sLeW7u9HU2XJYAn 55 | # PHfNKdVlWDANBgkqhkiG9w0BAQEFAASBgGpzS23Ll1g3BzS374Vhm1UbdZfigoS4 56 | # b79o0JOXqBRNNWW6svlpUWF9hu55HJ4CxfOUuW3IB5KmeztByDOF4yOJgHQWwI89 57 | # ep8sPPjhG7yBB8gjdRfDd2hGKd93Gr8QPLHCiYt5SoxhKX9JujvYB2+ofilNW1mR 58 | # RxgwDHeR2TBv 59 | # SIG # End signature block 60 | -------------------------------------------------------------------------------- /GetPrinterList.ps1: -------------------------------------------------------------------------------- 1 | Function GetRelativePath { 2 | $Global:RelativePath=(split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\" 3 | } 4 | 5 | Function GetPrinterList { 6 | 7 | #Declare Local Memory 8 | Set-Variable -Name Count -Scope Local -Force 9 | Set-Variable -Name DefaultPrinter -Scope Local -Force 10 | Set-Variable -Name Printers -Scope Local -Force 11 | Set-Variable -Name Temp -Scope Local -Force 12 | 13 | If (Test-Path -Path $Global:RelativePath"Printers.txt") { 14 | Remove-Item -Path $Global:RelativePath"Printers.txt" -Force 15 | } 16 | $DefaultPrinter = Get-WmiObject -Query " SELECT * FROM Win32_Printer WHERE Default=$true" 17 | $DefaultPrinter = $DefaultPrinter.ToString() 18 | $DefaultPrinter = $DefaultPrinter -replace [char]34,"" 19 | $DefaultPrinter = $DefaultPrinter -replace "\\\\","\" 20 | $DefaultPrinter = $DefaultPrinter.split("=") 21 | $Temp = "Default Printer: "+$DefaultPrinter[$DefaultPrinter.Length-1] 22 | $Temp | Add-Content -Path $Global:RelativePath"Printers.txt" 23 | $Printers = Get-WmiObject -Query " SELECT * FROM Win32_Printer WHERE Default=$false" 24 | For ($Count=0; $Count -lt $Printers.Length; $Count++) { 25 | $Temp = $Printers[$Count] 26 | $Temp = $Temp.ToString() 27 | $Temp = $Temp -replace [char]34,"" 28 | $Temp = $Temp -replace "\\\\","\" 29 | $Temp = $Temp.split("=") 30 | $Temp = "Printer: "+$Temp[1] 31 | $Temp | Add-Content -Path $Global:RelativePath"Printers.txt" 32 | Write-Host $Temp 33 | } 34 | 35 | #Cleanup Local Memory 36 | Remove-Variable -Name Count -Scope Local -Force 37 | Remove-Variable -Name DefaultPrinter -Scope Local -Force 38 | Remove-Variable -Name Printers -Scope Local -Force 39 | Remove-Variable -Name Temp -Scope Local -Force 40 | 41 | } 42 | GetRelativePath 43 | GetPrinterList 44 | -------------------------------------------------------------------------------- /GetSoftwareNameGUID.ps1: -------------------------------------------------------------------------------- 1 | #******************************************************************************* 2 | # Author: Mick Pletcher 3 | # Date: 30 November 2013 4 | # 5 | # Program: Get Software Names and GUID 6 | #******************************************************************************* 7 | 8 | Clear-Host 9 | 10 | Function RenameWindow ($Title) { 11 | 12 | #Declare Local Memory 13 | Set-Variable -Name a -Scope Local -Force 14 | 15 | $a = (Get-Host).UI.RawUI 16 | $a.WindowTitle = $Title 17 | 18 | #Cleanup Local Memory 19 | Remove-Variable -Name a -Scope Local -Force 20 | 21 | } 22 | 23 | Function GetProductName($Description) { 24 | 25 | #Declare Local Memory 26 | Set-Variable -Name AppLocal -Scope Local -Force 27 | Set-Variable -Name AppName -Scope Local -Force 28 | Set-Variable -Name Desc -Scope Local -Force 29 | Set-Variable -Name IDLocal -Scope Local -Force 30 | Set-Variable -Name IDNumber -Scope Local -Force 31 | Set-Variable -Name Uninstaller -Scope Local -Force 32 | 33 | #Change '%application%' to whatever app you are calling 34 | $Description = [char]34+"description like"+[char]32+[char]39+[char]37+$Description+[char]37+[char]39+[char]34 35 | $Desc = wmic product where $Description get Description 36 | $Uninstaller = wmic product where $Description get IdentifyingNumber 37 | $Desc | ForEach-Object { 38 | $_ = $_.Trim() 39 | if(($_ -ne "Description")-and($_ -ne "")){ 40 | $AppName += $_ 41 | } 42 | } 43 | $Uninstaller | ForEach-Object { 44 | $_ = $_.Trim() 45 | if(($_ -ne "IdentifyingNumber")-and($_ -ne "")){ 46 | $IDNumber += $_ 47 | } 48 | } 49 | $AppLocal = New-Object System.Object 50 | $AppLocal | Add-Member -type NoteProperty -name Application -value $AppName 51 | If ($AppName -ne $null) { 52 | $AppLocal | Add-Member -type NoteProperty -name GUID -value $IDNumber 53 | } else { 54 | $AppLocal | Add-Member -type NoteProperty -name Status -value "Not Installed" 55 | } 56 | $AppLocal 57 | 58 | #Cleanup Local Memory 59 | Remove-Variable -Name AppLocal -Scope Local -Force 60 | Remove-Variable -Name AppName -Scope Local -Force 61 | Remove-Variable -Name Desc -Scope Local -Force 62 | Remove-Variable -Name IDLocal -Scope Local -Force 63 | Remove-Variable -Name IDNumber -Scope Local -Force 64 | Remove-Variable -Name Uninstaller -Scope Local -Force 65 | 66 | } 67 | 68 | RenameWindow "Product Name and GUID" 69 | GetProductName "Office Professional Plus" 70 | GetProductName "Microsoft Lync 2013" 71 | GetProductName "Adobe Reader" 72 | GetProductName "Microsoft Visio Professional" -------------------------------------------------------------------------------- /HWInventory.ps1: -------------------------------------------------------------------------------- 1 | Clear-Host 2 | 3 | Set-Variable -Name a -Scope Global -Force 4 | Set-Variable -Name SMSCli -Scope Global -Force 5 | 6 | $SMSCli = [wmiclass] "root\ccm:SMS_Client" 7 | $a = $SMSCli.TriggerSchedule("{00000000-0000-0000-0000-000000000001}") 8 | If ($a.__PROPERTY_COUNT -eq 1) { 9 | $SMSCli.Dispose 10 | Remove-Variable -Name a -Scope Global -Force 11 | Remove-Variable -Name SMSCli -Scope Global -Force 12 | exit 0 13 | } else { 14 | $SMSCli.Dispose 15 | Remove-Variable -Name a -Scope Global -Force 16 | Remove-Variable -Name SMSCli -Scope Global -Force 17 | exit 1 18 | } 19 | -------------------------------------------------------------------------------- /IEActiveX.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Enable/Disable IE Active X Components 4 | .DESCRIPTION 5 | 6 | .PARAMETER 7 | 8 | .EXAMPLE 9 | EnableIEActiveXControl "Application Name" "GUID" "Value" 10 | EnableIEActiveXControl "Flash for IE" "{D27CDB6E-AE6D-11CF-96B8-444553540000}" "0x00000000" 11 | #> 12 | 13 | #Declare Global Memory 14 | Set-Variable -Name Errors -Value $null -Scope Global -Force 15 | Set-Variable -Name LogFile -Value "c:\windows\waller\Logs\BuildLogs\AdobeFlashPlayer.log" -Scope Global -Force 16 | Set-Variable -Name RelativePath -Scope Global -Force 17 | 18 | Function ConsoleTitle ($Title){ 19 | $host.ui.RawUI.WindowTitle = $Title 20 | } 21 | 22 | Function GetRelativePath { 23 | $Global:RelativePath = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\" 24 | } 25 | 26 | Function DisableIEActiveXControl ($AppName,$GUID,$Flag) { 27 | $Key = "HKLM:\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\"+$GUID 28 | If ((Test-Path $Key) -eq $true) { 29 | Write-Host $AppName"....." -NoNewline 30 | Set-ItemProperty -Path $Key -Name "Compatibility Flags" -Value $Flag -Force 31 | $Var = Get-ItemProperty -Path $Key -Name "Compatibility Flags" 32 | If ($Var."Compatibility Flags" -eq 1024) { 33 | Write-Host "Disabled" -ForegroundColor Yellow 34 | } else { 35 | Write-Host "Enabled" -ForegroundColor Red 36 | } 37 | } 38 | } 39 | 40 | Function EnableIEActiveXControl ($AppName,$GUID,$Flag) { 41 | $Key = "HKLM:\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\"+$GUID 42 | If ((Test-Path $Key) -eq $true) { 43 | Write-Host $AppName"....." -NoNewline 44 | Set-ItemProperty -Path $Key -Name "Compatibility Flags" -Value $Flag -Force 45 | $Var = Get-ItemProperty -Path $Key -Name "Compatibility Flags" 46 | If ($Var."Compatibility Flags" -eq 0) { 47 | Write-Host "Enabled" -ForegroundColor Yellow 48 | } else { 49 | Write-Host "Disabled" -ForegroundColor Red 50 | } 51 | } 52 | } 53 | 54 | cls 55 | #DisableIEActiveXControl "Flash for IE" "{D27CDB6E-AE6D-11CF-96B8-444553540000}" "0x00000400" 56 | EnableIEActiveXControl "Flash for IE" "{D27CDB6E-AE6D-11CF-96B8-444553540000}" "0x00000000" 57 | Start-Sleep -Seconds 5 58 | -------------------------------------------------------------------------------- /ImportSCCMModule.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Imports the SCCM PowerShell Module 4 | 5 | .DESCRIPTION 6 | This function will import the SCCM PowerShell module without the need of knowing the location. The only thing that needs to be specified is the name of the SCCM server. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.139 11 | Created on: 4/26/2017 3:56 PM 12 | Created by: Mick Pletcher 13 | Filename: ImportSCCMModule.ps1 14 | =========================================================================== 15 | #> 16 | [CmdletBinding()] 17 | param () 18 | 19 | function Import-SCCMModule { 20 | <# 21 | .SYNOPSIS 22 | Import SCCM Module 23 | 24 | .DESCRIPTION 25 | Locate the ConfigurationManager.psd1 file and import it. 26 | 27 | .PARAMETER SCCMServer 28 | Name of the SCCM server to connect to. 29 | 30 | .NOTES 31 | Additional information about the function. 32 | #> 33 | 34 | [CmdletBinding()] 35 | param 36 | ( 37 | [ValidateNotNullOrEmpty()][string]$SCCMServer 38 | ) 39 | 40 | #Get the architecture of the specified SCCM server 41 | $Architecture = (get-wmiobject win32_operatingsystem -computername $SCCMServer).OSArchitecture 42 | #Get list of installed applications 43 | $Uninstall = Invoke-Command -ComputerName $SCCMServer -ScriptBlock { Get-ChildItem -Path REGISTRY::"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" -Force -ErrorAction SilentlyContinue } 44 | If ($Architecture -eq "64-bit") { 45 | $Uninstall += Invoke-Command -ComputerName $SCCMServer -ScriptBlock { Get-ChildItem -Path REGISTRY::"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall" -Force -ErrorAction SilentlyContinue } 46 | } 47 | #Get the registry key that specifies the location of the SCCM installation drive and directory 48 | $RegKey = ($Uninstall | Where-Object { $_ -like "*SMS Primary Site*" }) -replace 'HKEY_LOCAL_MACHINE', 'HKLM:' 49 | $Reg = Invoke-Command -ComputerName $SCCMServer -ScriptBlock { Get-ItemProperty -Path $args[0] } -ArgumentList $RegKey 50 | #Parse the directory listing 51 | $Directory = (($Reg.UninstallString).Split("\", 4) | Select-Object -Index 0, 1, 2) -join "\" 52 | #Locate the location of the SCCM module 53 | $Module = Invoke-Command -ComputerName $SCCMServer -ScriptBlock { Get-ChildItem -Path $args[0] -Filter "ConfigurationManager.psd1" -Recurse } -ArgumentList $Directory 54 | #If more than one module is present, use the latest one 55 | If ($Module.Length -gt 1) { 56 | foreach ($Item in $Module) { 57 | If (($NewModule -eq $null) -or ($Item.CreationTime -gt $NewModule.CreationTime)) { 58 | $NewModule = $Item 59 | } 60 | } 61 | $Module = $NewModule 62 | } 63 | #format the $Module unc path 64 | [string]$Module = "\\" + $SCCMServer + "\" + ($Module.Fullname -replace ":", "$") 65 | #Import the SCCM module 66 | Import-Module -Name $Module 67 | } 68 | 69 | Import-SCCMModule -SCCMServer "SCCMServer" 70 | -------------------------------------------------------------------------------- /InitializeTPM.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Initialize TPM 4 | 5 | .DESCRIPTION 6 | This script will turn on the PPI Bypass for TPM clear and Initialize the TPM. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.207 11 | Created on: 6/28/2022 10:02 AM 12 | Created by: Mick Pletcher 13 | Filename: DellBIOS04.ps1 14 | =========================================================================== 15 | #> 16 | 17 | #Install Dell BIOS Provider PowerShell Module 18 | Try { 19 | Import-Module -Name DellBIOSProvider 20 | } Catch { 21 | Find-Module -Name DellBIOSProvider | Install-Module -Force 22 | Import-Module -Name DellBIOSProvider 23 | } 24 | #Initialize TPM 25 | Initialize-Tpm -AllowClear 26 | -------------------------------------------------------------------------------- /InstallDotNet47.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Install .Net Framework 4.7 4 | 5 | .DESCRIPTION 6 | This script will install .Net Framework 4.7 using the MSU file. It is written to accomidate both x86 and x64 versions. The script will also convert the WUSA.EXE return codes to standard SCCM return codes. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.143 11 | Created on: 9/15/2017 10:45 AM 12 | Created by: Mick Pletcher 13 | Filename: installDotNet47.ps1 14 | =========================================================================== 15 | #> 16 | [CmdletBinding()] 17 | param () 18 | function Get-Architecture { 19 | <# 20 | .SYNOPSIS 21 | Get-Architecture 22 | 23 | .DESCRIPTION 24 | Returns whether the system architecture is 32-bit or 64-bit 25 | 26 | .EXAMPLE 27 | Get-Architecture 28 | 29 | .NOTES 30 | Additional information about the function. 31 | #> 32 | 33 | [CmdletBinding()][OutputType([string])] 34 | param () 35 | 36 | $OSArchitecture = Get-WmiObject -Class Win32_OperatingSystem | Select-Object OSArchitecture 37 | $OSArchitecture = $OSArchitecture.OSArchitecture 38 | Return $OSArchitecture 39 | #Returns 32-bit or 64-bit 40 | } 41 | 42 | function Get-RelativePath { 43 | <# 44 | .SYNOPSIS 45 | Get the relative path 46 | 47 | .DESCRIPTION 48 | Returns the location of the currently running PowerShell script 49 | 50 | .NOTES 51 | Additional information about the function. 52 | #> 53 | 54 | [CmdletBinding()][OutputType([string])] 55 | param () 56 | 57 | $Path = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent) + "\" 58 | Return $Path 59 | } 60 | 61 | function Install-MSUFile { 62 | <# 63 | .SYNOPSIS 64 | Install Windows Update 65 | 66 | .DESCRIPTION 67 | This function installs windows update MSU files. 68 | 69 | .PARAMETER FileName 70 | Name of MSU file 71 | 72 | .NOTES 73 | Additional information about the function. 74 | #> 75 | 76 | [CmdletBinding()] 77 | param 78 | ( 79 | [ValidateNotNullOrEmpty()][string]$FileName 80 | ) 81 | 82 | $RelativePath = Get-RelativePath 83 | $Executable = $env:windir + "\System32\wusa.exe" 84 | $Parameters = $RelativePath + $FileName + [char]32 + "/quiet /norestart" 85 | $ErrCode = (Start-Process -FilePath $Executable -ArgumentList $Parameters -Wait -Passthru).ExitCode 86 | Return $ErrCode 87 | } 88 | 89 | $Architecture = Get-Architecture 90 | If ($Architecture -eq "32-Bit") { 91 | $ReturnCode = Install-MSUFile -FileName Windows6.1-KB4019990-x86.msu 92 | } else { 93 | $ReturnCode = Install-MSUFile -FileName Windows6.1-KB4019990-x64.msu 94 | } 95 | #Exit Return Codes 96 | #2359301 -- Reboot Required 97 | #2359302 -- Already Installed 98 | If ($ReturnCode -eq 2359301) { 99 | $ReturnCode = 3010 100 | } 101 | If ($ReturnCode -eq 2359302) { 102 | $ReturnCode = 0 103 | } 104 | $ReturnCode 105 | Exit $ReturnCode 106 | -------------------------------------------------------------------------------- /InstallOnlineUpdates.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2015 v4.2.99 5 | Created on: 1/18/2016 1:41 PM 6 | Created by: Mick Pletcher 7 | Filename: InstallOnlineUpdates.ps1 8 | =========================================================================== 9 | .DESCRIPTION 10 | This script will install both exe updates and msu updates. It is 11 | intended to be used during the generation of a reference image. Not 12 | all updates can be injected offline into the OS. This script takes 13 | care of those by running post-OS install. 14 | #> 15 | 16 | 17 | function Install-EXEUpdates { 18 | #Declare Variables 19 | Set-Variable -Name Arguments -Scope Local -Force 20 | Set-Variable -Name ErrCode -Scope Local -Force 21 | Set-Variable -Name File -Scope Local -Force 22 | Set-Variable -Name EXEFiles -Scope Local -Force 23 | Set-Variable -Name RelativePath -Scope Local -Force 24 | 25 | $RelativePath = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent) + "\" 26 | $EXEFiles = Get-ChildItem -Path $RelativePath -Force | where { $_.Name -like "*.exe*" } 27 | If ($EXEFiles.Count -ge 1) { 28 | $EXEFiles | Sort-Object 29 | cls 30 | foreach ($File in $EXEFiles) { 31 | $Arguments = "/passive /norestart" 32 | Write-Host "Installing"$File.Name"....." -NoNewline 33 | $ErrCode = (Start-Process -FilePath $File.Fullname -ArgumentList $Arguments -Wait -Passthru).ExitCode 34 | If ($ErrCode -eq 0) { 35 | Write-Host "Success" -ForegroundColor Yellow 36 | } else { 37 | Write-Host "Failed with error code"$ErrCode -ForegroundColor Red 38 | } 39 | } 40 | } 41 | 42 | #Cleanup Local Variables 43 | Remove-Variable -Name Arguments -Scope Local -Force 44 | Remove-Variable -Name ErrCode -Scope Local -Force 45 | Remove-Variable -Name File -Scope Local -Force 46 | Remove-Variable -Name EXEFiles -Scope Local -Force 47 | Remove-Variable -Name RelativePath -Scope Local -Force 48 | } 49 | 50 | function Install-MSUUpdates { 51 | #Declare Variables 52 | Set-Variable -Name Arguments -Scope Local -Force 53 | Set-Variable -Name ErrCode -Scope Local -Force 54 | Set-Variable -Name Executable -Value $env:windir"\System32\wusa.exe" -Scope Local -Force 55 | Set-Variable -Name File -Scope Local -Force 56 | Set-Variable -Name MSUFiles -Scope Local -Force 57 | Set-Variable -Name RelativePath -Scope Local -Force 58 | 59 | $RelativePath = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent) + "\" 60 | $MSUFiles = Get-ChildItem -Path $RelativePath -Force | where { $_.Name -like "*.msu*" } 61 | If ($MSUFiles.Count -ge 1) { 62 | $MSUFiles | Sort-Object 63 | cls 64 | foreach ($File in $MSUFiles) { 65 | $Arguments = $File.FullName + [char]32 + "/quiet /norestart" 66 | Write-Host "Installing"$File.Name"....." -NoNewline 67 | $ErrCode = (Start-Process -FilePath $Executable -ArgumentList $Arguments -Wait -Passthru).ExitCode 68 | If (($ErrCode -eq 0) -or ($ErrCode -eq 2359302)) { 69 | Write-Host "Success" -ForegroundColor Yellow 70 | } else { 71 | Write-Host "Failed with error code"$ErrCode -ForegroundColor Red 72 | } 73 | } 74 | } 75 | 76 | #Cleanup Local Variables 77 | Remove-Variable -Name Arguments -Scope Local -Force 78 | Remove-Variable -Name ErrCode -Scope Local -Force 79 | Remove-Variable -Name Executable -Scope Local -Force 80 | Remove-Variable -Name File -Scope Local -Force 81 | Remove-Variable -Name MSUFiles -Scope Local -Force 82 | Remove-Variable -Name RelativePath -Scope Local -Force 83 | } 84 | 85 | cls 86 | Install-EXEUpdates 87 | Install-MSUUpdates 88 | Start-Sleep -Seconds 5 89 | -------------------------------------------------------------------------------- /InstallOpenLM.cmd: -------------------------------------------------------------------------------- 1 | msiexec.exe /i %~dp0\openlm_utilizer_agent_win_1713.msi /qb- /norestart 2 | timeout 2 3 | taskkill.exe /IM OpenLM_Agent.exe /t /f 4 | timeout 2 5 | copy %~dp0\OpenLM_Agent.exe.config "C:\Program Files (x86)\OpenLM\OpenLM Agent\OpenLM_Agent.exe.config" /v /y /z 6 | "C:\Program Files (x86)\OpenLM\OpenLM Agent\OpenLM_Agent.exe" 7 | -------------------------------------------------------------------------------- /InstallPowerShellGallery.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Install PowerShell Gallery 4 | 5 | .DESCRIPTION 6 | This script will install the necessary files and package provider necessary to access the Microsoft PowerShell Gallery. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.143 11 | Created on: 1/23/2018 10:33 AM 12 | Created by: Mick Pletcher 13 | Filename: InstallPowerShellGallery.ps1 14 | =========================================================================== 15 | #> 16 | [CmdletBinding()] 17 | param () 18 | 19 | function Get-Architecture { 20 | <# 21 | .SYNOPSIS 22 | Get-Architecture 23 | 24 | .DESCRIPTION 25 | Returns whether the system architecture is 32-bit or 64-bit 26 | 27 | .EXAMPLE 28 | Get-Architecture 29 | 30 | .NOTES 31 | Additional information about the function. 32 | #> 33 | 34 | [CmdletBinding()][OutputType([string])] 35 | param () 36 | 37 | $OSArchitecture = (Get-WmiObject -Class Win32_OperatingSystem | Select-Object OSArchitecture).OSArchitecture 38 | Return $OSArchitecture 39 | #Returns 32-bit or 64-bit 40 | } 41 | 42 | function Get-RelativePath { 43 | <# 44 | .SYNOPSIS 45 | Get the relative path 46 | 47 | .DESCRIPTION 48 | Returns the location of the currently running PowerShell script 49 | 50 | .NOTES 51 | Additional information about the function. 52 | #> 53 | 54 | [CmdletBinding()][OutputType([string])] 55 | param () 56 | 57 | $Path = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent) + "\" 58 | Return $Path 59 | } 60 | 61 | function Install-MSIFile { 62 | <# 63 | .SYNOPSIS 64 | Install Windows Update 65 | 66 | .DESCRIPTION 67 | This function installs windows update MSU files. 68 | 69 | .PARAMETER File 70 | A description of the File parameter. 71 | 72 | .PARAMETER Arguments 73 | List of MSI arguments 74 | 75 | .PARAMETER FileName 76 | Name of MSU file 77 | 78 | .NOTES 79 | Additional information about the function. 80 | #> 81 | 82 | [CmdletBinding()] 83 | param 84 | ( 85 | [ValidateNotNullOrEmpty()]$File, 86 | [ValidateNotNullOrEmpty()][string]$Arguments 87 | ) 88 | 89 | $RelativePath = Get-RelativePath 90 | $Executable = $env:windir + "\System32\msiexec.exe" 91 | $Parameters = "/i" + [char]32 + $File.Fullname + [char]32 + $Arguments 92 | Write-Host "Installing"($File.Name).Trim()"....." -NoNewline 93 | $ErrCode = (Start-Process -FilePath $Executable -ArgumentList $Parameters -Wait -Passthru).ExitCode 94 | If (($ErrCode -eq 0) -or ($ErrCode -eq 3010)) { 95 | Write-Host "Success" -ForegroundColor Yellow 96 | Return $true 97 | } else { 98 | Write-Host "Failed" -ForegroundColor Red 99 | Return $false 100 | } 101 | } 102 | 103 | #Get machine architecture 104 | $Architecture = Get-Architecture 105 | #Get the path this script is executing from 106 | $RelativePath = Get-RelativePath 107 | #Determine the correct MSI package to execute 108 | If ($Architecture -eq "32-bit") { 109 | $File = Get-ChildItem -Path $RelativePath -Filter *x86.msi 110 | } else { 111 | $File = Get-ChildItem -Path $RelativePath -Filter *x64.msi 112 | } 113 | #Install the PackageManagement 114 | $Results = Install-MSIFile -File $File -Arguments "/qb- /norestart" 115 | If ($Results -eq $true) { 116 | #Install nuget to gain access to the PowerShell Gallery 117 | Install-PackageProvider nuget -Force -Verbose 118 | Exit 0 119 | } else { 120 | Exit 1 121 | } 122 | #Trust Microsoft PowerShell Gallery 123 | Set-PSRepository -Name PSGallery -InstallationPolicy Trusted 124 | #Install Dell BIOS Provider 125 | Install-Module -Name ((Find-Module -Name DellBIOSProvider).Name) -Force -Verbose 126 | -------------------------------------------------------------------------------- /Install_wmf4.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Author 3 | Mick Pletcher 4 | .Date 5 | 29 July 2014 6 | .SYNOPSIS 7 | Windows Management Framework 4.0 8 | .EXAMPLE 9 | powershell.exe -executionpolicy bypass -file install_WMF4.ps1 10 | #> 11 | 12 | #Declare Global Memory 13 | Set-Variable -Name Errors -Value $null -Scope Global -Force 14 | Set-Variable -Name RelativePath -Scope Global -Force 15 | Set-Variable -Name Title -Scope Global -Force 16 | 17 | Function ConsoleTitle ($Title){ 18 | $host.ui.RawUI.WindowTitle = $Title 19 | } 20 | 21 | Function DeclareGlobalVariables { 22 | $Global:Title = "Windows Management Framework 4.0" 23 | } 24 | 25 | Function GetRelativePath { 26 | $Global:RelativePath = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\" 27 | } 28 | 29 | Function InstallMSU ($ProgName,$MSU,$Switches) { 30 | $EXE = $Env:windir+"\system32\wusa.exe" 31 | $Parameters = [char]34+$MSU+[char]34+[char]32+$Switches 32 | Write-Host "Install "$ProgName"....." -NoNewline 33 | $ErrCode = (Start-Process -FilePath $EXE -ArgumentList $Parameters -Wait -Passthru).ExitCode 34 | If (($ErrCode -eq 0) -or ($ErrCode -eq 3010)) { 35 | Write-Host "Success" -ForegroundColor Yellow 36 | } elseif ($ErrCode -eq 2359302) { 37 | Write-Host "Already Installed" -ForegroundColor Green 38 | } else { 39 | Write-Host "Failed with error code "$ErrCode -ForegroundColor Red 40 | $Global:Errors++ 41 | } 42 | } 43 | 44 | Function ExitPowerShell { 45 | If (($Global:Errors -ne $null) -and ($Global:Errors -ne 0)) { 46 | Exit 1 47 | } 48 | } 49 | 50 | cls 51 | DeclareGlobalVariables 52 | GetRelativePath 53 | ConsoleTitle $Global:Title 54 | InstallMSU "Windows Management Framework 4.0" $Global:RelativePath"Windows6.1-KB2819745-x86-MultiPkg.msu" "/quiet /norestart" 55 | Start-Sleep -Seconds 5 56 | ExitPowerShell 57 | -------------------------------------------------------------------------------- /InstallerTemplate.vbs: -------------------------------------------------------------------------------- 1 | '******************************************************************************* 2 | ' Program: Install.vbs 3 | ' Author: 4 | ' Date: 5 | ' Modified: 6 | ' 7 | ' Program: 8 | ' Version: 9 | ' Description: This will install 10 | ' 1) Define the relative installation path 11 | ' 2) Create the Log Folder 12 | ' *) Install 13 | ' *) Cleanup Global Variables 14 | '******************************************************************************* 15 | Option Explicit 16 | 17 | REM Define Constants 18 | CONST TempFolder = "c:\temp\" 19 | CONST LogFolderName = "" 20 | 21 | REM Define Global Variables 22 | DIM LogFolder : LogFolder = TempFolder & LogFolderName & "\" 23 | DIM RelativePath : Set RelativePath = Nothing 24 | 25 | REM Define the relative installation path 26 | DefineRelativePath() 27 | REM Create the Log Folder 28 | CreateLogFolder() 29 | REM Install 30 | Install 31 | REM Cleanup Global Variables 32 | GlobalVariableCleanup() 33 | 34 | '******************************************************************************* 35 | '******************************************************************************* 36 | 37 | Sub DefineRelativePath() 38 | REM Get File Name with full relative path 39 | RelativePath = WScript.ScriptFullName 40 | REM Remove file name, leaving relative path only 41 | RelativePath = Left(RelativePath, InStrRev(RelativePath, "\")) 42 | End Sub 43 | 44 | '******************************************************************************* 45 | 46 | Sub CreateLogFolder() 47 | REM Define Local Objects 48 | DIM FSO : Set FSO = CreateObject("Scripting.FileSystemObject") 49 | 50 | If NOT FSO.FolderExists(TempFolder) then 51 | FSO.CreateFolder(TempFolder) 52 | End If 53 | If NOT FSO.FolderExists(LogFolder) then 54 | FSO.CreateFolder(LogFolder) 55 | End If 56 | 57 | REM Cleanup Local Variables 58 | Set FSO = Nothing 59 | End Sub 60 | 61 | '******************************************************************************* 62 | 63 | Sub Install() 64 | REM Define Local Objects 65 | DIM oShell : SET oShell = CreateObject("Wscript.Shell") 66 | 67 | REM Define Local Variables 68 | DIM MSI : MSI = Chr(32) & RelativePath & ".msi" 69 | DIM Logs : Logs = Chr(32) & "/lvx" & Chr(32) & LogFolder & "" 70 | DIM Parameters : Parameters = Chr(32) & "/qb- /norestart" 71 | DIM Transforms : Transforms = Chr(32) & "Transforms=" & RelativePath & "" 72 | DIM Install : Install = "msiexec.exe /i" & MSI & Logs & Parameters 73 | 74 | oShell.Run Install, 1, True 75 | 76 | REM Cleanup Local Variables 77 | Set Install = Nothing 78 | Set Logs = Nothing 79 | Set MSI = Nothing 80 | Set oShell = Nothing 81 | Set Parameters = Nothing 82 | Set Transforms = Nothing 83 | End Sub 84 | 85 | '******************************************************************************* 86 | 87 | Sub GlobalVariableCleanup() 88 | Set LogFolder = Nothing 89 | Set RelativePath = Nothing 90 | End Sub 91 | -------------------------------------------------------------------------------- /LGPO.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Apply Local Group Policy 4 | .Author 5 | Mick Pletcher 6 | .Date 7 | 23 February 2015 8 | .EXAMPLE 9 | powershell.exe -executionpolicy bypass -file LGPO.ps1 10 | #> 11 | 12 | 13 | Function Import-LGPO { 14 | 15 | Param([String]$LGPOName, [String]$LGPOLocation, [String]$GPOType) 16 | 17 | $Executable = $Global:RelativePath+"ImportRegPol.exe" 18 | If ($GPOType -eq "Machine") { 19 | $GPOType = "\DomainSysvol\GPO\Machine\registry.pol" 20 | } else { 21 | $GPOType = "\DomainSysvol\GPO\User\registry.pol" 22 | } 23 | $Parameters = "-m "+[char]34+$LGPOLocation+$GPOType+[char]34 24 | Write-Host "Apply Local"$LGPOName" Policy....." -NoNewline 25 | $ErrCode = (Start-Process -FilePath $Executable -ArgumentList $Parameters -Wait -Passthru).ExitCode 26 | If (($ErrCode -eq 0) -or ($ErrCode -eq 3010)) { 27 | Write-Host "Success" -ForegroundColor Yellow 28 | } else { 29 | Write-Host "Failed with error code "$ErrCode -ForegroundColor Red 30 | } 31 | 32 | } 33 | 34 | cls 35 | $Global:RelativePath = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\" 36 | Import-LGPO -LGPOName "User Friendly Name" -LGPOLocation "" -GPOType "Machine" 37 | Start-Sleep -Seconds 5 38 | 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 MicksITBlogs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LastReboot.ps1: -------------------------------------------------------------------------------- 1 | Import-Module -Name ActiveDirectory -Force 2 | #Get list of windows based servers 3 | $Servers = Get-ADComputer -Filter * -Properties * | Where-Object {$_.OperatingSystem -like '*windows server*'} | Select Name | Sort-Object -Property Name 4 | #Create Report Array 5 | $Report = @() 6 | #Parse through server list 7 | Foreach ($Server in $Servers) { 8 | #Get the computer name 9 | $ComputerName = ([String]$Server).Split("=")[1].Split("}")[0].Trim() 10 | #Check if the system is online 11 | If ((Test-Connection -ComputerName $ComputerName -Count 1 -Quiet) -eq $true) { 12 | #Query last bootup time and use $Null if unobtainable 13 | Try { 14 | $LastBootTime = (Get-CimInstance -ClassName win32_operatingsystem -ComputerName $ComputerName -ErrorAction SilentlyContinue).LastBootUpTime 15 | $LastBoot = (New-TimeSpan -Start $LastBootTime -End (Get-Date)).Days 16 | } Catch { 17 | $LastBoot = $null 18 | } 19 | #Add computername and last boot time to the object 20 | If ($ComputerName -ne $null) { 21 | $SystemObject = New-Object -TypeName psobject 22 | $SystemObject | Add-Member -MemberType NoteProperty -Name ComputerName -Value $ComputerName 23 | $SystemObject | Add-Member -MemberType NoteProperty -Name DaysSinceLastBoot -Value $LastBoot 24 | $Report += $SystemObject 25 | } 26 | } else { 27 | $SystemObject = New-Object -TypeName psobject 28 | $SystemObject | Add-Member -MemberType NoteProperty -Name ComputerName -Value $ComputerName 29 | $SystemObject | Add-Member -MemberType NoteProperty -Name DaysSinceLastBoot -Value 'OFFLINE' 30 | $Report += $SystemObject 31 | } 32 | $ComputerName = $null 33 | } 34 | #Print report to screen 35 | $Report 36 | $OutFile = "C:\Users\Desktop\LastRebootReport.csv" 37 | #Delete CSV file if it already exists 38 | If ((Test-Path -Path $OutFile) -eq $true) { 39 | Remove-Item -Path $OutFile -Force 40 | } 41 | #Export report to CSV file 42 | $Report | Export-Csv -Path $OutFile -NoClobber -Encoding UTF8 -NoTypeInformation -Force 43 | -------------------------------------------------------------------------------- /LicensedSoftwareVerification.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2015 v4.2.92 5 | Created on: 8/21/2015 1:33 PM 6 | Created by: Mick Pletcher 7 | Filename: LicensedSoftwareVerification.ps1 8 | =========================================================================== 9 | .DESCRIPTION 10 | This script will query SCCM for all systems with a specified 11 | software installed. It will then grab all system within a specified 12 | collection to compare the query with. The collection is the 13 | definitive place where all necessary systems are placed that 14 | require the licensed software. Any systems the query sees that are 15 | not in the collection will be added to the excel report for further 16 | investigation. If the system is valid, it should then be added to 17 | the collection. 18 | #> 19 | 20 | param 21 | ( 22 | [string] 23 | $OutputFile = 'AdobeAcrobatReport.csv', 24 | [string] 25 | $Path 26 | ) 27 | 28 | function ProcessTextFile { 29 | If ((Test-Path -Path $OutputFile) -eq $true) { 30 | Remove-Item -Path $OutputFile -Force 31 | } 32 | } 33 | 34 | function Get-CollectionSystems { 35 | Param([string]$CollectionID) 36 | 37 | #Declare Local Variables 38 | Set-Variable -Name System -Scope Local -Force 39 | Set-Variable -Name SystemArray -Scope Local -Force 40 | Set-Variable -Name Systems -Scope Local -Force 41 | 42 | $SystemArray = @() 43 | $Systems = get-cmdevice -collectionid $CollectionID | select name | Sort-Object Name 44 | Foreach ($System in $Systems) { 45 | $SystemArray = $SystemArray + $System.Name 46 | } 47 | Return $SystemArray 48 | 49 | #Cleanup Local Variables 50 | Remove-Variable -Name System -Scope Local -Force 51 | Remove-Variable -Name SystemArray -Scope Local -Force 52 | Remove-Variable -Name Systems -Scope Local -Force 53 | } 54 | 55 | 56 | cls 57 | Import-Module "D:\Program Files\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" -Force -Scope Global 58 | Set-Location SCCMSiteCode: 59 | $CollectionSystems = @() 60 | $QuerySystems = @() 61 | $UnlicensedSystems = @() 62 | #Input the SCCM query code for the $WQL variable 63 | $WQL = 'select * from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName = "Adobe Acrobat 8 Professional" or SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName = "Adobe Acrobat X Pro - English, Français, Deutsch" or SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName = "Adobe Acrobat X Standard - English, Français, Deutsch" or SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName = "Adobe Acrobat XI Pro" or SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName = "Adobe Acrobat XI Standard"' 64 | $WMI = Get-WmiObject -Namespace Root\SMS\Site_BNA -Query $WQL 65 | #Use the collectionID of the collection you use as the definitive licensing site 66 | $CollectionSystems = Get-CollectionSystems -CollectionID "SCCM00024" 67 | Set-Location c: 68 | $OutputFile = $Path + "\" + $OutputFile 69 | ProcessTextFile 70 | $Output = "Computer Name" 71 | Out-File -FilePath $OutputFile -InputObject $Output -Force -Encoding UTF8 72 | Foreach ($Item in $WMI) { 73 | $QuerySystems = $QuerySystems + $Item.SMS_R_System.Name 74 | } 75 | Foreach ($QuerySystem in $QuerySystems) { 76 | $SystemVerified = $false 77 | Foreach ($CollectionSystem in $CollectionSystems) { 78 | If ($QuerySystem -eq $CollectionSystem) { 79 | $SystemVerified = $true 80 | } 81 | } 82 | If ($SystemVerified -eq $false) { 83 | Out-File -FilePath $OutputFile -InputObject $QuerySystem -Force -Encoding UTF8 84 | } 85 | } -------------------------------------------------------------------------------- /ListUpdates.vbs: -------------------------------------------------------------------------------- 1 | REM Define Local Variables 2 | DIM strComputer : strComputer = "." 3 | 4 | REM Define Local Objects 5 | DIM FSO : Set FSO = CreateObject("Scripting.FileSystemObject") 6 | DIM objFile : Set objFile = FSO.CreateTextFile("Updates.csv", True) 7 | DIM objHotfixFile : Set objHotfixFile = FSO.OpenTextFile("Updates.csv", 1,True) 8 | DIM objWMIService : Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" _ 9 | & strComputer & "\root\cimv2") 10 | DIM colQuickFixes : Set colQuickFixes = objWMIService.ExecQuery _ 11 | ("Select * from Win32_QuickFixEngineering") 12 | 13 | 14 | For Each objQuickFix in colQuickFixes 15 | ' Wscript.Echo "Description: " & objQuickFix.Description & Chr(13) & "Hotfix ID: " & objQuickFix.HotFixID 16 | ' objHotfixFile.WriteLine(objQuickFix.Description & Chr(44) & objQuickFix.HotFixID) 17 | objFile.WriteLine(objQuickFix.Description & Chr(44) & objQuickFix.HotFixID) 18 | Next 19 | Wscript.Echo "Done" 20 | objFile.Close 21 | 22 | REM Cleanup Local Objects and Variables 23 | Set colQuickFixes = Nothing 24 | Set FSO = Nothing 25 | Set objFile = Nothing 26 | Set objHotfixFile = Nothing 27 | Set objWMIService = Nothing 28 | Set strComputer = Nothing 29 | -------------------------------------------------------------------------------- /LocalAdministratorsDetection.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2015 v4.2.98 5 | Created on: 11/23/2015 1:14 PM 6 | Created by: Mick Pletcher 7 | Filename: LocalAdministratorsDetectionMethod.ps1 8 | =========================================================================== 9 | .DESCRIPTION 10 | This script will query the local administrators group. It will return a 11 | success to SCCM if there are no members in the local administrators 12 | group or if a system is in the SystemExclusions array or a user is 13 | in the MemberExclusions variable. 14 | #> 15 | 16 | #Declare Global Variables 17 | Set-Variable -Name LocalAdmins -Force 18 | Set-Variable -Name LogFile -Value $env:windir"\Logs\LocalAdministrators_Emailed.log" -Force 19 | Set-Variable -Name Member -Force 20 | Set-Variable -Name MemberExclusions -Force 21 | Set-Variable -Name Members -Force 22 | Set-Variable -Name SystemExclusions -Force 23 | 24 | cls 25 | $MemberExclusions = @("Domain Admins","Workstation Admins") 26 | $SystemExclusions = @("SYSTEM01") 27 | $LocalAdmins = @() 28 | $Members = net localgroup administrators | where { $_ -AND $_ -notmatch "command completed successfully" } | select -skip 4 29 | $Profiles = Get-ChildItem -Path $env:SystemDrive"\users" -Force 30 | Foreach ($Member in $Members) { 31 | $Member = $Member.Split("\") 32 | If ($Member.Count -gt 1) { 33 | [string]$Member = $Member[1] 34 | If ($Member -notin $MemberExclusions) { 35 | $LocalAdmins += $Member 36 | } 37 | } 38 | Remove-Variable -Name Member 39 | } 40 | if (($LocalAdmins.Count -eq 0) -and ((Test-Path -Path $LogFile) -eq $true)) { 41 | Remove-Item -Path $LogFile -Force 42 | } 43 | if (($LocalAdmins.Count -gt 0) -and ($env:COMPUTERNAME -notin $SystemExclusions) -and ((Test-Path -Path $LogFile) -eq $false )) { 44 | Start-Sleep -Seconds 5 45 | exit 0 46 | } else { 47 | Write-Host "No Local Administrators" 48 | Start-Sleep -Seconds 5 49 | exit 0 50 | } 51 | $LocalAdmins = $null 52 | 53 | #Cleanup Global Variables 54 | Remove-Variable -Name LocalAdmins -Force 55 | Remove-Variable -Name LogFile -Force 56 | Remove-Variable -Name Member -Force 57 | Remove-Variable -Name MemberExclusions -Force 58 | Remove-Variable -Name Members -Force 59 | Remove-Variable -Name SystemExclusions -Force 60 | -------------------------------------------------------------------------------- /LocalAdministratorsReport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Create Local Administrators Report 4 | .DESCRIPTION 5 | This will read all .log files and consolidate them into a master 6 | .csv file with the computer name and list of local admins for 7 | each computer 8 | .Author 9 | Mick Pletcher 10 | .Date 11 | 14 February 2015 12 | .EXAMPLE 13 | powershell.exe -executionpolicy bypass -file LocalAdministratorsReport.ps1 14 | #> 15 | 16 | $MasterLog = "\\NetworkLocation\LocalAdministrators.csv" 17 | $Files = Get-ChildItem -Path \\NetworkLocation -Force 18 | If ((Test-Path $MasterLog) -eq $true) { 19 | Remove-Item -Path $MasterLog -Force 20 | } 21 | If ((Test-Path $MasterLog) -eq $false) { 22 | $TitleBar = "ComputerName,UserName"+[char]13 23 | New-Item -Path $MasterLog -ItemType File -Value $TitleBar -Force 24 | } 25 | Foreach ($File in $Files) { 26 | If ($File.Extension -eq ".log") { 27 | $Usernames = Get-Content -Path $File.FullName 28 | Foreach ($Username in $Usernames) { 29 | $Entry = $File.BaseName+","+$Username 30 | Add-Content -Path $MasterLog -Value $Entry -Force 31 | } 32 | } 33 | } 34 | 35 | # SIG # Begin signature block 36 | # MIID9QYJKoZIhvcNAQcCoIID5jCCA+ICAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB 37 | # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR 38 | # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUjZ9wSJmADrm6V+qYUDgsmA7z 39 | # YxugggITMIICDzCCAXygAwIBAgIQ7HIUNzqOT5xDLZzmAt84bjAJBgUrDgMCHQUA 40 | # MBgxFjAUBgNVBAMTDU1pY2sgUGxldGNoZXIwHhcNMTQwNzE2MTM1NTA1WhcNMzkx 41 | # MjMxMjM1OTU5WjAYMRYwFAYDVQQDEw1NaWNrIFBsZXRjaGVyMIGfMA0GCSqGSIb3 42 | # DQEBAQUAA4GNADCBiQKBgQCScgjcWXrW4VkX2SFeT8Qse6Vxpr0KEiP1htaEeI4Y 43 | # hnYkdu+BsI8EvDRcXtBl8jbb+2hrwhLPCIs73ha/mJ8Bi93aG1lZxBj0skknENwc 44 | # WRnppmmfPR6ZB3YPJ/JI1LMKUenKE5LgriojqfKLR1bX27IO8NK6EAcicZqwidLr 45 | # zwIDAQABo2IwYDATBgNVHSUEDDAKBggrBgEFBQcDAzBJBgNVHQEEQjBAgBAmjhAc 46 | # F97GTTLK+hLMy2UQoRowGDEWMBQGA1UEAxMNTWljayBQbGV0Y2hlcoIQ7HIUNzqO 47 | # T5xDLZzmAt84bjAJBgUrDgMCHQUAA4GBAG8Ll2EtPpoJxDEBWHbN2+Kaae0lB9il 48 | # CNTJwUB09Xqul7CFMKOOUt2zU+VsPQAHaJb2VY5ajgJRU22KFwAUk0KFbMxGibDc 49 | # giw5FkzyAHqGyDZjwdPPFs7PJ1Ulnq3qc/JF/fXH5De02Dt7NEZQsTO+SMJWYjHE 50 | # vb6aRW4Q0oDwMYIBTDCCAUgCAQEwLDAYMRYwFAYDVQQDEw1NaWNrIFBsZXRjaGVy 51 | # AhDschQ3Oo5PnEMtnOYC3zhuMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQow 52 | # CKACgAChAoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcC 53 | # AQsxDjAMBgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBQF3c/6Ox/av+swTMi4 54 | # JNyPHpaJbzANBgkqhkiG9w0BAQEFAASBgAIeBLzZlG4EkoAby/0NtK3jQxf7nr5U 55 | # +RQOYSWZVKT/PBahYreQl+OX20yzuhyV/2OpTxJ4E8AHozuusZ1yOGXffhgf6bzL 56 | # UW3yBrPec6Vsim/HbQWlrfudunbnKsvrvDZ8cx7rTt+alz5yeESfuxZ5KigmF6dR 57 | # XTDb8epmYYqo 58 | # SIG # End signature block 59 | -------------------------------------------------------------------------------- /LogonLogoff.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Logon Reporting 4 | 5 | .DESCRIPTION 6 | This script will report the computername, username, IP address, and date/time to a central log file. 7 | 8 | .PARAMETER LogFile 9 | A description of the LogFile parameter. 10 | 11 | .NOTES 12 | =========================================================================== 13 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 14 | Created on: 10/22/2018 10:13 AM 15 | Created by: Mick Pletcher 16 | Filename: LogonReport.ps1 17 | =========================================================================== 18 | #> 19 | [CmdletBinding()] 20 | param 21 | ( 22 | [ValidateNotNullOrEmpty()] 23 | [string]$LogFile = 'LogonReport.csv' 24 | ) 25 | 26 | $Entries = @() 27 | $IPv4 = foreach ($ip in (ipconfig) -like '*IPv4*') {($ip -split ' : ')[-1]} 28 | $DT = Get-Date 29 | foreach ($IP in $IPv4) { 30 | $object = New-Object -TypeName System.Management.Automation.PSObject 31 | $object | Add-Member -MemberType NoteProperty -Name ComputerName -Value $env:COMPUTERNAME 32 | $object | Add-Member -MemberType NoteProperty -Name UserName -Value $env:USERNAME 33 | $object | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IP 34 | $object | Add-Member -MemberType NoteProperty -Name DateTime -Value (Get-Date) 35 | $object 36 | $Entries += $object 37 | } 38 | foreach ($Entry in $Entries) { 39 | Do { 40 | Try { 41 | Export-Csv -InputObject $Entry -Path $LogFile -Encoding UTF8 -NoTypeInformation -NoClobber -Append 42 | $Success = $true 43 | } Catch { 44 | $Success = $false 45 | Start-Sleep -Seconds 1 46 | } 47 | } while ($Success -eq $false) 48 | } 49 | -------------------------------------------------------------------------------- /MECMADCleanup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | ConfigMgr Cleanup 4 | 5 | .DESCRIPTION 6 | This script will compare the All Systems list in ConfigMgr to systems in AD and delete systems from ConfigMgr that are disabled in AD. It will also report a list of systems that are greater than 30 days old since the last activity in AD. 7 | 8 | .PARAMETER SQLServer 9 | A description of the SQLServer parameter. 10 | 11 | .PARAMETER SQLDatabase 12 | A description of the SQLDatabase parameter. 13 | 14 | .PARAMETER PSHCfgMgrModule 15 | Path to ConfigurationManager.psd1 module 16 | 17 | .PARAMETER Sitecode 18 | Three character ConfigMgr site code 19 | 20 | .PARAMETER SiteServer 21 | FQDN of the Configuration Manager server 22 | 23 | .PARAMETER DeleteSystems 24 | Select to automatically delete systems from Configuration Manager 25 | 26 | .NOTES 27 | =========================================================================== 28 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.208 29 | Created on: 7/26/2022 8:00 AM 30 | Created by: Mick Pletcher 31 | Filename: MECMADCleanup.ps1 32 | =========================================================================== 33 | #> 34 | [CmdletBinding()] 35 | param 36 | ( 37 | [ValidateNotNullOrEmpty()] 38 | [string]$SQLServer, 39 | [ValidateNotNullOrEmpty()] 40 | [string]$SQLDatabase, 41 | [string]$PSHCfgMgrModule, 42 | [string]$SiteCode, 43 | [string]$SiteServer, 44 | [switch]$DeleteSystems 45 | ) 46 | 47 | function Get-PSHModule { 48 | <# 49 | .SYNOPSIS 50 | Import Module 51 | 52 | .DESCRIPTION 53 | Import specified module 54 | 55 | .PARAMETER Module 56 | Name of PowerShell Module 57 | 58 | .PARAMETER NoInstall 59 | Import only. Typically used for modules that are not in the PowerShell Gallery 60 | 61 | .NOTES 62 | Additional information about the function. 63 | #> 64 | 65 | [CmdletBinding()] 66 | param 67 | ( 68 | [ValidateNotNullOrEmpty()] 69 | [string]$Module, 70 | [switch]$NoInstall 71 | ) 72 | If ($NoInstall.IsPresent) { 73 | Import-Module -Name $Module 74 | } 75 | else { 76 | Try { 77 | Import-Module -Name $Module 78 | } 79 | Catch { 80 | Find-Module -Name $Module | Install-Module -Force 81 | Import-Module -Name $Module 82 | } 83 | } 84 | } 85 | 86 | #Import SQL Server PowerShell Module 87 | Get-PSHModule -Module "SqlServer" 88 | #Import AD PowerShell module 89 | Get-PSHModule -Module "ActiveDirectory" 90 | $Systems = @() 91 | #Get All Systems list from ConfigMgr 92 | $List = Invoke-Sqlcmd -ServerInstance $SQLServer -Database $SQLDatabase -Query "SELECT NAME FROM dbo._RES_COLL_SMS00001 ORDER BY Name" 93 | foreach ($System in $List) { 94 | #Filter out built-in accounts 95 | If (($System.Name -notlike '*Unknown*') -and ($System.Name -notlike '*Provisioning*')) { 96 | #Return a list of all systems either not in AD or that have been disabled 97 | Try { 98 | $AD = Get-ADComputer $System.Name 99 | If ($AD.Enabled -eq $false) { 100 | $Systems += $AD.Name 101 | } 102 | } catch { 103 | $Systems += $System.Name 104 | } 105 | } 106 | } 107 | $Systems 108 | $Systems.Count 109 | If ($Systems.Count -ne 0) { 110 | If ($DeleteSystems.IsPresent) { 111 | #Import ConfigMgr Module 112 | Get-PSHModule -Module $PSHCfgMgrModule -NoInstall 113 | If ((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null) { 114 | New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $SiteServer 115 | } 116 | Set-Location "$($SiteCode):\" 117 | $Systems | ForEach-Object { 118 | Write-Host ('Deleting ' + $_ + '.....') -NoNewline 119 | Remove-CMDevice -Name $_ -Force 120 | If ((Get-CMDevice -Name $_) -eq $null) { 121 | Write-Host 'Success' -ForegroundColor Yellow 122 | } else { 123 | Write-Host 'Failed' -ForegroundColor Red 124 | } 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /MSPInfo.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Extract MSP information 4 | 5 | .DESCRIPTION 6 | This script will extract MSP file information from the metadata table. It has been written to be able to read data from a lot of different MSP files, including Microsoft Office updates and most application patches. There are some MSP files that were not populated with the metadata table, therefor no data is obtainable. 7 | 8 | .PARAMETER MSPFileName 9 | Name of the MSP File to call 10 | 11 | .PARAMETER MSPProperty 12 | Property to extract information 13 | 14 | .NOTES 15 | =========================================================================== 16 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.122 17 | Created on: 6/15/2016 4:07 PM 18 | Created by: Mick Pletcher 19 | Filename: MSPInfo.ps1 20 | =========================================================================== 21 | #> 22 | param 23 | ( 24 | [ValidateNotNullOrEmpty()]$MSPFileName = 'accessde-en-us.msp', 25 | [ValidateNotNullOrEmpty()]$MSPProperty = 'KBArticle Number' 26 | ) 27 | 28 | function Get-MSPFileInfo { 29 | param 30 | ( 31 | [Parameter(Mandatory = $true)][IO.FileInfo]$Path, 32 | [Parameter(Mandatory = $true)][ValidateSet('Classification', 'Description', 'DisplayName', 'KBArticle Number', 'ManufacturerName', 'ReleaseVersion', 'TargetProductName')][string]$Property 33 | ) 34 | 35 | try { 36 | #Creating windows installer object 37 | $WindowsInstaller = New-Object -ComObject WindowsInstaller.Installer 38 | #Loads the MSI database and specifies the mode to open it in by the last number on the line 39 | $MSIDatabase = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($Path.FullName, 32)) 40 | #Specifies to query the MSIPatchMetadata table and get the value associated with the designated property 41 | $Query = "SELECT Value FROM MsiPatchMetadata WHERE Property = '$($Property)'" 42 | #Open up the property view 43 | $View = $MSIDatabase.GetType().InvokeMember("OpenView", "InvokeMethod", $null, $MSIDatabase, ($Query)) 44 | $View.GetType().InvokeMember("Execute", "InvokeMethod", $null, $View, $null) 45 | #Retrieve the associate Property 46 | $Record = $View.GetType().InvokeMember("Fetch", "InvokeMethod", $null, $View, $null) 47 | #Retrieve the associated value of the retrieved property 48 | $Value = $Record.GetType().InvokeMember("StringData", "GetProperty", $null, $Record, 1) 49 | return $Value 50 | } catch { 51 | Write-Output $_.Exception.Message 52 | } 53 | } 54 | 55 | Get-MSPFileInfo -Path $MSPFileName -Property $MSPProperty 56 | -------------------------------------------------------------------------------- /MandatoryRebootCustomDetection.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Mandatory Reboot Custom Detection Method 4 | 5 | .DESCRIPTION 6 | This script will read the last time a system rebooted from the event viewer logs. It then calculates the number of days since that time. If the number of days equals or exceeds the RebootThreshold variable, the script will exit with a return code 0 and no data output. No data output is read by SCCM as a failure. If the number of days is less than the RebootThreshold, then a message is written saying the system is within the threshold and the script exits with a return code of 0. SCCM reads an error code 0 with data output as a success. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.122 11 | Created on: 6/8/2016 2:04 PM 12 | Created by: Mick Pletcher 13 | Filename: MandatoryRebootCustomDetection.ps1 14 | =========================================================================== 15 | #> 16 | 17 | #Number of days until reboot becomes mandatory 18 | $RebootThreshold = 14 19 | $Today = Get-Date 20 | #Returns "32-bit" or "64-bit" 21 | $Architecture = Get-WmiObject -Class Win32_OperatingSystem | Select-Object OSArchitecture 22 | $Architecture = $Architecture.OSArchitecture 23 | #Gets the last reboot from the event viewer logs 24 | $LastReboot = get-winevent -filterhashtable @{ logname = 'system'; ID = 1074 } -maxevents 1 -ErrorAction SilentlyContinue 25 | #Tests if the registry key Rebooted exists and creates it if it does not. It then reads if the system has been rebooted by the value being either a 0 or 1. This determines if the reboot has occurred and is set in the MandatoryReboot.ps1 file when the custom detection method triggers its execution 26 | if ($Architecture -eq "32-bit") { 27 | if ((Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Reboot") -eq $false) { 28 | New-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Reboot" | New-ItemProperty -Name Rebooted -Value 0 -Force | Out-Null 29 | } 30 | $Rebooted = Get-ItemProperty -Name Rebooted -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Reboot" 31 | } else { 32 | if ((Test-Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Reboot") -eq $false) { 33 | New-Item "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Reboot" | New-ItemProperty -Name Rebooted -Value 0 -Force | Out-Null 34 | } 35 | $Rebooted = Get-ItemProperty -Name Rebooted -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Reboot" 36 | } 37 | #Get the 0 or 1 value if a system has been rebooted within the $RebootThreshold period 38 | $Rebooted = $Rebooted.Rebooted 39 | #Calculate how long since last reboot. If no event viewer entries since last reboot, then trigger a reboot 40 | if ($LastReboot -eq $null) { 41 | $Difference = $RebootThreshold 42 | } else { 43 | $Difference = New-TimeSpan -Start $Today -End $LastReboot.TimeCreated 44 | $Difference = [math]::Abs($Difference.Days) 45 | } 46 | #The first two conditions report to SCCM that the deployment is "installed" thereby not triggering a reboot. The last two report to SCCM the app is "not installed" and trigger an install 47 | if (($Difference -lt $RebootThreshold) -and ($Rebooted -eq 0)) { 48 | Write-Host "Success" 49 | exit 0 50 | } 51 | if (($Difference -ge $RebootThreshold) -and ($Rebooted -eq 1)) { 52 | Write-Host "Success" 53 | exit 0 54 | } 55 | if (($Difference -ge $RebootThreshold) -and ($Rebooted -eq 0)) { 56 | exit 0 57 | } 58 | if (($Difference -lt $RebootThreshold) -and ($Rebooted -eq 1)) { 59 | exit 0 60 | } 61 | -------------------------------------------------------------------------------- /MaxResolution.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Get Maximum Monitor Resolution 4 | 5 | .DESCRIPTION 6 | This script will retrieve the maximum possible resolution for monitors by identifying the associated driver. The driver INF file contains the maximum defined resolution for a monitor. This script is designed for Dell monitors only. It has not been tested on any other brand. Also, the monitors need to be installed in the device manager to get the correct association. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.139 11 | Created on: 5/30/2017 12:37 PM 12 | Created by: Mick Pletcher 13 | Filename: MaxResolution.ps1 14 | =========================================================================== 15 | #> 16 | [CmdletBinding()] 17 | param () 18 | 19 | function Get-MaximumResolution { 20 | #Create monitor array 21 | $Monitors = @() 22 | #Get associate monitor hardware ID for each monitor 23 | $HardwareIDs = (Get-WmiObject Win32_PNPEntity | where-object { $_.PNPClass -eq "Monitor" }).HardwareID | ForEach-Object { $_.Split("\")[1] } 24 | foreach ($Monitor in $HardwareIDs) { 25 | #Create object 26 | $Object = New-Object -TypeName System.Management.Automation.PSObject 27 | #Get the location of the associated driver file 28 | $DriverFile = Get-ChildItem -path c:\windows\system32\driverstore -Filter *.inf -recurse | Where-Object { (Select-String -InputObject $_ -Pattern $Monitor -quiet) -eq $true } 29 | #Retrieve the maximum resolution from the INF file 30 | $MaxResolution = ((Get-Content -Path $DriverFile.FullName | Where-Object { $_ -like "*,,MaxResolution,,*" }).split('"')[1]).Split(",") 31 | #Write the Model to the object 32 | $Object | Add-Member -MemberType NoteProperty -Name Model -Value $DriverFile.BaseName.ToUpper() 33 | #Write the horizontal maximum resolution to the object 34 | $Object | Add-Member -MemberType NoteProperty -Name "Horizontal(X)" -Value $MaxResolution[0] 35 | #Write the vertical maximum resolution to the object 36 | $Object | Add-Member -MemberType NoteProperty -Name "Vertical(Y)" -Value $MaxResolution[1] 37 | #Write the object to the array 38 | $Monitors += $Object 39 | } 40 | Return $Monitors 41 | } 42 | 43 | #Display list of monitor with maximum available resolutions 44 | $Monitors = Get-MaximumResolution 45 | $Monitors 46 | -------------------------------------------------------------------------------- /Microsoft Office 2010 Deployment.mpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicksITBlogs/PowerShell/HEAD/Microsoft Office 2010 Deployment.mpt -------------------------------------------------------------------------------- /MicrosoftSpectrePatchCompatibility.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Microsoft Spectre Patch Compatibility 4 | 5 | .DESCRIPTION 6 | This script will check if KB4090007 is compatible to patch for the Spectre and Meltdown vulnerabilities. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.145 11 | Created on: 3/16/2018 6:54 AM 12 | Created by: Mick Pletcher 13 | Filename: MicrosoftSpectrePatchCompatibility.ps1 14 | =========================================================================== 15 | #> 16 | 17 | [CmdletBinding()] 18 | param () 19 | 20 | $Processor = [string]((Get-WmiObject win32_processor).Caption) 21 | $Family = ($Processor.split(" ") | Where-Object { (($_ -notlike "*Intel*") -and ($_ -notlike "*x64*") -and ($_ -notlike "*Intel64*")) })[1] 22 | $Model = ($Processor.split(" ") | Where-Object { (($_ -notlike "*Intel*") -and ($_ -notlike "x64")) })[3] 23 | $Output = "Family: " + $Family 24 | Write-Output -InputObject $Output 25 | $Output = " Model: " + $Model 26 | Write-Output -InputObject $Output 27 | If ($Family -ge 6) { 28 | If ($Model -ge 42) { 29 | Write-Output -InputObject "Patch is compatible" 30 | Exit 0 31 | } else { 32 | Write-Output -InputObject "Patch in incompatible due to old model" 33 | Exit 1 34 | } 35 | } else { 36 | Write-Output -InputObject "Patch in incompatible due to old family" 37 | Exit 1 38 | } 39 | -------------------------------------------------------------------------------- /MouseMover.ps1: -------------------------------------------------------------------------------- 1 | Add-Type -AssemblyName System.Windows.Forms 2 | 3 | # Rename Powershell Window 4 | $PowershellConsole = (Get-Host).UI.RawUI 5 | $PowershellConsole.WindowTitle = "Mouse Mover" 6 | 7 | Function BalloonTip{ 8 | [system.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | Out-Null 9 | $balloon = New-Object System.Windows.Forms.NotifyIcon 10 | $path = Get-Process -id $pid | Select-Object -ExpandProperty Path 11 | $icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path) 12 | $balloon.Icon = $icon 13 | $balloon.BalloonTipIcon = 'Info' 14 | $balloon.BalloonTipTitle = 'Secure Screen Stopper' 15 | $balloon.BalloonTipText = 'Mouse will move in 15 seconds' 16 | $balloon.Visible = $true 17 | $balloon.ShowBalloonTip(30000) 18 | Start-Sleep -Seconds 15 19 | } 20 | 21 | BalloonTip 22 | do{ 23 | $screen = [System.Windows.Forms.SystemInformation]::VirtualScreen 24 | [Windows.Forms.Cursor]::Position = "$($screen.Width*0.25),$($screen.Height*0.25)" 25 | [Windows.Forms.Cursor]::Position = "$($screen.Width*0.75),$($screen.Height*0.25)" 26 | [Windows.Forms.Cursor]::Position = "$($screen.Width*0.5),$($screen.Height*0.5)" 27 | [Windows.Forms.Cursor]::Position = "$($screen.Width*0.25),$($screen.Height*0.75)" 28 | [Windows.Forms.Cursor]::Position = "$($screen.Width*0.75),$($screen.Height*0.75)" 29 | [System.Windows.Forms.SendKeys]::SendWait("{PGDN}") 30 | Start-Sleep -Seconds 120 31 | BalloonTip 32 | } Until (1 -eq 5) 33 | -------------------------------------------------------------------------------- /MoveComputerToOU.ps1: -------------------------------------------------------------------------------- 1 | Set-Variable -Name CurrentOU -Scope Global -Force 2 | Set-Variable -Name NewOU -Scope Global -Force 3 | 4 | cls 5 | Import-Module activedirectory 6 | [string]$NewOU = "OU=BNA, OU=Computers, OU=Front Office, DC=ACME, DC=COM" 7 | $CurrentOU = get-adcomputer $env:computername 8 | Write-Host "Computer Name:"$env:computername 9 | Write-Host "Current OU:"$CurrentOU 10 | Write-Host "Target OU:"$NewOU 11 | Move-ADObject -identity $CurrentOU -TargetPath $NewOU 12 | $CurrentOU = get-adcomputer $env:computername 13 | Write-Host "New OU:"$CurrentOU 14 | -------------------------------------------------------------------------------- /MoveInstallationProgressWindow_x64.au3: -------------------------------------------------------------------------------- 1 | ;** AUTOIT3 settings 2 | #AutoIt3Wrapper_UseX64=Y ;(Y/N) Use X64 versions for AutoIt3_x64 or AUT2EXE_x64. Default=N 3 | ;** AUT2EXE settings 4 | 5 | 6 | If $CmdLine[0] = 0 Then 7 | ; Rerun ourself and let this copy return to the task sequencer 8 | Run('"' & @AutoItExe & '" rerun') 9 | Exit 10 | EndIf 11 | 12 | Sleep(2000) 13 | $WindowName = "Installation Progress" 14 | If WinExists($WindowName) Then 15 | $size = WinGetPos($WindowName) 16 | $size[1] = 0 17 | WinMove($WindowName, "", $size[0], $size[1]) 18 | EndIf 19 | -------------------------------------------------------------------------------- /MoveInstallationProgressWindow_x86.au3: -------------------------------------------------------------------------------- 1 | ;** AUTOIT3 settings 2 | #AutoIt3Wrapper_UseX64=N ;(Y/N) Use X64 versions for AutoIt3_x64 or AUT2EXE_x64. Default=N 3 | ;** AUT2EXE settings 4 | 5 | 6 | If $CmdLine[0] = 0 Then 7 | ; Rerun ourself and let this copy return to the task sequencer 8 | Run('"' & @AutoItExe & '" rerun') 9 | Exit 10 | EndIf 11 | 12 | Sleep(2000) 13 | $WindowName = "Installation Progress" 14 | If WinExists($WindowName) Then 15 | $size = WinGetPos($WindowName) 16 | $size[1] = 0 17 | WinMove($WindowName, "", $size[0], $size[1]) 18 | EndIf 19 | -------------------------------------------------------------------------------- /OnlineUpdate.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicksITBlogs/PowerShell/HEAD/OnlineUpdate.ps1 -------------------------------------------------------------------------------- /OperatingSystemDetection.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Operating System 4 | .DESCRIPTION 5 | This script will detect what operating system is installed 6 | and write a file named for that OS to the windows directory. 7 | .EXAMPLE 8 | powershell.exe -executionpolicy bypass -file OperatingSytem.ps1 9 | #> 10 | 11 | cls 12 | $OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName . 13 | Switch ($OS.Version) { 14 | 5.0.2195 {New-Item -Name "Windows 2000" -Path $env:windir -ItemType File} 15 | 5.1.2600 {New-Item -Name "Windows XP" -Path $env:windir -ItemType File} 16 | 5.2.3790 {New-Item -Name "Windows XP 64-Bit" -Path $env:windir -ItemType File} 17 | 6.0.6000 {New-Item -Name "Windows Vista" -Path $env:windir -ItemType File} 18 | 6.0.6001 {New-Item -Name "Windows Vista SP1" -Path $env:windir -ItemType File} 19 | 6.0.6002 {New-Item -Name "Windows Vista SP2" -Path $env:windir -ItemType File} 20 | 6.1.7600 {New-Item -Name "Windows 7" -Path $env:windir -ItemType File} 21 | 6.1.7601 {New-Item -Name "Windows 7 SP1" -Path $env:windir -ItemType File} 22 | 6.2.9200 {New-Item -Name "Windows 8" -Path $env:windir -ItemType File} 23 | 6.3.9600 {New-Item -Name "Windows 8.1" -Path $env:windir -ItemType File} 24 | } 25 | -------------------------------------------------------------------------------- /PPI.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Configure PPI 4 | 5 | .DESCRIPTION 6 | Configure TPM PPI settings 7 | 8 | .PARAMETER Password 9 | BIOS Password 10 | 11 | .NOTES 12 | =========================================================================== 13 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.207 14 | Created on: 6/29/2022 1:37 PM 15 | Created by: Mick Pletcher 16 | Filename: PPI.ps1 17 | =========================================================================== 18 | #> 19 | param 20 | ( 21 | [ValidateNotNullOrEmpty()] 22 | [string]$Password 23 | ) 24 | #Install Dell BIOS Provider PowerShell Module 25 | 26 | Try { 27 | Import-Module -Name DellBIOSProvider 28 | } 29 | Catch { 30 | Find-Module -Name DellBIOSProvider | Install-Module -Force 31 | Import-Module -Name DellBIOSProvider 32 | } 33 | #TPM PPI Provision Override 34 | If ("TpmPpiPo" -in (Get-ChildItem DellSmbios:\TPMSecurity\).Attribute) { 35 | Write-Host "TPM PPI Provision Override....." -NoNewline 36 | If ((Get-Item -Path DellSmbios:\TPMSecurity\TpmPpiPo).CurrentValue -ne "Enabled") { 37 | Set-Item -Path DellSMBIOS:\TPMSecurity\TpmPpiPo Enabled -Password $Password 38 | } 39 | If ((Get-Item -Path DellSmbios:\TPMSecurity\TpmPpiPo).CurrentValue -eq "Enabled") { 40 | Write-Host "Enabled" -ForegroundColor Yellow 41 | } 42 | else { 43 | Write-Host "Disabled" -ForegroundColor Red 44 | } 45 | } 46 | #TPM PPI Deprovision Override 47 | If ("TpmPpiDpo" -in (Get-ChildItem DellSmbios:\TPMSecurity\).Attribute) { 48 | Write-Host "TPM PPI Deprovision Override....." -NoNewline 49 | If ((Get-Item -Path DellSmbios:\TPMSecurity\TpmPpiDpo).CurrentValue -ne "Enabled") { 50 | Set-Item -Path DellSMBIOS:\TPMSecurity\TpmPpiDpo Enabled -Password $Password 51 | } 52 | If ((Get-Item -Path DellSmbios:\TPMSecurity\TpmPpiDpo).CurrentValue -eq "Enabled") { 53 | Write-Host "Enabled" -ForegroundColor Yellow 54 | } 55 | else { 56 | Write-Host "Disabled" -ForegroundColor Red 57 | } 58 | } 59 | #PPI Clear Override 60 | If ("TpmPpiClearOverride" -in (Get-ChildItem DellSmbios:\TPMSecurity\).Attribute) { 61 | Write-Host "TPM PPI Clear Override....." -NoNewline 62 | If ((Get-Item -Path DellSmbios:\TPMSecurity\TpmPpiClearOverride).CurrentValue -ne "Enabled") { 63 | Set-Item -Path DellSMBIOS:\TPMSecurity\TpmPpiClearOverride Enabled -Password $Password 64 | } 65 | If ((Get-Item -Path DellSmbios:\TPMSecurity\TpmPpiClearOverride).CurrentValue -eq "Enabled") { 66 | Write-Host "Enabled" -ForegroundColor Yellow 67 | } 68 | else { 69 | Write-Host "Disabled" -ForegroundColor Red 70 | } 71 | } -------------------------------------------------------------------------------- /Pause.vbs: -------------------------------------------------------------------------------- 1 | '******************************************************************************* 2 | ' Program: Sleep15.vbs 3 | ' Author: Mick Pletcher 4 | ' Date: 5 | ' Modified: 6 | ' 7 | ' Program: 8 | ' Version: 9 | ' Description: This will pause the build for 15 seconds 10 | '******************************************************************************* 11 | Option Explicit 12 | 13 | REM Prompt for User Input 14 | MsgBox "Press OK to continue",0,"Build Paused" -------------------------------------------------------------------------------- /PendingRebootReporting.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Reboot Pending Detection 4 | 5 | .DESCRIPTION 6 | This script will the four reboot pending flags to verify if a system is pending a reboot. The flags include Windows patches, component based servicing, session manager, and finally configuration manager client. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.141 11 | Created on: 7/11/2017 1:10 PM 12 | Created by: Mick Pletcher 13 | Filename: PendingRebootReporting.ps1 14 | =========================================================================== 15 | #> 16 | 17 | #Checks if the registry key RebootRequired is present. It is created when Windows Updates are applied and require a reboot to take place 18 | $PatchReboot = Get-ChildItem -Path REGISTRY::"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -ErrorAction SilentlyContinue 19 | #Checks if the RebootPending key is present. It is created when changes are made to the component store that require a reboot to take place 20 | $ComponentBasedReboot = Get-ChildItem -Path REGISTRY::"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -ErrorAction SilentlyContinue 21 | #Checks if File rename operations are taking place and require a reboot for the operation to take effect 22 | $PendingFileRenameOperations = (Get-ItemProperty -Path REGISTRY::"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager" -ErrorAction SilentlyContinue).PendingFileRenameOperations 23 | #Performs a WMI query of the configuration manager service to check if a reboot is pending 24 | $ConfigurationManagerReboot = Invoke-WmiMethod -Namespace "ROOT\ccm\ClientSDK" -Class CCM_ClientUtilities -Name DetermineIfRebootPending | select-object -ExpandProperty "RebootPending" 25 | If (($PatchReboot -eq $null) -and ($ComponentBasedReboot -eq $null) -and ($PendingFileRenameOperations -eq $null) -and ($ConfigurationManagerReboot -eq $false)) { 26 | Return $false 27 | } else { 28 | Return $true 29 | } 30 | -------------------------------------------------------------------------------- /Permissioning.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Author 3 | Mick Pletcher 4 | .SYNOPSIS 5 | Copy Permissions 6 | .DESCRIPTION 7 | This script will replication permissions for both files and folders using 8 | robocopy. Change the $SourceDrive and $DestinationDrive variables to match what 9 | you need to replicate. 10 | #> 11 | 12 | cls 13 | $Errors = 0 14 | 15 | 16 | $SourceDrive = Read-Host 'Enter source folder' 17 | $DestinationDrive = Read-Host 'Enter destination folder' 18 | 19 | #Match capitalization with directories 20 | $TempDrive = Get-Item -Path $SourceDrive 21 | $SourceDrive = $TempDrive.FullName 22 | $TempDrive = Get-Item -Path $DestinationDrive 23 | $DestinationDrive = $TempDrive.FullName 24 | 25 | $SourceFolders = Get-ChildItem $SourceDrive -Recurse | ?{ $_.PSIsContainer } 26 | $SourceFiles = Get-ChildItem $SourceDrive -Recurse -Force | where { ! $_.PSIsContainer } 27 | $DestinationFolders = Get-ChildItem $DestinationDrive -Recurse | ?{ $_.PSIsContainer } 28 | $DestinationFiles = Get-ChildItem $DestinationDrive -Recurse -Force | where { ! $_.PSIsContainer } 29 | 30 | #Copy permissions for folders 31 | $Output = robocopy $SourceDrive $DestinationDrive /ZB /E /LEV:0 /COPY:SOU /XF *.* /R:5 /W:5 32 | 33 | #Verify Folder Permissions Match 34 | Write-Host "Folders:" 35 | Write-Host "========" 36 | For ($Count=0; $Count -le $SourceFolders.Count; $Count++) { 37 | If ($SourceFolders[$Count].FullName -ne $null) { 38 | $SourceFolder = $SourceFolders[$Count].FullName 39 | $DestinationFolder = $DestinationFolders[$Count].FullName 40 | Write-Host $SourceFolder"....." -NoNewline 41 | $SourceFolderACL = Get-Acl -Path $SourceFolder 42 | $DestinationFolderACL = Get-Acl -Path $DestinationFolder 43 | For ($Count1=0; $Count1 -le $SourceFolderACL.Access.Count; $Count1++) { 44 | If ($SourceFolderACL.Access[$Count1].FileSystemRights -ne $DestinationFolderACL.Access[$Count1].FileSystemRights) { 45 | $Errors++ 46 | } 47 | } 48 | If ($Errors -eq 0) { 49 | Write-Host "Success" -ForegroundColor Yellow 50 | } else { 51 | Write-Host "Failed" -ForegroundColor Red 52 | } 53 | } 54 | $Errors = 0 55 | } 56 | 57 | $Output = robocopy $SourceDrive $DestinationDrive /ZB /E /LEV:0 /COPY:SOU /XD *.* /R:5 /W:5 58 | #Copy permissions for files 59 | Write-Host "Files:" 60 | Write-Host "======" 61 | For ($Count=0; $Count -le $SourceFiles.Count; $Count++) { 62 | If ($SourceFiles[$Count].FullName -ne $null) { 63 | $SourceFile = $SourceFiles[$Count].FullName 64 | $DestinationFile = $DestinationFiles[$Count].FullName 65 | Write-Host $SourceFile"....." -NoNewline 66 | $SourceFileACL = Get-Acl -Path $SourceFile 67 | $DestinationFileACL = Get-Acl -Path $DestinationFile 68 | For ($Count1=0; $Count1 -le $SourceFileACL.Access.Count; $Count1++) { 69 | If ($SourceFileACL.Access[$Count1].FileSystemRights -ne $DestinationFileACL.Access[$Count1].FileSystemRights) { 70 | $Errors++ 71 | } 72 | } 73 | If ($Errors -eq 0) { 74 | Write-Host "Success" -ForegroundColor Yellow 75 | } else { 76 | Write-Host "Failed" -ForegroundColor Red 77 | } 78 | } 79 | $Errors = 0 80 | } 81 | -------------------------------------------------------------------------------- /PowerShellRunAsAdmin.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\runas\command] 4 | @="\"c:\\windows\\system32\\windowspowershell\\v1.0\\powershell.exe\" -noexit \"%1\"" 5 | -------------------------------------------------------------------------------- /PowerShellSCCMConnect1.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | PowerShell SCCM Connection 4 | 5 | .DESCRIPTION 6 | This script will connect to the SCCM server and return a list of all systems in SCCM. It is a demo on how to accomplish this task. 7 | 8 | .PARAMETER SCCMModule 9 | UNC path including file name of the configuration manager module 10 | 11 | .PARAMETER SCCMServer 12 | A description of the SCCMServer parameter. 13 | 14 | .PARAMETER SCCMSiteDescription 15 | Description of the SCCM Server 16 | 17 | .PARAMETER SiteCode 18 | Three letter SCCM Site Code 19 | 20 | .PARAMETER SCCMFQDN 21 | Fully Qualified Domain Name of the SCCM server 22 | 23 | .NOTES 24 | =========================================================================== 25 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 26 | Created on: 4/24/2019 9:56 AM 27 | Created by: Mick Pletcher 28 | Filename: SCCMCleanup.ps1 29 | =========================================================================== 30 | #> 31 | [CmdletBinding()] 32 | param 33 | ( 34 | [ValidateNotNullOrEmpty()] 35 | [string]$SCCMModule = '\ConfigurationManager.psd1', 36 | [ValidateNotNullOrEmpty()] 37 | [string]$SCCMServer = '', 38 | [ValidateNotNullOrEmpty()] 39 | [string]$SCCMSiteDescription = '', 40 | [ValidateNotNullOrEmpty()] 41 | [string]$SiteCode = '' 42 | ) 43 | 44 | Import-Module -Name $SCCMModule -Force 45 | New-PSDrive -Name $SiteCode -PSProvider 'AdminUI.PS.Provider\CMSite' -Root $SCCMServer -Description $SCCMSiteDescription | Out-Null 46 | Set-Location -Path ($SiteCode + ':') 47 | $List = Get-CMCollectionMember -CollectionName 'All Systems' 48 | Remove-PSDrive -Name $SiteCode -Force 49 | Write-Output $List.Name 50 | -------------------------------------------------------------------------------- /PowerShellVerbs.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicksITBlogs/PowerShell/HEAD/PowerShellVerbs.xlsx -------------------------------------------------------------------------------- /ProfileSizeReporting.ps1: -------------------------------------------------------------------------------- 1 | #Full path and filename of the file to write the output to 2 | $File = "\ProfileSizeReport.csv" 3 | #Exclude these accounts from reporting 4 | $Exclusions = ("Administrator", "Default", "Public") 5 | #Get the list of profiles 6 | $Profiles = Get-ChildItem -Path $env:SystemDrive"\Users" | Where-Object { $_ -notin $Exclusions } 7 | #Create the object array 8 | $AllProfiles = @() 9 | #Create the custom object 10 | foreach ($Profile in $Profiles) { 11 | $object = New-Object -TypeName System.Management.Automation.PSObject 12 | #Get the size of the Documents and Desktop combined and round with no decimal places 13 | $FolderSizes = [System.Math]::Round("{0:N2}" -f ((Get-ChildItem ($Profile.FullName + '\Documents'), ($Profile.FullName + '\Desktop') -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum)) 14 | $object | Add-Member -MemberType NoteProperty -Name ComputerName -Value $env:COMPUTERNAME.ToUpper() 15 | $object | Add-Member -MemberType NoteProperty -Name Profile -Value $Profile 16 | $Object | Add-Member -MemberType NoteProperty -Name Size -Value $FolderSizes 17 | $AllProfiles += $object 18 | } 19 | #Create the formatted entry to write to the file 20 | [string]$Output = $null 21 | foreach ($Entry in $AllProfiles) { 22 | [string]$Output += $Entry.ComputerName + ',' + $Entry.Profile + ',' + $Entry.Size + [char]13 23 | } 24 | #Remove the last line break 25 | $Output = $Output.Substring(0,$Output.Length-1) 26 | #Write the output to the specified CSV file. If the file is opened by another machine, continue trying to open until successful 27 | Do { 28 | Try { 29 | $Output | Out-File -FilePath $File -Encoding UTF8 -Append -Force 30 | $Success = $true 31 | } Catch { 32 | $Success = $false 33 | } 34 | } while ($Success = $false) 35 | -------------------------------------------------------------------------------- /QueryEventViewerLogs.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Query Event Viewer Logs 4 | 5 | .DESCRIPTION 6 | This script will query the event viewer logs and write the computer name to a designated, centralized log file, thereby indicating the system met the query specifications. 7 | 8 | .PARAMETER LogFileLocation 9 | The network location of where the log file resides. 10 | 11 | .PARAMETER LogFileName 12 | The name of the centralized log file 13 | 14 | .PARAMETER EventLogName 15 | Name of the event viewer log 16 | 17 | .PARAMETER LogMessage 18 | The message to filter the log files for. 19 | 20 | .NOTES 21 | =========================================================================== 22 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.119 23 | Created on: 4/13/2016 1:54 PM 24 | Created by: Mick Pletcher 25 | Filename: OutlookLogs.ps1 26 | =========================================================================== 27 | #> 28 | [CmdletBinding()] 29 | param 30 | ( 31 | [string]$LogFileLocation, 32 | [string]$LogFileName, 33 | [string]$EventLogName, 34 | [string]$LogMessage 35 | ) 36 | 37 | #Declare Variable 38 | Set-Variable -Name Logs -Value $null -Scope Local -Force 39 | 40 | cls 41 | $ReportFile = $LogFileLocation + $LogFileName 42 | $LogMessage = [char]42 + $LogMessage + [char]42 43 | $Logs = Get-EventLog -LogName $EventLogName | where { $_.Message -like $LogMessage } 44 | If ($Logs -ne $null) { 45 | $Logs 46 | Do { 47 | Try { 48 | $Written = $true 49 | Out-File -FilePath $ReportFile -InputObject $env:COMPUTERNAME -Append -Encoding UTF8 -ErrorAction SilentlyContinue 50 | } Catch { 51 | Start-Sleep -Seconds 1 52 | $Written = $false 53 | } 54 | } while ($Written -eq $false) 55 | } 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PowerShell 2 | PowerShell scripts for Mick's IT Blogs 3 | -------------------------------------------------------------------------------- /ResetNetworkAdaptor.ps1: -------------------------------------------------------------------------------- 1 | cls 2 | #Declare Global Variables 3 | Set-Variable -Name Computer -Scope Global -Force 4 | Set-Variable -Name Active -Scope Global -Force 5 | Set-Variable -Name Network -Scope Global -Force 6 | Set-Variable -Name Networks -Scope Global -Force 7 | Set-Variable -Name Output -Scope Global -Force 8 | Set-Variable -Name RetVal -Scope Global -Force 9 | $Computer = gc env:computername 10 | $Networks = Get-WmiObject Win32_NetworkAdapter -ComputerName $Computer 11 | Foreach ($Network in $Networks) { 12 | If ($Network.NetEnabled -eq $true) { 13 | $Active = $Network 14 | Write-Host "Network Adaptor" 15 | Write-host " "$Network.Description 16 | Write-Host 17 | $RetVal = $Network.Disable() 18 | If ($RetVal.ReturnValue -eq 0) { 19 | Write-Host "Network adaptor is disabled" 20 | } 21 | Start-Sleep -Seconds 5 22 | $RetVal = $Network.Enable() 23 | If ($RetVal.ReturnValue -eq 0) { 24 | Write-Host "Network adaptor is re-enabled" 25 | } 26 | Start-Sleep -Seconds 30 27 | $Output = Test-Connection google.com -Quiet 28 | If ($Output -eq $true) { 29 | Write-Host "Network adaptor Restored" 30 | } else { 31 | Write-Host "Network adaptor unavailable" 32 | } 33 | } 34 | } 35 | Remove-Variable -Name Active -Scope Global -Force 36 | Remove-Variable -Name Computer -Scope Global -Force 37 | Remove-Variable -Name Network -Scope Global -Force 38 | Remove-Variable -Name Networks -Scope Global -Force 39 | Remove-Variable -Name Output -Scope Global -Force 40 | Remove-Variable -Name RetVal -Scope Global -Force -------------------------------------------------------------------------------- /RestartComputer.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Restart the Computer 4 | .DESCRIPTION 5 | This script creates a temporary log file to be updated by the VerifyReboot.ps1 script. It then 6 | reboots the machine. 7 | .Author 8 | Mick Pletcher 9 | .Date 10 | 03 October 2014 11 | #> 12 | 13 | #Declare Global Memory 14 | Set-Variable -Name FileName -Scope Global -Force 15 | Set-Variable -Name Log -Scope Global -Force 16 | 17 | Function DeleteLogFiles { 18 | 19 | #Declare Local Memory 20 | Set-Variable Count -Scope Local -Force 21 | Set-Variable Files -Scope Local -Force 22 | Set-Variable i -Scope Local -Force 23 | $Months = @("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") 24 | 25 | $Files = Get-ChildItem $Global:Log -Filter "*.log" 26 | $Count = $Files.Count 27 | If ($Count -ne 0) { 28 | For ($i=0; $i -le $Count; $i++) { 29 | For ($j=0; $j -le $Months.Count; $j++) { 30 | $Month = "-"+$Months[$j]+"-" 31 | $a = $Files[$i] -match $Month 32 | If ($a -eq $true) { 33 | $File = $Global:Log + "\" + $Files[$i] 34 | If (Test-Path $File) { 35 | Remove-Item -Path $File -Force 36 | } 37 | } 38 | } 39 | } 40 | } 41 | $File = $Global:Log + "\NotRebooted.log" 42 | If (Test-Path $File) { 43 | Remove-Item -Path $File -Force 44 | } 45 | 46 | #Cleanup Local Memory 47 | Remove-Variable Count -Scope Local -Force 48 | Remove-Variable Files -Scope Local -Force 49 | Remove-Variable i -Scope Local -Force 50 | } 51 | 52 | Function NewLogFile { 53 | 54 | $FileName = "NotRebooted.log" 55 | $Log = $Env:windir + "\Logs" 56 | New-Item -Path $Log -Name $FileName -ItemType File -Force 57 | 58 | } 59 | 60 | cls 61 | DeleteLogFiles 62 | NewLogFile 63 | Restart-Computer -ComputerName localhost -Force 64 | -------------------------------------------------------------------------------- /RetrieveBitlockerRecoveryKey.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2015 v4.2.92 5 | Created on: 8/25/2015 1:25 PM 6 | Created by: Mick Pletcher 7 | Filename: RetrieveBitlockerRecoveryKey.ps1 8 | =========================================================================== 9 | .DESCRIPTION 10 | This script will prompt for the computer name. It will then display the 11 | bitlocker recovery key. In order for this to work correctly, you will 12 | need to install Remote Server Administration Tools and active the 13 | following feature: Remote Server Administration Tools--> 14 | Role Administration Tools-->AD DS and AD LDS Tools--> 15 | Active Directory Module for Windows PowerShell. 16 | #> 17 | 18 | Function Get-ComputerName { 19 | #Declare Local Variables 20 | Set-Variable -Name ComputerName -Scope Local -Force 21 | 22 | $ComputerName = Read-Host "Enter the computer name" 23 | Return $ComputerName 24 | 25 | #Cleanup Local Variables 26 | Remove-Variable -Name ComputerName -Scope Local -Force 27 | } 28 | 29 | Function Get-BitlockeredRecoveryKey { 30 | param ([String]$ComputerName) 31 | 32 | #Declare Local Variables 33 | Set-Variable -Name BitLockerObjects -Scope Local -Force 34 | Set-Variable -Name BitLockerRecoveryKey -Scope Local -Force 35 | Set-Variable -Name Computer -Scope Local -Value $null -Force 36 | Set-Variable -Name System -Scope Local -Force 37 | 38 | $BitLockerObjects = Get-ADObject -Filter { objectclass -eq 'msFVE-RecoveryInformation' } 39 | foreach ($System in $BitLockerObjects) { 40 | $System = $System.DistinguishedName 41 | $System = $System.Split(',') 42 | $System = $System[1] 43 | $System = $System.Split('=') 44 | $System = $System[1] 45 | If ($System -eq $ComputerName) { 46 | $Computer = Get-ADComputer -Filter {Name -eq $System} 47 | $BitLockerRecoveryKey = Get-ADObject -Filter { objectclass -eq 'msFVE-RecoveryInformation' } -SearchBase $Computer.DistinguishedName -Properties 'msFVE-RecoveryPassword' 48 | Write-Host "Computer Name:"$System 49 | Write-Host "Bitlocker Recovery Key:"$BitLockerRecoveryKey.'msFVE-RecoveryPassword' 50 | } 51 | } 52 | If ($Computer -eq $null) { 53 | Write-Host "No recovery key exists" -ForegroundColor Red 54 | } 55 | 56 | #Cleanup Local Variables 57 | Remove-Variable -Name BitLockerObjects -Scope Local -Force 58 | Remove-Variable -Name BitLockerRecoveryKey -Scope Local -Force 59 | Remove-Variable -Name Computer -Scope Local -Force 60 | Remove-Variable -Name System -Scope Local -Force 61 | } 62 | 63 | #Declare Local Variables 64 | Set-Variable -Name SystemName -Scope Local -Force 65 | 66 | cls 67 | Import-Module ActiveDirectory -Scope Global -Force 68 | $SystemName = Get-ComputerName 69 | Get-BitlockeredRecoveryKey -ComputerName $SystemName 70 | 71 | #Cleanup Local Variables 72 | Remove-Variable -Name SystemName -Scope Local -Force 73 | -------------------------------------------------------------------------------- /SCCMBootImage.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Extract and Configure SCCM WIM Boot Image 4 | 5 | .DESCRIPTION 6 | This script will extract the WIM file from the ISO boot image generated by SCCM. It then mounts, configures, and unmounts the WIM file so it is ready to push up to WDS. 7 | 8 | .PARAMETER File 9 | Filename of the ISO, which includes the full path. 10 | 11 | .NOTES 12 | =========================================================================== 13 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 14 | Created on: 8/21/2019 12:59 PM 15 | Created by: Mick Pletcher 16 | Filename: SCCMBootImage.ps1 17 | =========================================================================== 18 | #> 19 | [CmdletBinding()] 20 | param 21 | ( 22 | [ValidateNotNullOrEmpty()] 23 | [string]$File = 'C:\WinPE\SCCM.iso' 24 | ) 25 | 26 | Import-Module Dism 27 | #Extract the name of the directory the $File resides in 28 | $Directory = $File.substring(0, $File.LastIndexOf('\')) 29 | #Mount and assign drive letter 30 | $Drive = ((Mount-DiskImage -ImagePath $File) | Get-Volume).DriveLetter 31 | #Delete old Mount directory 32 | Remove-Item -Path ($Directory + '\Mount') -Recurse -Force -ErrorAction SilentlyContinue 33 | #Create Mount folder to copy WIM contents to 34 | New-Item -Path ($Directory + '\Mount') -ItemType Directory -Force 35 | #Delete old WIM file 36 | Remove-Item -Path ($Directory + '\boot.wim') -ErrorAction SilentlyContinue -Force 37 | #Copy boot.WIM file to $Directory 38 | Copy-Item -Path ($Drive + ':\sources\boot.wim') -Destination $Directory -Force 39 | #Turn off read only 40 | Set-ItemProperty -Path ($Directory + '\boot.wim') -Name IsReadOnly -Value $false 41 | #Mount the WIM file 42 | Mount-WindowsImage -ImagePath ($Directory + '\boot.wim') -Index 1 -Path ($Directory + '\Mount') 43 | #Copy data folder to mounted image 44 | Copy-Item -Path ($Drive + ':\SMS\data') -Destination ($Directory + '\Mount\sms') -Recurse -Force 45 | #Unmount Windows Image 46 | Dismount-WindowsImage -Path ($Directory + '\Mount') -Save 47 | #Dismount disk image 48 | Dismount-DiskImage -ImagePath $File 49 | #Delete the old wim if it exists 50 | Remove-Item -Path ((Get-ChildItem -Path ($Directory + '\' + ((Get-ChildItem -path $File -ErrorAction SilentlyContinue).Basename) + '.wim')).FullName) -Force -ErrorAction SilentlyContinue 51 | #Rename boot.wim to match the basename of the ISO 52 | Rename-Item -Path ($Directory + '\boot.wim') -NewName ((Get-ChildItem -Path $File).BaseName + '.wim') -Force 53 | #Delete the Mount folder 54 | Remove-Item -Path ($Directory + '\Mount') -Recurse -Force -ErrorAction SilentlyContinue 55 | -------------------------------------------------------------------------------- /SCCMClientInstaller.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Install SCCM Client 4 | 5 | .DESCRIPTION 6 | Install the SCCM client from the client installation folder located on the SCCM server. 7 | 8 | .PARAMETER MP 9 | Management Point 10 | 11 | .PARAMETER FSP 12 | Fallback Status Point 13 | 14 | .PARAMETER SiteCode 15 | Three letter SiteCode 16 | 17 | .PARAMETER ClientPath 18 | Network location on the SCCM server where the client resides 19 | 20 | .NOTES 21 | =========================================================================== 22 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 23 | Created on: 11/21/2019 4:14 PM 24 | Created by: Mick Pletcher 25 | Filename: SCCMClientInstaller.ps1 26 | =========================================================================== 27 | #> 28 | 29 | [CmdletBinding()] 30 | param 31 | ( 32 | [ValidateNotNullOrEmpty()] 33 | [string]$MP, 34 | [ValidateNotNullOrEmpty()] 35 | [string]$FSP, 36 | [ValidateNotNullOrEmpty()] 37 | [string]$SiteCode, 38 | [ValidateNotNullOrEmpty()] 39 | [string]$ClientPath 40 | ) 41 | 42 | #Add backslash to end of $ClientPath if it does not exist 43 | If ($ClientPath.Substring($ClientPath.Length - 1) -ne '\') { 44 | $ClientPath += '\' 45 | } 46 | Write-Host 'Initiating SCCM Client Installation.....' 47 | #Execute the ccmsetup.exe file 48 | $ExitCode=(Start-Process -FilePath ($ClientPath + 'ccmsetup.exe') -ArgumentList ('/mp:' + $MP + [char]32 + 'SMSSITECODE=' + $SiteCode + [char]32 + 'FSP=' + $FSP) -PassThru -WindowStyle Minimized -Wait).ExitCode 49 | If ($ExitCode -eq 0) { 50 | Write-Host 'Waiting for installation to begin.....' 51 | $StartTime = Get-Date 52 | #Wait until the ccmsetup.exe appears in the task manager 53 | Do { 54 | $Process = (Get-Process -Name ccm*).Name 55 | $TimeSpan = New-TimeSpan -Start $StartTime -End (Get-Date) 56 | #Exit if it takes more than 300 seconds for the ccmsetup.exe to begin 57 | If ($TimeSpan.TotalSeconds -gt 300) { 58 | Exit 2 59 | } 60 | } While ($Process -notcontains 'ccmsetup') 61 | Write-Host 'Installing SCCM Client.....' -NoNewline 62 | $StartTime = Get-Date 63 | #Wait until ccmsetup.exe closes 64 | Do { 65 | $Process = (Get-Process -Name ccm*).Name 66 | $TimeSpan = New-TimeSpan -Start $StartTime -End (Get-Date) 67 | #Exit with error code 3 if the ccmsetup.exe runs longer than 600 seconds 68 | If ($TimeSpan.TotalSeconds -gt 600) { 69 | Exit 3 70 | } 71 | } While ($Process -contains 'ccmsetup') 72 | } else { 73 | Exit 1 74 | } 75 | #Exit with error code 0 if ccmexec.exe is running in the task manager, otherwise exit with an error code 4 76 | If ((Get-Process -Name CcmExec) -ne $null) { 77 | Write-Host 'SCCM Client Successfully installed' -ForegroundColor Yellow 78 | } 79 | else { 80 | Write-Host 'SCCM Client installation failed' -ForegroundColor Red 81 | Exit 4 82 | } 83 | -------------------------------------------------------------------------------- /SCCMDuplicateCleanup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | SCCM Duplicate Cleanup 4 | 5 | .DESCRIPTION 6 | This script will query for a list of machines with error 120 when trying to install the SCCM client. This error indicates the system is a duplicate. 7 | 8 | .PARAMETER SCCMModule 9 | UNC path including file name of the configuration manager module 10 | 11 | .PARAMETER SCCMServer 12 | FQDN of SCCM Server 13 | 14 | .PARAMETER SCCMSiteDescription 15 | Description of the SCCM Server 16 | 17 | .PARAMETER SiteCode 18 | Three letter SCCM Site Code 19 | 20 | .PARAMETER Collection 21 | Name of the collection to query 22 | 23 | .PARAMETER SQLServer 24 | Name of the SQL server 25 | 26 | .PARAMETER SQLDatabase 27 | A description of the SQLDatabase parameter 28 | 29 | .PARAMETER SQLInstance 30 | Name of the SQL Database 31 | 32 | .PARAMETER SCCMFQDN 33 | Fully Qualified Domain Name of the SCCM server 34 | 35 | .NOTES 36 | =========================================================================== 37 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 38 | Created on: 10/3/2019 12:04 PM 39 | Created by: Mick Pletcher 40 | Filename: SCCMDuplicateCleanup.ps1 41 | =========================================================================== 42 | #> 43 | [CmdletBinding()] 44 | param 45 | ( 46 | [ValidateNotNullOrEmpty()] 47 | [string]$SCCMModule, 48 | [ValidateNotNullOrEmpty()] 49 | [string]$SCCMServer, 50 | [ValidateNotNullOrEmpty()] 51 | [string]$SCCMSiteDescription, 52 | [ValidateNotNullOrEmpty()] 53 | [string]$SiteCode, 54 | [ValidateNotNullOrEmpty()] 55 | [string]$Collection, 56 | [ValidateNotNullOrEmpty()] 57 | [string]$SQLServer, 58 | [ValidateNotNullOrEmpty()] 59 | [string]$SQLDatabase 60 | ) 61 | 62 | $List = Invoke-Sqlcmd -ServerInstance $SQLServer -Database $SQLDatabase -Query ('SELECT Name, MachineID, CP_LastInstallationError FROM' + [char]32 + 'dbo.' + ((Invoke-Sqlcmd -ServerInstance $SQLServer -Database $SQLDatabase -Query ('Select ResultTableName FROM dbo.Collections WHERE CollectionName =' + [char]32 + [char]39 + $Collection + [char]39)).ResultTableName) + [char]32 + 'WHERE ClientVersion IS NULL AND CP_LastInstallationError = 120 Order By MachineID') 63 | If ($List -ne '') { 64 | Import-Module -Name $SCCMModule -Force 65 | New-PSDrive -Name $SiteCode -PSProvider 'AdminUI.PS.Provider\CMSite' -Root $SCCMServer -Description $SCCMSiteDescription | Out-Null 66 | Set-Location -Path ($SiteCode + ':') 67 | #Test with output to screen before enabling the other line that also deletes each item 68 | $List | ForEach-Object { (Get-CMDevice -ResourceId $_.MachineID -Fast).Name } 69 | #$List | ForEach-Object { Get-CMDevice -ResourceId $_.MachineID -Fast | Remove-CMDevice -Confirm:$false -Force } 70 | Remove-PSDrive -Name $SiteCode -Force 71 | Write-Output ($List.Name | Sort-Object) 72 | } else { 73 | Exit 1 74 | } 75 | -------------------------------------------------------------------------------- /SMARTReporting.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.207 5 | Created on: 6/29/2022 10:59 AM 6 | Created by: Mick Pletcher 7 | Organization: 8 | Filename: 9 | =========================================================================== 10 | .DESCRIPTION 11 | A description of the file. 12 | #> 13 | 14 | #Install Dell BIOS Provider PowerShell Module 15 | Try { 16 | Import-Module -Name DellBIOSProvider 17 | } 18 | Catch { 19 | Find-Module -Name DellBIOSProvider | Install-Module -Force 20 | Import-Module -Name DellBIOSProvider 21 | } 22 | #Enable SMART Reporting 23 | Write-Host "SMART Reporting....." -NoNewline 24 | If ((Get-Item -Path DellSmbios:\SecureBoot\SecureBoot).CurrentValue -ne "Enabled") { 25 | Set-Item -Path DellSMBIOS:\SecureBoot\SecureBoot Enabled 26 | } 27 | If ((Get-Item -Path DellSmbios:\SecureBoot\SecureBoot).CurrentValue -eq "Enabled") { 28 | Write-Host "Enabled" -ForegroundColor Yellow 29 | } 30 | else { 31 | Write-Host "Disabled" -ForegroundColor Red 32 | } 33 | -------------------------------------------------------------------------------- /SQLBackupVerification.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | SQL Backup Verification 4 | 5 | .DESCRIPTION 6 | This script retrieves the latest SQL database backup file and verifies its date matches the current date while also verifying the backup is good. 7 | 8 | .PARAMETER SQLBackupDir 9 | Location where the SQL backups exist 10 | 11 | .PARAMETER TimeSpan 12 | Number of days allowed since last SQL backup 13 | 14 | .PARAMETER SQLServer 15 | Name of the SQL server database to verify the backup 16 | 17 | .PARAMETER SQLDatabase 18 | Name of the SCCM SQL database the backup file is for 19 | 20 | .PARAMETER ModuleName 21 | Name of module to import 22 | 23 | .NOTES 24 | =========================================================================== 25 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 26 | Created on: 11/11/2019 4:49 PM 27 | Created by: Mick Pletcher 28 | Filename: SQLBackupVerification.ps1 29 | =========================================================================== 30 | #> 31 | [CmdletBinding()] 32 | param 33 | ( 34 | [ValidateNotNullOrEmpty()] 35 | [string]$SQLBackupDir, 36 | [ValidateNotNullOrEmpty()] 37 | $TimeSpan, 38 | [ValidateNotNullOrEmpty()] 39 | [string]$SQLServer, 40 | [ValidateNotNullOrEmpty()] 41 | [string]$SQLDatabase, 42 | [ValidateNotNullOrEmpty()] 43 | [string]$ModuleName 44 | ) 45 | 46 | #Import SQL Server PowerShell Module 47 | If ((Get-Module -Name ((Import-Module -Name $ModuleName -ErrorAction SilentlyContinue -Force -PassThru).Name)) -eq $null) { 48 | #Install module if it does not exist 49 | Install-Module -Name $ModuleName -Confirm:$false -Force 50 | #Verify module got installed. Exit the script if it failed 51 | If ((Get-Module -Name ((Import-Module -Name $ModuleName -ErrorAction SilentlyContinue -Force -PassThru).Name)) -eq $null) { 52 | Write-Host 'Failed' 53 | Exit 2 54 | } 55 | } 56 | #Retrieve file attributes from the latest SQL backup 57 | $LatestBackup = Get-ChildItem -Path $SQLBackupDir -Filter *.bak -ErrorAction SilentlyContinue | Select-Object -Last 1 58 | #Verify there is a backup file that exists 59 | If ($LatestBackup -ne $null) { 60 | #Check if the latest SQL backup is within the designated allowable timespan 61 | If ((New-TimeSpan -Start $LatestBackup.LastWriteTime -End (Get-Date)).Days -le $TimeSpan) { 62 | #Execute SQL query to verify the backup is valid 63 | $Verbose = $($Verbose = Invoke-Sqlcmd -ServerInstance $SQLServer -Database $SQLDatabase -Query ('RESTORE VERIFYONLY FROM DISK = N' + [char]39 + $LatestBackup.FullName + [char]39) -QueryTimeout 0 -Verbose) 4>&1 64 | If ($Verbose -like '*The backup set on file 1 is valid*') { 65 | Write-Output 'Success' 66 | Exit 0 67 | } else { 68 | Write-Output 'Invalid Backup' 69 | Exit 1 70 | } 71 | } else { 72 | #SQL Server did not perform a backup within the designated timespan 73 | Write-Output ('Latest Backup for' + [char]32 + $SQLDatabase + [char]32 + 'database' + [char]32 + 'on' + [char]32 + $SQLServer + [char]32 + 'has failed') 74 | Exit 1 75 | } 76 | } else { 77 | #Backups are not being performed 78 | Write-Output ('No backups available for' + [char]32 + $SQLDatabase + [char]32 + 'database' + [char]32 + 'on' + [char]32 + $SQLServer) 79 | Exit 1 80 | } 81 | -------------------------------------------------------------------------------- /ScreenResolution.au3: -------------------------------------------------------------------------------- 1 | #Region ;**** Directives created by AutoIt3Wrapper_GUI **** 2 | #AutoIt3Wrapper_Outfile=install.exe 3 | #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** 4 | ; Open Screen Resolution 5 | Run( "control desk.cpl" ) 6 | Sleep( 2000 ) 7 | ; Tab to Resolution 8 | Send( "{TAB}" ) 9 | Sleep( 250 ) 10 | Send( "{TAB}" ) 11 | Sleep( 250 ) 12 | ; Open Resolution Drop Down 13 | Send( "{Enter}" ) 14 | Sleep( 250 ) 15 | ; Move Resolution Up to max. You may need to add more up arrows. 16 | Send( "{UP}" ) 17 | Sleep( 250 ) 18 | Send( "{UP}" ) 19 | Sleep( 250 ) 20 | Send( "{UP}" ) 21 | Sleep( 250 ) 22 | Send( "{UP}" ) 23 | Sleep( 250 ) 24 | Send( "{UP}" ) 25 | Sleep( 250 ) 26 | Send( "{UP}" ) 27 | Sleep( 250 ) 28 | Send( "{UP}" ) 29 | Sleep( 250 ) 30 | Send( "{UP}" ) 31 | Sleep( 250 ) 32 | Send( "{UP}" ) 33 | Sleep( 250 ) 34 | Send( "{UP}" ) 35 | Sleep( 250 ) 36 | ; Accept resolution 37 | Send( "{Enter}" ) 38 | Sleep( 250 ) 39 | ; Move to OK button 40 | Send( "{TAB}" ) 41 | Sleep( 250 ) 42 | Send( "{TAB}" ) 43 | Sleep( 250 ) 44 | Send( "{TAB}" ) 45 | Sleep( 250 ) 46 | Send( "{TAB}" ) 47 | Sleep( 250 ) 48 | Send( "{TAB}" ) 49 | Sleep( 250 ) 50 | ; Apply New Resolution 51 | Send( "{Enter}" ) 52 | Sleep( 5000 ) 53 | ; Accept New Resolution 54 | Send( "k" ) 55 | -------------------------------------------------------------------------------- /SecureBoot.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Secure Boot 4 | 5 | .DESCRIPTION 6 | Enable Secure Boot 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.207 11 | Created on: 6/29/2022 8:32 AM 12 | Created by: Mick Pletcher 13 | Filename: SecureBoot.ps1 14 | =========================================================================== 15 | #> 16 | 17 | #Install Dell BIOS Provider PowerShell Module 18 | Try { 19 | Import-Module -Name DellBIOSProvider 20 | } 21 | Catch { 22 | Find-Module -Name DellBIOSProvider | Install-Module -Force 23 | Import-Module -Name DellBIOSProvider 24 | } 25 | #Secure Boot Enable 26 | Write-Host "Secure Boot....." -NoNewline 27 | If ((Get-Item -Path DellSmbios:\SecureBoot\SecureBoot).CurrentValue -ne "Enabled") { 28 | Set-Item -Path DellSMBIOS:\SecureBoot\SecureBoot Enabled 29 | } 30 | If ((Get-Item -Path DellSmbios:\SecureBoot\SecureBoot).CurrentValue -eq "Enabled") { 31 | Write-Host "Enabled" -ForegroundColor Yellow 32 | } else { 33 | Write-Host "Disabled" -ForegroundColor Red 34 | } 35 | -------------------------------------------------------------------------------- /SecureScreenStopper.EXE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicksITBlogs/PowerShell/HEAD/SecureScreenStopper.EXE -------------------------------------------------------------------------------- /SecureScreenStopper.ps1: -------------------------------------------------------------------------------- 1 | Clear-Host 2 | Add-Type -AssemblyName System.Windows.Forms 3 | 4 | # Rename Powershell Window 5 | $PowershellConsole = (Get-Host).UI.RawUI 6 | $PowershellConsole.WindowTitle = "Secure Screen Stopper" 7 | 8 | 9 | #Declare Variable 10 | $button = $null 11 | $Global:MainProcess 12 | $Global:RelativePath 13 | $Global:MMProcess 14 | 15 | Function GetRelativePath{ 16 | $Global:RelativePath=(split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\" 17 | Write-Host $Global:RelativePath 18 | } 19 | 20 | Function KillProcesses{ 21 | $Running = Get-Process -Name conhost -ErrorAction SilentlyContinue 22 | If($Running -ne $null){ 23 | Stop-Process -Name conhost -Force 24 | } 25 | $Running = Get-Process -Name powershell -ErrorAction SilentlyContinue 26 | If($Running -ne $null){ 27 | Stop-Process -Name powershell -Force 28 | } 29 | } 30 | 31 | GetRelativePath 32 | $a = "-WindowStyle Minimized -File"+[char]32+[char]34+$Global:RelativePath+"MouseMover.ps1"+[char]34 33 | Write-Host $a 34 | Start-Process powershell.exe $a 35 | $button = [system.windows.forms.messagebox]::show("Click OK to reinstate secure screen saver!") 36 | #Start-Sleep -Seconds 10 37 | KillProcesses 38 | -------------------------------------------------------------------------------- /SetDellBIOSPassword.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Set Dell BIOS Password 4 | 5 | .DESCRIPTION 6 | Sets the BIOS Password 7 | 8 | .PARAMETER Password 9 | BIOS Password 10 | 11 | .NOTES 12 | =========================================================================== 13 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.207 14 | Created on: 6/29/2022 8:24 AM 15 | Created by: Mick Pletcher 16 | Filename: SetDellBIOSPassword.ps1 17 | =========================================================================== 18 | #> 19 | param 20 | ( 21 | [ValidateNotNullOrEmpty()] 22 | [string]$Password 23 | ) 24 | #Install Dell BIOS Provider PowerShell Module 25 | Try { 26 | Import-Module -Name DellBIOSProvider 27 | } Catch { 28 | Find-Module -Name DellBIOSProvider | Install-Module -Force 29 | Import-Module -Name DellBIOSProvider 30 | } 31 | #Set BIOS Password 32 | Write-Host "Clearing BIOS Password....." -NoNewline 33 | If ((Get-Item -Path DellSmbios:\Security\IsAdminPasswordSet).CurrentValue -eq $false) { 34 | Set-Item DellSmbios:\Security\AdminPassword $Password 35 | } 36 | If ((Get-Item -Path DellSmbios:\Security\IsAdminPasswordSet).CurrentValue -eq $true) { 37 | Write-Host "Success" -ForegroundColor Yellow 38 | } else { 39 | Write-Host "Failed" -ForegroundColor Red 40 | Exit 1 41 | } -------------------------------------------------------------------------------- /TrustedSitesReport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Trusted Sites Report 4 | 5 | .DESCRIPTION 6 | This script will retrieve a list of trusted sites pushed out via GPO and write the list to a text file in the same directory as the script. 7 | 8 | .PARAMETER FileOutput 9 | Specifies to write output to a file 10 | 11 | .PARAMETER FileName 12 | Name of the file to write the output to 13 | 14 | .NOTES 15 | =========================================================================== 16 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.143 17 | Created on: 10/3/2017 2:23 PM 18 | Created by: Mick Pletcher 19 | Filename: TrustedSitesReport.ps1 20 | =========================================================================== 21 | #> 22 | [CmdletBinding()] 23 | param 24 | ( 25 | [switch]$FileOutput, 26 | [ValidateNotNullOrEmpty()][string]$FileName = 'TrustedSitesReport.txt' 27 | ) 28 | 29 | function Get-RelativePath { 30 | <# 31 | .SYNOPSIS 32 | Get the relative path 33 | 34 | .DESCRIPTION 35 | Returns the location of the currently running PowerShell script 36 | 37 | .NOTES 38 | Additional information about the function. 39 | #> 40 | 41 | [CmdletBinding()][OutputType([string])] 42 | param () 43 | 44 | $Path = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent) + "\" 45 | Return $Path 46 | } 47 | 48 | #User based trusted sites 49 | $HKCU = $(get-item "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey" -ErrorAction SilentlyContinue).property | Sort-Object 50 | #Local machines based trusted sites 51 | $HKLM = $(get-item "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey" -ErrorAction SilentlyContinue).property | Sort-Object 52 | #Get the location where this script is being executed from 53 | $RelativePath = Get-RelativePath 54 | #Define the path to the output file 55 | $File = $RelativePath + "TrustedSitesReport.txt" 56 | #Delete the output file if it exists 57 | If ((Test-Path $File) -eq $true) { 58 | Remove-Item -Path $File -Force 59 | } 60 | #Create output file 61 | New-Item -Path $File -ItemType File -Force 62 | #Add HKCU trusted sites to the output file if they exist 63 | If ($HKCU -ne $null) { 64 | #Create Screen Header 65 | "HKEY_CURRENT_USERS" | Out-File -FilePath $File -Append 66 | #Display to the screen 67 | $HKCU 68 | If ($FileOutput.IsPresent) { 69 | $HKCU | Out-File -FilePath $File -Append 70 | } 71 | #Input seperator" 72 | " "| Out-File -FilePath $File -Append 73 | } 74 | #Add HKLM trusted sites to the output file if they exist 75 | If ($HKLM -ne $null) { 76 | #Create Screen Header 77 | "HKEY_LOCAL_MACHINE" | Out-File -FilePath $File -Append 78 | #Display to the screen 79 | $HKLM 80 | If ($FileOutput.IsPresent) { 81 | $HKLM | Out-File -FilePath $File -Append 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /TurnOnTPM.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Turn On TPM 4 | 5 | .DESCRIPTION 6 | Turn on the TPM 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.207 11 | Created on: 6/29/2022 10:16 AM 12 | Created by: Mick Pletcher 13 | Filename: TurnOnTPM.ps1 14 | =========================================================================== 15 | #> 16 | 17 | #Install Dell BIOS Provider PowerShell Module 18 | Try { 19 | Import-Module -Name DellBIOSProvider 20 | } 21 | Catch { 22 | Find-Module -Name DellBIOSProvider | Install-Module -Force 23 | Import-Module -Name DellBIOSProvider 24 | } 25 | #TPM On 26 | Write-Host "TPM....." -NoNewline 27 | If ((Get-Item -Path DellSmbios:\TPMSecurity\TpmSecurity).CurrentValue -ne "Enabled") { 28 | Set-Item -Path DellSMBIOS:\TPMSecurity\TpmSecurity Enabled 29 | } 30 | If ((Get-Item -Path DellSmbios:\TPMSecurity\TpmSecurity).CurrentValue -eq "Enabled") { 31 | Write-Host "On" -ForegroundColor Yellow 32 | } 33 | else { 34 | Write-Host "Off" -ForegroundColor Red 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /Uninstall-InnoSetup.ps1: -------------------------------------------------------------------------------- 1 | function Uninstall-InnoSetup { 2 | <# 3 | .SYNOPSIS 4 | Uninstall Inno Installed Application 5 | 6 | .DESCRIPTION 7 | This function uninstalls an application that was installed using the Inno installer. 8 | 9 | .PARAMETER AppName 10 | Exact name as shown in Add/Remove Programs 11 | #> 12 | 13 | [CmdletBinding()] 14 | param 15 | ( 16 | [ValidateNotNullOrEmpty()][string]$AppName 17 | ) 18 | 19 | $QuietUninstallString = ((Get-ChildItem -Path "REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\","REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" | ForEach-Object { Get-ItemProperty REGISTRY::$_ } | Where-Object { $_.DisplayName -eq $AppName }).QuietUninstallString).split("/") 20 | $Switches = "/" + $QuietUninstallString[1].Trim() 21 | Write-Host "Uninstall"$AppName"....." -NoNewline 22 | $ErrCode = (Start-Process -FilePath $QuietUninstallString[0].Trim() -ArgumentList $Switches -Wait -Passthru).ExitCode 23 | If (($ErrCode -eq 0) -or ($ErrCode -eq 3010)) { 24 | Write-Host "Success" -ForegroundColor Yellow 25 | } elseif ($ErrCode -eq 1605) { 26 | Write-Host "Not Present" -ForegroundColor Green 27 | } else { 28 | Write-Host "Failed with Error Code:"$ErrCode 29 | Exit $ErrCode 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /UninstallCS3.vbs: -------------------------------------------------------------------------------- 1 | '******************************************************************************* 2 | ' Author: Mick Pletcher 3 | ' Date: 02 November 2012 4 | ' Modified: 5 | ' 6 | ' Program: Adobe CS3 Uninstaller 7 | ' Version: 8 | ' Description: This will uninstall Design Standard CS3 9 | '******************************************************************************* 10 | Option Explicit 11 | 12 | REM Define Global Variables 13 | DIM RelativePath : Set RelativePath = Nothing 14 | 15 | REM Define the relative installation path 16 | DefineRelativePath() 17 | REM Install 18 | Uninstall() 19 | REM Cleanup Global Variables 20 | GlobalVariableCleanup() 21 | 22 | '******************************************************************************* 23 | '******************************************************************************* 24 | 25 | Sub DefineRelativePath() 26 | 27 | REM Get File Name with full relative path 28 | RelativePath = WScript.ScriptFullName 29 | REM Remove file name, leaving relative path only 30 | RelativePath = Left(RelativePath, InStrRev(RelativePath, "\")) 31 | 32 | End Sub 33 | 34 | '******************************************************************************* 35 | 36 | Sub Uninstall() 37 | 38 | REM Define Local Objects 39 | DIM oShell : SET oShell = CreateObject("Wscript.Shell") 40 | 41 | REM Define Local Variables 42 | DIM Uninstall : Uninstall = RelativePath & "setup.exe" & Chr(32) & "--mode=silent --deploymentFile=" &_ 43 | RelativePath & "deployment\uninstall.xml --skipProcessCheck=1" 44 | 45 | oShell.Run Uninstall, 1, True 46 | 47 | REM Cleanup Local Variables 48 | Set Uninstall = Nothing 49 | Set oShell = Nothing 50 | 51 | End Sub 52 | 53 | '******************************************************************************* 54 | 55 | Sub GlobalVariableCleanup() 56 | 57 | Set RelativePath = Nothing 58 | 59 | End Sub -------------------------------------------------------------------------------- /UninstallChrome.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Uninstall Google Chrome 4 | 5 | .DESCRIPTION 6 | Uninstall Google Chrome 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.145 11 | Created on: 2/16/2018 11:02 AM 12 | Created by: Mick Pletcher 13 | Filename: UninstallChrome.ps1 14 | =========================================================================== 15 | #> 16 | [CmdletBinding()] 17 | param () 18 | 19 | function Uninstall-MSIByName { 20 | <# 21 | .SYNOPSIS 22 | Uninstall-MSIByName 23 | 24 | .DESCRIPTION 25 | Uninstalls an MSI application using the MSI file 26 | 27 | .PARAMETER ApplicationName 28 | Display Name of the application. This can be part of the name or all of it. By using the full name as displayed in Add/Remove programs, there is far less chance the function will find more than one instance. 29 | 30 | .PARAMETER Switches 31 | MSI switches to control the behavior of msiexec.exe when uninstalling the application. 32 | 33 | .EXAMPLE 34 | Uninstall-MSIByName "Adobe Reader" "/qb- /norestart" 35 | 36 | .NOTES 37 | Additional information about the function. 38 | #> 39 | 40 | [CmdletBinding()] 41 | param 42 | ( 43 | [ValidateNotNullOrEmpty()][String]$ApplicationName, 44 | [ValidateNotNullOrEmpty()][String]$Switches 45 | ) 46 | 47 | #MSIEXEC.EXE 48 | $Executable = $Env:windir + "\system32\msiexec.exe" 49 | #Get list of all Add/Remove Programs for 32-Bit and 64-Bit 50 | $Uninstall = Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall -Recurse -ErrorAction SilentlyContinue 51 | If (((Get-WmiObject -Class Win32_OperatingSystem | Select-Object OSArchitecture).OSArchitecture) -eq "64-Bit") { 52 | $Uninstall += Get-ChildItem HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall -Recurse -ErrorAction SilentlyContinue 53 | } 54 | #Find the registry containing the application name specified in $ApplicationName 55 | $Key = $uninstall | foreach-object { Get-ItemProperty REGISTRY::$_ } | where-object { $_.DisplayName -like "*$ApplicationName*" } 56 | If ($Key -ne $null) { 57 | Write-Host "Uninstall"$Key.DisplayName"....." -NoNewline 58 | #Define msiexec.exe parameters to use with the uninstall 59 | $Parameters = "/x " + $Key.PSChildName + [char]32 + $Switches 60 | #Execute the uninstall of the MSI 61 | $ErrCode = (Start-Process -FilePath $Executable -ArgumentList $Parameters -Wait -Passthru).ExitCode 62 | #Return the success/failure to the display 63 | If (($ErrCode -eq 0) -or ($ErrCode -eq 3010) -or ($ErrCode -eq 1605)) { 64 | Write-Host "Success" -ForegroundColor Yellow 65 | } else { 66 | Write-Host "Failed with error code "$ErrCode -ForegroundColor Red 67 | } 68 | } 69 | } 70 | 71 | Uninstall-MSIByName -ApplicationName "Google Chrome" -Switches "/qb- /norestart" 72 | -------------------------------------------------------------------------------- /UninstallFlash.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Uninstall Adobe Flash 4 | 5 | .DESCRIPTION 6 | Uninstall Flash player 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.145 11 | Created on: 2/16/2018 11:02 AM 12 | Created by: Mick Pletcher 13 | Filename: UninstallFlash.ps1 14 | =========================================================================== 15 | #> 16 | 17 | [CmdletBinding()] 18 | param () 19 | 20 | function Uninstall-MSIByName { 21 | <# 22 | .SYNOPSIS 23 | Uninstall-MSIByName 24 | 25 | .DESCRIPTION 26 | Uninstalls an MSI application using the MSI file 27 | 28 | .PARAMETER ApplicationName 29 | Display Name of the application. This can be part of the name or all of it. By using the full name as displayed in Add/Remove programs, there is far less chance the function will find more than one instance. 30 | 31 | .PARAMETER Switches 32 | MSI switches to control the behavior of msiexec.exe when uninstalling the application. 33 | 34 | .EXAMPLE 35 | Uninstall-MSIByName "Adobe Reader" "/qb- /norestart" 36 | 37 | .NOTES 38 | Additional information about the function. 39 | #> 40 | 41 | [CmdletBinding()] 42 | param 43 | ( 44 | [ValidateNotNullOrEmpty()][String]$ApplicationName, 45 | [ValidateNotNullOrEmpty()][String]$Switches 46 | ) 47 | 48 | #MSIEXEC.EXE 49 | $Executable = $Env:windir + "\system32\msiexec.exe" 50 | #Get list of all Add/Remove Programs for 32-Bit and 64-Bit 51 | $Uninstall = Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall -Recurse -ErrorAction SilentlyContinue 52 | If (((Get-WmiObject -Class Win32_OperatingSystem | Select-Object OSArchitecture).OSArchitecture) -eq "64-Bit") { 53 | $Uninstall += Get-ChildItem HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall -Recurse -ErrorAction SilentlyContinue 54 | } 55 | #Find the registry containing the application name specified in $ApplicationName 56 | $Key = $uninstall | foreach-object { Get-ItemProperty REGISTRY::$_ } | where-object { $_.DisplayName -like "*$ApplicationName*" } 57 | If ($Key -ne $null) { 58 | Write-Host "Uninstall"$Key.DisplayName"....." -NoNewline 59 | #Define msiexec.exe parameters to use with the uninstall 60 | $Parameters = "/x " + $Key.PSChildName + [char]32 + $Switches 61 | #Execute the uninstall of the MSI 62 | $ErrCode = (Start-Process -FilePath $Executable -ArgumentList $Parameters -Wait -Passthru).ExitCode 63 | #Return the success/failure to the display 64 | If (($ErrCode -eq 0) -or ($ErrCode -eq 3010) -or ($ErrCode -eq 1605)) { 65 | Write-Host "Success" -ForegroundColor Yellow 66 | } else { 67 | Write-Host "Failed with error code "$ErrCode -ForegroundColor Red 68 | } 69 | } 70 | } 71 | 72 | Uninstall-MSIByName -ApplicationName "Adobe Flash Player 14 ActiveX" -Switches "/qb- /norestart" 73 | Uninstall-MSIByName -ApplicationName "Adobe Flash Player 14 Plugin" -Switches "/qb- /norestart" 74 | Uninstall-MSIByName -ApplicationName "Adobe Flash Player 18 ActiveX" -Switches "/qb- /norestart" 75 | Uninstall-MSIByName -ApplicationName "Adobe Flash Player 18 Plugin" -Switches "/qb- /norestart" 76 | -------------------------------------------------------------------------------- /UninstallJava.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Install Oracle Java 4 | 5 | .DESCRIPTION 6 | Uninstall the old version of Java and then install the new version. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.145 11 | Created on: 2/20/2018 10:53 AM 12 | Created by: Mick Pletcher 13 | Filename: InstallJava.ps1 14 | =========================================================================== 15 | #> 16 | [CmdletBinding()] 17 | param () 18 | 19 | function Uninstall-MSIByName { 20 | <# 21 | .SYNOPSIS 22 | Uninstall-MSIByName 23 | 24 | .DESCRIPTION 25 | Uninstalls an MSI application using the MSI file 26 | 27 | .PARAMETER ApplicationName 28 | Display Name of the application. This can be part of the name or all of it. By using the full name as displayed in Add/Remove programs, there is far less chance the function will find more than one instance. 29 | 30 | .PARAMETER Switches 31 | MSI switches to control the behavior of msiexec.exe when uninstalling the application. 32 | #> 33 | 34 | [CmdletBinding()] 35 | param 36 | ( 37 | [ValidateNotNullOrEmpty()][String]$ApplicationName, 38 | [ValidateNotNullOrEmpty()][String]$Switches 39 | ) 40 | 41 | #MSIEXEC.EXE 42 | $Executable = $Env:windir + "\system32\msiexec.exe" 43 | Do { 44 | #Get list of all Add/Remove Programs for 32-Bit and 64-Bit 45 | $Uninstall = Get-ChildItem REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall -Recurse -ErrorAction SilentlyContinue -Force 46 | $Uninstall += Get-ChildItem REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall -Recurse -ErrorAction SilentlyContinue 47 | #Find the registry containing the application name specified in $ApplicationName 48 | $Key = $uninstall | foreach-object { Get-ItemProperty REGISTRY::$_ -ErrorAction SilentlyContinue} | where-object { $_.DisplayName -like "*$ApplicationName*" } 49 | If ($Key -ne $null) { 50 | Write-Host "Uninstall"$Key[0].DisplayName"....." -NoNewline 51 | #Define msiexec.exe parameters to use with the uninstall 52 | $Parameters = "/x " + $Key[0].PSChildName + [char]32 + $Switches 53 | #Execute the uninstall of the MSI 54 | $ErrCode = (Start-Process -FilePath $Executable -ArgumentList $Parameters -Wait -Passthru).ExitCode 55 | #Return the success/failure to the display 56 | If (($ErrCode -eq 0) -or ($ErrCode -eq 3010) -or ($ErrCode -eq 1605)) { 57 | Write-Host "Success" -ForegroundColor Yellow 58 | } else { 59 | Write-Host "Failed with error code "$ErrCode -ForegroundColor Red 60 | } 61 | } 62 | } While ($Key -ne $null) 63 | } 64 | 65 | #Uninstall previous version(s) of Java 66 | Uninstall-MSIByName -ApplicationName "Java 6" -Switches "/qb- /norestart" 67 | Uninstall-MSIByName -ApplicationName "Java 7" -Switches "/qb- /norestart" 68 | Uninstall-MSIByName -ApplicationName "Java 8" -Switches "/qb- /norestart" 69 | -------------------------------------------------------------------------------- /UninstallMSIByName.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Uninstall MSI Application by its Name 4 | 5 | .DESCRIPTION 6 | Here is a function that will uninstall an MSI installed application by the name of the app. You do not need to input the entire name either. For instance, say you are uninstalling all previous versions of Adobe Reader. Adobe Reader is always labeled Adobe Reader X, Adobe Reader XI, and so forth. This script allows you to do this without having to find out every version that is installed throughout a network and then enter an uninstaller line for each version. You just need to enter Adobe Reader as the application name and the desired switches. It will then search the name fields in the 32 and 64 bit uninstall registry keys to find the associated GUID. Finally, it will execute an msiexec.exe /x {GUID} to uninstall that version. This revision allows for the function to uninstall more than one app if multiple versions are installed. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.145 11 | Created on: 2/21/2018 1:20 PM 12 | Created by: Mick Pletcher 13 | Filename: UninstallMSIByName.ps1 14 | =========================================================================== 15 | #> 16 | 17 | [CmdletBinding()] 18 | param () 19 | 20 | function Uninstall-MSIByName { 21 | <# 22 | .SYNOPSIS 23 | Uninstall-MSIByName 24 | 25 | .DESCRIPTION 26 | Uninstalls an MSI application using the MSI file 27 | 28 | .PARAMETER ApplicationName 29 | Display Name of the application. This can be part of the name or all of it. By using the full name as displayed in Add/Remove programs, there is far less chance the function will find more than one instance. 30 | 31 | .PARAMETER Switches 32 | MSI switches to control the behavior of msiexec.exe when uninstalling the application. 33 | #> 34 | 35 | [CmdletBinding()] 36 | param 37 | ( 38 | [ValidateNotNullOrEmpty()][String]$ApplicationName, 39 | [ValidateNotNullOrEmpty()][String]$Switches 40 | ) 41 | 42 | #MSIEXEC.EXE 43 | $Executable = $Env:windir + "\system32\msiexec.exe" 44 | Do { 45 | #Get list of all Add/Remove Programs for 32-Bit and 64-Bit 46 | $Uninstall = Get-ChildItem REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall -Recurse -ErrorAction SilentlyContinue -Force 47 | $Uninstall += Get-ChildItem REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall -Recurse -ErrorAction SilentlyContinue 48 | #Find the registry containing the application name specified in $ApplicationName 49 | $Key = $uninstall | foreach-object { Get-ItemProperty REGISTRY::$_ -ErrorAction SilentlyContinue} | where-object { $_.DisplayName -like "*$ApplicationName*" } 50 | If ($Key -ne $null) { 51 | Write-Host "Uninstall"$Key[0].DisplayName"....." -NoNewline 52 | #Define msiexec.exe parameters to use with the uninstall 53 | $Parameters = "/x " + $Key[0].PSChildName + [char]32 + $Switches 54 | #Execute the uninstall of the MSI 55 | $ErrCode = (Start-Process -FilePath $Executable -ArgumentList $Parameters -Wait -Passthru).ExitCode 56 | #Return the success/failure to the display 57 | If (($ErrCode -eq 0) -or ($ErrCode -eq 3010) -or ($ErrCode -eq 1605)) { 58 | Write-Host "Success" -ForegroundColor Yellow 59 | } else { 60 | Write-Host "Failed with error code "$ErrCode -ForegroundColor Red 61 | } 62 | } 63 | } While ($Key -ne $null) 64 | } 65 | 66 | #Example where there might be both x86 and x64 versions of Java installed and you need both uninstalled 67 | Uninstall-MSIByName -ApplicationName "Java 8" -Switches "/qb- /norestart" 68 | -------------------------------------------------------------------------------- /UninstallMSIbyGUID.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Uninstall MSI by GUID 4 | 5 | .DESCRIPTION 6 | Uninstall an MSI installed application by specifying its GUID 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.145 11 | Created on: 2/23/2018 11:58 AM 12 | Created by: Mick Pletcher 13 | Filename: UninstallMSIbyGUID.ps1 14 | =========================================================================== 15 | #> 16 | 17 | [CmdletBinding()] 18 | param () 19 | 20 | function Uninstall-MSIbyGUID { 21 | <# 22 | .SYNOPSIS 23 | Uninstall-MSIByGUID 24 | 25 | .DESCRIPTION 26 | Uninstalls an MSI application using the GUID 27 | 28 | .PARAMETER GUID 29 | Associated GUID with the application 30 | 31 | .PARAMETER Switches 32 | MSI switches 33 | #> 34 | 35 | [CmdletBinding()] 36 | param 37 | ( 38 | [ValidateNotNullOrEmpty()][String]$GUID, 39 | [ValidateNotNullOrEmpty()][String]$Switches 40 | ) 41 | 42 | [string]$DisplayName = ((Get-ChildItem -Path REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products).Name | Foreach-object { Get-ChildItem REGISTRY::$_ } | ForEach-Object { If ($_ -like "*InstallProperties*") { Get-ItemProperty -path REGISTRY::$_ } } | Where-Object { $_.UninstallString -like "*" + $GUID + "*" }).DisplayName 43 | If (($DisplayName -ne "") -and ($DisplayName -ne $null)) { 44 | $Executable = $Env:windir + "\system32\msiexec.exe" 45 | $Parameters = "/x" + [char]32 + $GUID + [char]32 + $Switches 46 | Write-Host "Uninstall"$DisplayName.Trim()"....." -NoNewline 47 | $ErrCode = (Start-Process -FilePath $Executable -ArgumentList $Parameters -Wait -Passthru).ExitCode 48 | If (($ErrCode -eq 0) -or ($ErrCode -eq 3010)) { 49 | Write-Host "Success" -ForegroundColor Yellow 50 | } elseIf ($ErrCode -eq 1605) { 51 | Write-Host "Not Present" -ForegroundColor Green 52 | } else { 53 | Write-Host "Failed with error code "$ErrCode -ForegroundColor Red 54 | Exit $ErrCode 55 | } 56 | } 57 | } 58 | 59 | #Java 8 Update 161 Example 60 | Uninstall-MSIbyGUID -GUID "{26A24AE4-039D-4CA4-87B4-2F32180161F0}" -Switches "/qb- /norestart" 61 | -------------------------------------------------------------------------------- /UninstallPrinters.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Uninstall Printers 4 | .DESCRIPTION 5 | This script will uninstall all printers for a user 6 | .PARAMETER 7 | 8 | .EXAMPLE 9 | powershell.exe -executionpolicy bypass -file UninstallPrinters.ps1 10 | #> 11 | 12 | cls 13 | $Printers = Get-WmiObject Win32_Printer 14 | $EXE = $env:windir + "\system32\printui.exe" 15 | $PrintUI = "/dn /n " 16 | Foreach ($Printer in $Printers) { 17 | If ($Printer.ShareName -ne $null) { 18 | Write-Host "Uninstall"$Printer.ShareName"....." -NoNewline 19 | $Parameters = $PrintUI + [char]34+ $Printer.Name + [char]34 20 | $ErrCode = (Start-Process -FilePath $EXE -ArgumentList $Parameters -Wait -Passthru).ExitCode 21 | If ($ErrCode -eq 0) { 22 | Write-Host "Success" -ForegroundColor Yellow 23 | } else { 24 | Write-Host "Failed" -ForegroundColor Red 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /UninstallReader.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Uninstall Reader 4 | 5 | .DESCRIPTION 6 | Uninstall all versions of Adobe Reader 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.145 11 | Created on: 2/19/2018 9:21 AM 12 | Created by: Mick Pletcher 13 | Filename: UninstallReader.ps1 14 | =========================================================================== 15 | #> 16 | [CmdletBinding()] 17 | param () 18 | 19 | function Uninstall-MSIByName { 20 | <# 21 | .SYNOPSIS 22 | Uninstall-MSIByName 23 | 24 | .DESCRIPTION 25 | Uninstalls an MSI application using the MSI file 26 | 27 | .PARAMETER ApplicationName 28 | Display Name of the application. This can be part of the name or all of it. By using the full name as displayed in Add/Remove programs, there is far less chance the function will find more than one instance. 29 | 30 | .PARAMETER Switches 31 | MSI switches to control the behavior of msiexec.exe when uninstalling the application. 32 | 33 | .EXAMPLE 34 | Uninstall-MSIByName "Adobe Reader" "/qb- /norestart" 35 | 36 | .NOTES 37 | Additional information about the function. 38 | #> 39 | 40 | [CmdletBinding()] 41 | param 42 | ( 43 | [ValidateNotNullOrEmpty()][String]$ApplicationName, 44 | [ValidateNotNullOrEmpty()][String]$Switches 45 | ) 46 | 47 | #MSIEXEC.EXE 48 | $Executable = $Env:windir + "\system32\msiexec.exe" 49 | #Get list of all Add/Remove Programs for 32-Bit and 64-Bit 50 | $Uninstall = Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall -Recurse -ErrorAction SilentlyContinue 51 | If (((Get-WmiObject -Class Win32_OperatingSystem | Select-Object OSArchitecture).OSArchitecture) -eq "64-Bit") { 52 | $Uninstall += Get-ChildItem HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall -Recurse -ErrorAction SilentlyContinue 53 | } 54 | #Find the registry containing the application name specified in $ApplicationName 55 | $Key = $uninstall | foreach-object { Get-ItemProperty REGISTRY::$_ } | where-object { $_.DisplayName -like "*$ApplicationName*" } 56 | If ($Key -ne $null) { 57 | Write-Host "Uninstall"$Key.DisplayName"....." -NoNewline 58 | #Define msiexec.exe parameters to use with the uninstall 59 | $Parameters = "/x " + $Key.PSChildName + [char]32 + $Switches 60 | #Execute the uninstall of the MSI 61 | $ErrCode = (Start-Process -FilePath $Executable -ArgumentList $Parameters -Wait -Passthru).ExitCode 62 | #Return the success/failure to the display 63 | If (($ErrCode -eq 0) -or ($ErrCode -eq 3010) -or ($ErrCode -eq 1605)) { 64 | Write-Host "Success" -ForegroundColor Yellow 65 | } else { 66 | Write-Host "Failed with error code "$ErrCode -ForegroundColor Red 67 | } 68 | } 69 | } 70 | 71 | Uninstall-MSIByName -ApplicationName "Adobe Acrobat" -Switches "/qb- /norestart" 72 | Uninstall-MSIByName -ApplicationName "Adobe Reader" -Switches "/qb- /norestart" 73 | -------------------------------------------------------------------------------- /UnmountWIM.vbs: -------------------------------------------------------------------------------- 1 | '******************************************************************************* 2 | ' Program: UnmountWIM.vbs 3 | ' Author: Mick Pletcher 4 | ' Date: 22 February 2010 5 | ' Modified: 6 | ' 7 | ' Description: This script will unmount the current mounted WIM file. 8 | ' 1) Define Relative Path 9 | ' 2) Select the WIM file 10 | ' 3) Mount the WIM file 11 | ' 4) Cleanup Global Variables 12 | '******************************************************************************* 13 | Option Explicit 14 | 15 | REM Define Global Variables 16 | DIM RelativePath : Set RelativePath = Nothing 17 | 18 | DefineRelativePath() 19 | UnmountWIM() 20 | ImageUnmounted() 21 | GlobalVariableCleanup() 22 | 23 | '******************************************************************************* 24 | 25 | Sub DefineRelativePath() 26 | 27 | REM Get File Name with full relative path 28 | RelativePath = WScript.ScriptFullName 29 | REM Remove file name, leaving relative path only 30 | RelativePath = Left(RelativePath, InStrRev(RelativePath, "\")) 31 | 32 | End Sub 33 | 34 | '******************************************************************************* 35 | 36 | Sub UnmountWIM() 37 | 38 | REM Define Local Objects 39 | DIM oShell : SET oShell = CreateObject("Wscript.Shell") 40 | 41 | REM Define Local Variables 42 | ' DIM Unmount : Unmount = Chr(34) & "C:\Program Files\Windows AIK\Tools\x86\imagex.exe" & Chr(34) & " /unmount mount /commit" 43 | DIM MountDIR : MountDIR = Chr(32) & "/MountDir:" & RelativePath & "Mount" 44 | DIM Parameters : Parameters = Chr(32) & "/commit" 45 | DIM Unmount : Unmount = "DISM /Unmount-WIM" & MountDIR & Parameters 46 | 47 | oShell.Run Unmount, 1, True 48 | 49 | REM Cleanup Local Variables 50 | Set MountDIR = Nothing 51 | Set oShell = Nothing 52 | Set Parameters = Nothing 53 | Set Unmount = Nothing 54 | 55 | End Sub 56 | 57 | '******************************************************************************* 58 | 59 | Sub ImageUnmounted() 60 | 61 | REM Define Local Objects 62 | DIM FSO : Set FSO = CreateObject("Scripting.FileSystemObject") 63 | 64 | If NOT FSO.FolderExists(RelativePath & "Mount\Windows") Then 65 | MsgBox("Image is unmounted") 66 | Else 67 | MsgBox("Image failed to unmount") 68 | End If 69 | 70 | REM Cleanup Local Objects 71 | Set FSO = Nothing 72 | 73 | End Sub 74 | 75 | '******************************************************************************* 76 | 77 | Sub GlobalVariableCleanup() 78 | 79 | Set RelativePath = Nothing 80 | 81 | End Sub 82 | -------------------------------------------------------------------------------- /UpdateList.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Produce list of newly installed windows updates 4 | .DESCRIPTION 5 | Reads BDD.log file from a build and extracts the list of new updates 6 | that were applied. 7 | .Author 8 | Mick Pletcher 9 | .Date 10 | 12 February 2015 11 | .EXAMPLE 12 | powershell.exe -executionpolicy bypass -file UpdateList.ps1 13 | #> 14 | 15 | cls 16 | $File = Get-Content -Path "C:\Users\Mick\Desktop\BDD.log" -Force 17 | Foreach ($Entry in $File) { 18 | If (($Entry -like '*INSTALL - *') -and ($Entry -like '*ZTIWindowsUpdate*')) { 19 | #Write-Host $Entry 20 | $SplitLine = $Entry.Split('KB') 21 | $Update = $SplitLine[2] 22 | $Update = $Update.Split(')') 23 | $Update = $Update.Split('(') 24 | Write-Host "KB"$Update[0] 25 | } 26 | } 27 | 28 | Remove-Variable -Name Entry -Force 29 | Remove-Variable -Name File -Force 30 | Remove-Variable -Name Update -Force -------------------------------------------------------------------------------- /UpdateWIM.ps1: -------------------------------------------------------------------------------- 1 | Clear-Host 2 | $Global:MountPath 3 | $Global:RelativePath 4 | $Global:WimFile 5 | $Global:UpdatesPath 6 | 7 | Function GetRelativePath{ 8 | $Global:RelativePath=(split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\" 9 | Write-Host $Global:RelativePath 10 | } 11 | 12 | Function GetWimFile{ 13 | 14 | $FileName = Get-ChildItem $Global:RelativePath | Where-Object {($_.Name -like "*.wim")} 15 | $Global:WimFile = $Global:RelativePath+$FileName 16 | Write-Host $Global:WimFile 17 | 18 | } 19 | 20 | Function MountWIM{ 21 | 22 | $Global:MountPath = $Global:RelativePath+"Mount\" 23 | If ((Test-Path $Global:MountPath) -ne $true){ 24 | New-Item -ItemType directory -Path $Global:RelativePath"Mount" 25 | } 26 | Write-Host $Global:MountPath 27 | $Arguments = "dism.exe /mount-wim /wimfile:"+$Global:WimFile+[char]32+"/index:1 /mountdir:"+$Global:MountPath 28 | Write-Host $Arguments 29 | Invoke-Expression -Command $Arguments 30 | 31 | } 32 | 33 | Function UnmountWIM{ 34 | 35 | $Arguments = "dism.exe /unmount-wim /mountdir:"+$Global:MountPath+[char]32+"/commit" 36 | Write-Host $Arguments 37 | Invoke-Expression -Command $Arguments 38 | 39 | } 40 | 41 | Function CleanupWIM{ 42 | 43 | $Arguments = "dism.exe /cleanup-wim" 44 | Write-Host $Arguments 45 | Invoke-Expression -Command $Arguments 46 | 47 | } 48 | 49 | Function GlobalMemoryCleanup{ 50 | 51 | Clear-Variable -Name MountPath -Scope Global -Force 52 | Clear-Variable -Name WimFile -Scope Global -Force 53 | Clear-Variable -Name UpdatesPath -Scope Global -Force 54 | Clear-Variable -Name RelativePath -Scope Global -Force 55 | Remove-Variable -Name MountPath -Scope Global -Force 56 | Remove-Variable -Name WimFile -Scope Global -Force 57 | Remove-Variable -Name UpdatesPath -Scope Global -Force 58 | Remove-Variable -Name RelativePath -Scope Global -Force 59 | 60 | } 61 | 62 | GetRelativePath 63 | GetWimFile 64 | MountWIM 65 | $Global:UpdatesPath = $Global:RelativePath+"*.msu" 66 | $UpdatesArray = Get-Item $Global:UpdatesPath 67 | ForEach ($Updates in $UpdatesArray) { 68 | $Arguments = "dism.exe /image:"+$Global:MountPath+[char]32+"/Add-Package /PackagePath:"+$Updates 69 | Write-Host $Arguments 70 | Invoke-Expression -Command $Arguments 71 | Start-Sleep -Seconds 10 72 | } 73 | UnmountWIM 74 | CleanupWIM 75 | Clear-Variable -Name Arguments -Scope Local -Force 76 | Clear-Variable -Name Updates -Scope Local -Force 77 | Clear-Variable -Name UpdatesArray -Scope Local -Force 78 | Remove-Variable -Name Arguments -Scope Local -Force 79 | Remove-Variable -Name Updates -Scope Local -Force 80 | Remove-Variable -Name UpdatesArray -Scope Local -Force 81 | GlobalMemoryCleanup 82 | -------------------------------------------------------------------------------- /VerifyBuild.ps1: -------------------------------------------------------------------------------- 1 | #******************************************************************************* 2 | # Author: Mick Pletcher 3 | # Date: 25 November 2013 4 | # 5 | # Program: Check Build 6 | #******************************************************************************* 7 | 8 | Clear-Host 9 | 10 | #Declare Global Memory 11 | $app = ,@() 12 | Set-Variable -Name Count -Scope Global -Value 1 -Force 13 | Set-Variable -Name OS -Scope Global -Force 14 | Set-Variable -Name RelativePath -Scope Global -Force 15 | 16 | Function RenameWindow ($Title) { 17 | 18 | #Declare Local Memory 19 | Set-Variable -Name a -Scope Local -Force 20 | 21 | $a = (Get-Host).UI.RawUI 22 | $a.WindowTitle = $Title 23 | 24 | #Cleanup Local Memory 25 | Remove-Variable -Name a -Scope Local -Force 26 | } 27 | 28 | Function AppInstalled($Description) { 29 | 30 | #Declare Local Memory 31 | Set-Variable -Name AppName -Scope Local -Force 32 | Set-Variable -Name AppLocal -Scope Local -Force 33 | Set-Variable -Name Desc -Scope Local -Force 34 | Set-Variable -Name Output -Scope Local -Force 35 | 36 | $object = New-Object -TypeName PSObject 37 | #Change '%application%' to whatever app you are calling 38 | $Desc = [char]34+"description like"+[char]32+[char]39+[char]37+$Description+[char]37+[char]39+[char]34 39 | $Output = wmic product where $Desc get Description 40 | $Output | ForEach-Object { 41 | $_ = $_.Trim() 42 | if(($_ -ne "Description")-and($_ -ne "")){ 43 | $AppName = $_ 44 | } 45 | } 46 | $AppLocal = New-Object System.Object 47 | $AppLocal | Add-Member -type NoteProperty -name Application -value $Description 48 | If ($AppName -ne $null) { 49 | #$Global:app+=,@($Description,"Installed") 50 | $AppLocal | Add-Member -type NoteProperty -name Status -value "Installed" 51 | 52 | } else { 53 | #$Global:app+=,@($Description,"Not Installed") 54 | $AppLocal | Add-Member -type NoteProperty -name Status -value "Not Installed" 55 | } 56 | $Global:app += $AppLocal 57 | $AppLocal | Select Application 58 | $Global:Count++ 59 | 60 | #Cleanup Local Memory 61 | Remove-Variable -Name AppName -Scope Local -Force 62 | Remove-Variable -Name AppLocal -Scope Local -Force 63 | Remove-Variable -Name Desc -Scope Local -Force 64 | Remove-Variable -Name Output -Scope Local -Force 65 | 66 | } 67 | 68 | cls 69 | Write-Host "Processing Applications" 70 | Write-Host 71 | RenameWindow "Check Build Installs" 72 | AppInstalled "Dell Client System Update" 73 | AppInstalled "Adobe Reader" 74 | AppInstalled "Microsoft Lync" 75 | AppInstalled "Remote Desktop" 76 | AppInstalled "Interactive Admin" 77 | AppInstalled "RunAs Admin" 78 | AppInstalled "Windows Backup" 79 | cls 80 | Write-Host "Installation Report" 81 | Write-Host 82 | $app | Format-Table 83 | 84 | #Cleanup Global Memory 85 | $app.Clear() 86 | Remove-Variable -Name Count -Scope Global -Force 87 | Remove-Variable -Name OS -Scope Global -Force 88 | Remove-Variable -Name RelativePath -Scope Global -Force 89 | -------------------------------------------------------------------------------- /VerifyGUID.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicksITBlogs/PowerShell/HEAD/VerifyGUID.ps1 -------------------------------------------------------------------------------- /VerifyReboot.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Verify Reboot Occurred 4 | .DESCRIPTION 5 | This script verifies the reboot occurred by searching for the file NotRebooted.log 6 | and renaming it to Rebooted--dd-MMM-YYYY.log. 7 | .PARAMETER 8 | 9 | .EXAMPLE 10 | 11 | #> 12 | 13 | #Declare Variables 14 | Set-Variable -Name Now -Force 15 | Set-Variable -Name Log -Force 16 | 17 | $Log = $Env:windir + "\Logs" 18 | $File = $Log + "\" + "NotRebooted.log" 19 | If (Test-Path $File) { 20 | $Now = Get-Date -Format "dd-MMM-yyyy" 21 | $Now = $Now + ".log" 22 | If (Test-Path -Path $File) { 23 | Remove-Item $File -Force 24 | $File = $Log + "\Rebooted---" + $Now 25 | New-Item $File -ItemType File -Force 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /VerifyWindowsFeature.ps1: -------------------------------------------------------------------------------- 1 | cls 2 | 3 | #Declare Global Memory 4 | Set-Variable -Name a -Scope Global -Force 5 | Set-Variable -Name Output -Scope Global -Force 6 | 7 | Function AddRemovePrograms($KeyName, $DisplayName, $Version){ 8 | #Declare Local Memory 9 | Set-Variable -Name AddRemKey -Value "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" -Scope Local -Force 10 | 11 | New-Item -Path $AddRemKey -Name $KeyName –Force 12 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name DisplayName -Value $DisplayName -PropertyType String 13 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name DisplayVersion -Value $Version -PropertyType String 14 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name UninstallString -Value " " -PropertyType String 15 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name Publisher -Value "Gresham, Smith and Partners" -PropertyType String 16 | New-ItemProperty -Path $AddRemKey"\"$KeyName -Name DisplayIcon -Value "c:\windows\GSPBox_Icon.bmp" -PropertyType String 17 | 18 | #Cleanup Local Memory 19 | Remove-Variable -Name AddRemKey -Scope Local -Force 20 | } 21 | Invoke-Command {dism.exe /online /disable-feature /featurename:MediaCenter /norestart} 22 | $a = Invoke-Command {dism.exe /online /get-featureinfo /featurename:MediaCenter} 23 | $Output = $a | Select-String "State : Disabled" 24 | Write-Host $Output 25 | If ($Output -like "State : Disabled"){ 26 | AddRemovePrograms "MediaCenter" "MediaCenter" "Disabled" 27 | } 28 | 29 | #Cleanup Global Memory 30 | Remove-Variable -Name a -Scope Global -Force 31 | Remove-Variable -Name Output -Scope Global -Force -------------------------------------------------------------------------------- /WakeOnLAN.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Set Wake-On-LAN 4 | 5 | .DESCRIPTION 6 | Set the Wake-on-LAN BIOS Setting 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.207 11 | Created on: 6/29/2022 8:26 AM 12 | Created by: Mick Pletcher 13 | Filename: WakeOnLAN.ps1 14 | =========================================================================== 15 | #> 16 | 17 | #Install Dell BIOS Provider PowerShell Module 18 | Try { 19 | Import-Module -Name DellBIOSProvider 20 | } 21 | Catch { 22 | Find-Module -Name DellBIOSProvider | Install-Module -Force 23 | Import-Module -Name DellBIOSProvider 24 | } 25 | #Wake on LAN/WLAN 26 | #Set-Item -Path DellSMBIOS:\PowerManagement\WakeOnLan LanWlan 27 | Write-Host "Wake-On-LAN....." -NoNewline 28 | If ((Get-Item -Path DellSmbios:\PowerManagement\WakeOnLan).CurrentValue -ne 'LanOnly') 29 | { 30 | Set-Item -Path DellSMBIOS:\PowerManagement\WakeOnLan -Value 'LanOnly' 31 | } 32 | If ((Get-Item -Path DellSmbios:\PowerManagement\WakeOnLan).CurrentValue -eq 'LanOnly') 33 | { 34 | Write-Host "Enabled" -ForegroundColor Yellow 35 | } 36 | else 37 | { 38 | Write-Host "Disabled" -ForegroundColor Red 39 | } 40 | -------------------------------------------------------------------------------- /WhosLoggedOn.ps1: -------------------------------------------------------------------------------- 1 | #******************************************************************************* 2 | # Author: Mick Pletcher 3 | # Date: 23 August 2013 4 | # 5 | # Program: Who's Logged On and Logged Off? 6 | #******************************************************************************* 7 | 8 | 9 | #Declare Global Variables 10 | Set-Variable -Name Command -Scope Global -Force 11 | Set-Variable -Name Computer -Scope Global -Force 12 | Set-Variable -Name Computers -Scope Global -Force 13 | Set-Variable -Name i -Scope Global -Value 1 -Force 14 | Set-Variable -Name Output -Scope Global -Force 15 | Set-Variable -Name RelativePath -Scope Global -Force 16 | Set-Variable -Name Results -Scope Global -Force 17 | Set-Variable -Name Username -Scope Global -Force 18 | 19 | Function RenameWindow ($Title) { 20 | 21 | #Declare Local Memory 22 | Set-Variable -Name a -Scope Local -Force 23 | 24 | $a = (Get-Host).UI.RawUI 25 | $a.WindowTitle = $Title 26 | 27 | #Cleanup Local Memory 28 | Remove-Variable -Name a -Scope Local -Force 29 | } 30 | 31 | Function GetRelativePath{ 32 | $Global:RelativePath=(split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\" 33 | } 34 | 35 | cls 36 | RenameWindow "Who's Logged On and Logged Off?" 37 | GetRelativePath 38 | $Results = @() 39 | $Username = @() 40 | $Computers = Get-Content -Path $Global:RelativePath"Computers.txt" 41 | $Size = $Computers.Length 42 | Foreach ($Computer in $Computers) { 43 | Write-Host "Scanning System "$i" of "$Size 44 | Write-Host 45 | Write-Host "System:"$Computer 46 | $Command = $Global:RelativePath+"PsLoggedon.exe -x -l \\$Computer" 47 | $Output = Invoke-Expression $Command 48 | If ($Output.SyncRoot[2] -eq "Users logged on locally:") { 49 | $Username += $Output.SyncRoot[3].Trim() 50 | } else { 51 | $Username += "N/A" 52 | } 53 | $Output = $Output.SyncRoot[2] 54 | $Output = $Output.Substring(0,$Output.Length-1) 55 | $Results += $Output 56 | $i = $i + 1 57 | cls 58 | } 59 | cls 60 | for ($i=0 ; $i -lt $Results.length ; $i++) { 61 | If ($Results[$i] -eq "No one is logged on locally") { 62 | Write-Host $Computers[$i]": "$Results[$i] -BackgroundColor Yellow -ForegroundColor Black 63 | } elseIf ($Results[$i] -eq "Users logged on locally") { 64 | Write-Host $Computers[$i]": "$Results[$i]" -- "$Username[$i]-ForegroundColor White 65 | } else { 66 | Write-Host $Computers[$i]": "$Results[$i]" -- "$Username[$i]-ForegroundColor Red 67 | } 68 | } 69 | 70 | #Cleanup Global Variables 71 | Remove-Variable -Name Command -Scope Global -Force 72 | Remove-Variable -Name Computer -Scope Global -Force 73 | Remove-Variable -Name Computers -Scope Global -Force 74 | Remove-Variable -Name i -Scope Global -Force 75 | Remove-Variable -Name Output -Scope Global -Force 76 | Remove-Variable -Name RelativePath -Scope Global -Force 77 | Remove-Variable -Name Results -Scope Global -Force 78 | Remove-Variable -Name Username -Scope Global -Force 79 | 80 | -------------------------------------------------------------------------------- /Windows10AppDeprovisioning.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Deprovision Specified Windows 10 Apps 4 | 5 | .DESCRIPTION 6 | This script will add the appropriate registry keys to deprovision the built-in Windows 10 applications specified in the associated text file, or hardcoded in the script. 7 | 8 | .PARAMETER AppListFile 9 | File containing list of Windows 10 files to deprovision 10 | 11 | .NOTES 12 | =========================================================================== 13 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 14 | Created on: 9/15/2020 9:56 AM 15 | Created by: Mick Pletcher 16 | Filename: Windows10AppDeprovisioning.ps1 17 | =========================================================================== 18 | #> 19 | 20 | [CmdletBinding()] 21 | 22 | param 23 | ( 24 | [string]$AppListFile 25 | ) 26 | 27 | #Get list of Windows 10 Applications to uninstall from text file 28 | $Applications = Get-Content -Path $AppListFile 29 | #Deprovisioned Registry Key 30 | $RegKey = 'REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deprovisioned' 31 | #Create deprovisioned registry key if it does not exist 32 | If (!(Test-Path $RegKey)) { 33 | New-Item -Path $RegKey -Force | Out-Null 34 | } 35 | #Add list of Apps from the imported text file to the deprovisioned registry key 36 | foreach ($App in $Applications) { 37 | #Install registry key if it does not exist 38 | If (!(Test-Path ($RegKey + '\' + $App))) { 39 | New-Item -Path ($RegKey + '\' + $App) -Force | Out-Null 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ZTIBIOS.vbs: -------------------------------------------------------------------------------- 1 | REM *************************************************************************** 2 | REM *** Program: ZTIBIOS.vbs 3 | REM *** Author: Mick Pletcher 4 | REM *** Created: 12 April 2012 5 | REM *** Edited: 6 | REM *** 7 | REM *** Description: This script will retrieve the information required for 8 | REM *** populating the ZTIBIOSCheck.xml fields, located in 9 | REM *** c:\deploymentshare\scripts\ of the MDT server. It's 10 | REM *** output is stored in a file in the same directory as the 11 | REM *** script with the filename of the computer model.txt. This 12 | REM *** was done to accomodate using this script with SMS/SCCM on 13 | REM *** multiple models of machines to differentiate the outputs. 14 | REM *** This text file contains all of the necessary 15 | REM *** fields required for populating the information for a 16 | REM *** new system. There is a template field at the top of 17 | REM *** the xml file that you can copy and populate with the 18 | REM *** output data from this script. It is suggested that you 19 | REM *** update the BIOS to the latest version first before 20 | REM *** running this script, as that will update the information 21 | REM *** acquired by this script. 22 | REM *************************************************************************** 23 | Option Explicit 24 | 25 | REM Define Objects 26 | DIM FSO : Set FSO = CreateObject("Scripting.FileSystemObject") 27 | DIM objFile : Set objFile = Nothing 28 | DIM objHotfixFile : Set objHotfixFile = Nothing 29 | 30 | REM Define Variables 31 | DIM BIOS : Set BIOS = Nothing 32 | DIM Computer : Set Computer = Nothing 33 | 34 | For each Computer in GetObject("winmgmts:\\.\root\cimv2").InstancesOf("Win32_ComputerSystemProduct") 35 | For each BIOS in GetObject("winmgmts:\\.\root\cimv2").InstancesOf("Win32_BIOS") 36 | Set objFile = FSO.CreateTextFile(Trim(Computer.Name) & ".txt", True) 37 | Set objHotfixFile = FSO.OpenTextFile(Trim(Computer.Name) & ".txt", 1,True) 38 | objFile.WriteLine("Lookup Name:" & Chr(32) & Chr(60) & BIOS.Description & Chr(62)) 39 | objFile.WriteLine("Computer Manufacturer:" & Chr(32) & Chr(60) & Computer.Vendor & Chr(62)) 40 | objFile.WriteLine("Model:" & Chr(32) & Chr(60) & Computer.Name & Chr(62)) 41 | objFile.WriteLine("Date:" & Chr(32) & Chr(60) & BIOS.ReleaseDate & Chr(62)) 42 | next 43 | next 44 | 45 | objFile.Close 46 | 47 | REM Cleanup 48 | Set FSO = Nothing 49 | Set objFile = Nothing 50 | Set objHotfixFile = Nothing 51 | Set BIOS = Nothing 52 | Set Computer = Nothing 53 | -------------------------------------------------------------------------------- /ZTIConditionalReboot.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Zero Touch Conditional Reboot 4 | 5 | .DESCRIPTION 6 | This script will check four flags on the system to see if a reboot is required. If one of the flags is tripped, then this script will initiate a reboot in MDT so that will come back up and start at the proceeding task. I have included the commented out SMSTSRetryRequested in the script so if you want to incorporate the code from this script into another one that will need to be rerun again once the reboot completes. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 11 | Created on: 7/12/2019 2:53 PM 12 | Created by: Mick Pletcher 13 | Organization: Waller Lansden Dortch & Davis, LLP. 14 | Filename: ZTIConditionalReboot.ps1 15 | =========================================================================== 16 | #> 17 | [CmdletBinding()] 18 | param () 19 | 20 | function Enable-Reboot { 21 | <# 22 | .SYNOPSIS 23 | Request MDT Reboot 24 | 25 | .DESCRIPTION 26 | A detailed description of the Enable-Reboot function. 27 | #> 28 | 29 | [CmdletBinding()] 30 | param () 31 | 32 | $TaskSequence = New-Object -ComObject Microsoft.SMS.TSEnvironment 33 | #Reboot the machine this command line task sequence finishes 34 | $TaskSequence.Value('SMSTSRebootRequested') = $true 35 | #Rerun this task when the reboot finishes 36 | #$TaskSequence.Value('SMSTSRetryRequested') = $true 37 | } 38 | 39 | #Component Based Reboot 40 | If ((Get-ChildItem "REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -ErrorAction SilentlyContinue) -ne $null) { 41 | Enable-Reboot 42 | #Windows Update Reboot 43 | } elseif ((Get-Item -Path "REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -ErrorAction SilentlyContinue) -ne $null) { 44 | Enable-Reboot 45 | #Pending Files Rename Reboot 46 | } elseif ((Get-ItemProperty -Path "REGISTRY::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager" -Name PendingFileRenameOperations -ErrorAction SilentlyContinue) -ne $null) { 47 | Enable-Reboot 48 | #Pending SCCM Reboot 49 | } elseif ((([wmiclass]"\\.\root\ccm\clientsdk:CCM_ClientUtilities").DetermineIfRebootPending().RebootPending) -eq $true) { 50 | Enable-Reboot 51 | } else { 52 | Exit 0 53 | } 54 | -------------------------------------------------------------------------------- /ZTIDellDriverUpdate.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Dell Driver Update 4 | 5 | .DESCRIPTION 6 | This script executes the Dell Command | Update and reboots MDT or SCCM up to five times when new updates are available. The reason for the 5 reboot limit is because some Dell updates have been know to not leave markers and will cause the Dell Command | Update to rerun indefinitely. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 11 | Created on: 7/18/2019 1:57 PM 12 | Created by: Mick Pletcher 13 | Filename: ZTIDellDriverUpdate.ps1 14 | =========================================================================== 15 | #> 16 | [CmdletBinding()] 17 | param () 18 | 19 | #Verify Dell Command | Update exists 20 | If ((Test-Path -Path (Get-ChildItem -Path $env:ProgramFiles, ${env:ProgramFiles(x86)} -filter dcu-cli.exe -Recurse -ErrorAction SilentlyContinue).FullName) -eq $true) { 21 | #Delete old logs if they exist 22 | Remove-Item -Path ($env:windir + '\temp\ActivityLog.xml') -ErrorAction SilentlyContinue -Force 23 | Remove-Item -Path ($env:windir + '\temp\inventory.xml') -ErrorAction SilentlyContinue -Force 24 | #Update the system with the latest drivers while also writing log files to the %windir%\temp directory 25 | $ErrCode = (Start-Process -FilePath ((Get-ChildItem -Path $env:ProgramFiles, ${env:ProgramFiles(x86)} -Filter 'dcu-cli.exe' -Recurse).FullName) -ArgumentList ('/log ' + $env:windir + '\temp') -Wait).ExitCode 26 | #Read the ActivityLog.xml file 27 | $File = (Get-Content -Path ($env:windir + '\temp\ActivityLog.xml')).Trim() 28 | #if no updates were found or updates were applied and no required reboot is necessary, then delete the log files 29 | If (('CLI: No application component updates found.' -in $File) -and (('CLI: No available updates can be installed.' -in $File) -or ('CLI: No updates are available.' -in $File))) 30 | { 31 | Remove-Item -Path ($env:windir + '\temp\ActivityLog.xml') -ErrorAction SilentlyContinue -Force 32 | Remove-Item -Path ($env:windir + '\temp\inventory.xml') -ErrorAction SilentlyContinue -Force 33 | Remove-Item -Path ($env:TEMP + '\RebootCount.log') -ErrorAction SilentlyContinue -Force 34 | } 35 | else 36 | { 37 | #Create the file containing number of times this script has rerun if it does not exist 38 | If ((Test-Path ($env:TEMP + '\RebootCount.log')) -eq $false) 39 | { 40 | New-Item -Path ($env:TEMP + '\RebootCount.log') -ItemType File -Value 0 -Force 41 | } 42 | #Reboot the machine and rerun the Dell Driver Updates 43 | If (([int](Get-Content -Path ($env:TEMP + '\RebootCount.log'))) -lt 5) 44 | { 45 | #Microsoft SCCM/MDT environmental variables 46 | $TSEnv = New-Object -ComObject Microsoft.SMS.TSEnvironment 47 | #Reboot the machine once this task is completed and restart the task sequence 48 | $TSEnv.Value('SMSTSRebootRequested') = $true 49 | #Rerun the same task 50 | $TSEnv.Value('SMSTSRetryRequested') = $true 51 | #increment the reboot counter 52 | New-Item -Path ($env:TEMP + '\RebootCount.log') -ItemType File -Value ([int](Get-Content -Path ($env:TEMP + '\RebootCount.log')) + 1) -Force 53 | #End the update process if run 5 or more times, delete all associated log files, and proceed to the next task 54 | } 55 | else 56 | { 57 | Remove-Item -Path ($env:windir + '\temp\ActivityLog.xml') -ErrorAction SilentlyContinue -Force 58 | Remove-Item -Path ($env:windir + '\temp\inventory.xml') -ErrorAction SilentlyContinue -Force 59 | Remove-Item -Path ($env:TEMP + '\RebootCount.log') -ErrorAction SilentlyContinue -Force 60 | } 61 | } 62 | } 63 | else { 64 | Write-Output 'Dell Command | Update is not installed' 65 | Exit 1 66 | } -------------------------------------------------------------------------------- /ZertoUnprotectedSystems.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Unprotected Systems Report 4 | 5 | .DESCRIPTION 6 | This script will retrieve a list of systems from the Zerto server that are not being backed up. Desktop operating systems and systems not in AD are excluded, as Zerto is typically used for server backup. 7 | 8 | .NOTES 9 | =========================================================================== 10 | Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142 11 | Created on: 5/19/2020 5:24 PM 12 | Created by: Mick Pletcher 13 | Filename: ZertoUnprotectedSystems.ps1 14 | =========================================================================== 15 | #> 16 | [CmdletBinding()] 17 | param () 18 | 19 | Import-Module -Name zertoapiwrapper 20 | Import-Module -Name activedirectory 21 | $Cred = New-Object System.Management.Automation.PSCredential ("domain\username", $password) 22 | Connect-ZertoServer -zertoServer prodzerto.wallerlaw.int -credential $Cred 23 | $List = (Get-ZertoUnprotectedVm).VmName | Sort-Object 24 | $UnprotectedServers = @() 25 | Foreach ($System in $List) { 26 | Try { 27 | $ADComputer = Get-ADComputer $System -Properties OperatingSystem 28 | If (($ADComputer.OperatingSystem -notlike '*Windows 7 Enterprise') -and ($ADComputer.OperatingSystem -notlike '*Windows 10 Enterprise')) { 29 | $UnprotectedServers += $System 30 | } 31 | } catch { 32 | 33 | } 34 | } 35 | #Use this if the script is being used in Azure Automation or Orchestrator 36 | Write-Output $UnprotectedServers 37 | #Use this if the script is being executed manually, or as a scheduled task. 38 | #Send-MailMessage -From '' -To '' -Subject 'Zerto Unprotected Servers' -Body ($UnprotectedServers | Out-String) -Priority High -SmtpServer '' -------------------------------------------------------------------------------- /mms.cfg: -------------------------------------------------------------------------------- 1 | AutoUpdateDisable=0 2 | SilentAutoUpdateEnable=1 3 | -------------------------------------------------------------------------------- /multiplatform.ini: -------------------------------------------------------------------------------- 1 | [cctk] 2 | acpower=last 3 | ;agpslot=enable 4 | amblightsen=enable 5 | ;autoon=disable 6 | ;autoonhr=0 7 | ;autoonmn=0 8 | bltinfloppy=disable 9 | ;bltinpntdevice=enable 10 | ;bluetoothdevice=enable 11 | bootorder=+hdd,+cdrom,+usbcdrom,+usbdev,+embnic,-floppy 12 | ;camera=enable 13 | ;cellularradio=enable 14 | chasintrusion=disable 15 | ;clearsel=yes 16 | ;dbpm=enable 17 | embnic1=on 18 | embsataraid=ahci 19 | ;embscsi1=off 20 | ;embscsi2=off 21 | ;embsdcard=on 22 | ;embvideoctrl=enable 23 | ;energystarlogo=enable 24 | ;esataports=enable 25 | ;expresscard=enable 26 | expresscharge=enable 27 | fastboot=minimal 28 | floppy=usb 29 | ;forcepxe=disable 30 | hddacousticmode=performance 31 | ;hddprotection=on 32 | ;hdfreefallprotect=enable 33 | hotdock=enable 34 | ;htkeywxanradio=enable 35 | ;idecdrom=auto 36 | ;instanton=enable 37 | ;integratedaudio=enable 38 | ;integratedsas=disable 39 | ;internalminipci=enable 40 | ;interwirelessuwb=enable 41 | ;ioat=enable 42 | ;keyboardclick=disable 43 | keyboardillumination=auto 44 | ;keypad=enabledbynumlock 45 | ;limitcpuidvalue=off 46 | logicproc=enable 47 | ;lowpowers5=disable 48 | ;lpt=lpt1 49 | ;mediacard=enable 50 | ;mediacardand1394=enable 51 | ;memtest=disable 52 | ;microphone=enable 53 | ;minicardssd=enable 54 | ;mobilepowermgmt=enable 55 | ;mouse=on 56 | multicpucore=enable 57 | ;onboard1394=enable 58 | ;onboardmodem=enable 59 | onreader=disable 60 | ;opticaldrivectrl=enable 61 | ;osmode=disable 62 | ;pccardand1394=enable 63 | ;pcisata=enable 64 | ;pcislots=enable 65 | ;postf12key=enable 66 | ;postf2key=enable 67 | ;postmebxkey=on 68 | ;powerbutton=enable 69 | ;radiotransmission=enable 70 | ;rearsingleusb=on 71 | ;rptkeyerr=enable 72 | ;sata0=auto 73 | ;smartcardreader=enable 74 | ;smartcpu=enable 75 | smarterrors=enable 76 | ;speaker=on 77 | speedstep=enable 78 | ;splashscreen=disable 79 | ;standbystate=s3 80 | ;surroundview=enable 81 | ;sysbatcharger=enable 82 | ;sysfanspeed=noisereduce 83 | ;tpm=off 84 | ;trustexecution=on 85 | ;turbomode=enable 86 | ;usb=on 87 | ;usb30=enable 88 | ;usbctl=enable 89 | ;usbports=enable 90 | ;usbportsexternal=enable 91 | ;usbportsfront=enable 92 | ;usbreardual=on 93 | ;usbrearquad=on 94 | ;videoexpsn=enable 95 | ;virtualappliance=on 96 | virtualization=enable 97 | vtfordirectio=on 98 | wakeonlan=lanorwlan 99 | ;wificatcherchanges=permit 100 | ;wifilocator=enable 101 | ;wirelessadapter=enable 102 | ;wirelesslan=enable 103 | ;wirelessuwb=enable 104 | ;wirelesswitchbluetoothctrl=enable 105 | ;wirelesswitchcellularctrl=enable 106 | ;wirelesswitchnlanctrl=enable 107 | --------------------------------------------------------------------------------