Skip to content

Instantly share code, notes, and snippets.

Dave Green davegreen

Block or report user

Report or block davegreen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
davegreen / CheckIEESC.ps1
Created Jan 27, 2016
SCOM monitor script for checking Internet Explorer ESC status. Requires something like the PowerShell script monitor MP by Wei Lim:
View CheckIEESC.ps1
$API = New-Object -ComObject "MOM.ScriptAPI" -ErrorAction Stop
$PropertyBag = $API.CreatePropertyBag()
$Profiles = @{'Admin' = 0; 'User' = 0}
$Profiles.Admin = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}' -Name IsInstalled).IsInstalled
$Profiles.User = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}' -Name IsInstalled).IsInstalled
if ($Profiles.Values -contains 0)
$PropertyBag.AddValue('State', 1)
davegreen / CheckFirewall.ps1
Created Jan 27, 2016
SCOM monitor script for checking firewall status. Requires something like the PowerShell script monitor MP by Wei Lim:
View CheckFirewall.ps1
$API = New-Object -ComObject "MOM.ScriptAPI" -ErrorAction Stop
$PropertyBag = $API.CreatePropertyBag()
$Profiles = @{'Domain' = '0'; 'Standard' = '0'; 'Public' = '0'}
$Profiles.Domain = (Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile' -Name EnableFirewall).EnableFirewall
$Profiles.Standard = (Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile' -Name EnableFirewall).EnableFirewall
$Profiles.Public = (Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PublicProfile' -Name EnableFirewall).EnableFirewall
if ($Profiles.Values -contains 0)
View Custom.SQLQueries.xml
<?xml version="1.0" encoding="utf-8"?><ManagementPack ContentReadable="true" SchemaVersion="2.0" OriginalSchemaVersion="1.1" xmlns:xsd="" xmlns:xsl="">
<Name>Custom - SQLQueries</Name>
<Reference Alias="MicrosoftWindowsLibrary7585010">
View CollectionUpdateTime.vbs
Set objArgs = Wscript.Arguments
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
Dim ConnString
ConnString = "DRIVER={SQL Server};Server=" & objArgs(0) & ";Database=" & objArgs(1) & ";"
objConnection.Open ConnString
objRecordSet.Open "SELECT TOP(1) CC.CollectionID, CN.CollectionName, CC.TimeUpdated FROM Collection_MemberChg_Notif CC JOIN Collections CN ON CC.CollectionID = CN.SiteID WHERE CN.CollectionName = 'Test Collection' AND CC.TimeUpdated < DATEADD(mi, -20, GETDATE())", objConnection, 3, 3
davegreen / Connect-ExchangeOnline.ps1
Last active Apr 12, 2018
Function for connecting to an Exchange Online session. Useful in a PowerShell profile script.
View Connect-ExchangeOnline.ps1
function Connect-ExchangeOnline {
A function that connects to the Exchange online system.
.Parameter Credential
A credential object with rights to connect to the Exchange server. This parameter is mandatory.
.Parameter AllowClobber
Boolean value of whether the imported session will clobber existing commands. Defaults to True.
davegreen / Timezone.ps1
Last active Sep 26, 2015
Get and set the computer timezone.
View Timezone.ps1
#Requires -Version 3
Function Get-TimezoneFromOffset()
A function that gets the timezones that match a particular offset from UTC
.Parameter UTCOffset
A string containing offset time you require. This must match the form +NN:NN or -NN:NN.
davegreen / Get-ComputerADSite.ps1
Last active Feb 2, 2016
A function that will return the AD site the local computer is currently connected to. Useful for PowerShell login scripts that need to target specific sites.
View Get-ComputerADSite.ps1
Function Get-ComputerADSite()
Get the computers current AD site from the computer Netlogon information.
davegreen / ProBook6x70bConfig.cmd
Last active Aug 29, 2015
BIOS configuration command file for running the correct copy of HPs BiosConfigUtility with a hardcoded configuration file. This will be changed to support params..
View ProBook6x70bConfig.cmd
pushd %~dp0
set _bcu=BiosConfigUtility.exe
if /I "%PROCESSOR_ARCHITECTURE%" EQU "AMD64" set _bcu=BiosConfigUtility64.exe
"%_bcu%" /nspwdfile:"%~dp0BIOSPW.bin" /set:"%~dp0ProBook6470bConfig.cfg"
IF %ERRORLEVEL% NEQ 0 "%_bcu%" /cspwdfile:"%~dp0BIOSPW.bin" /set:"%~dp0ProBook6470bConfig.cfg"
davegreen / OSDComputerName.ps1
Last active Apr 12, 2019
Altered script from to improve computer name validation - Originally by Nickolaj
View OSDComputerName.ps1
Function Load-Form
[void] $Form.ShowDialog()
Function Set-OSDComputerName
davegreen / sharedsettings.cs
Last active Aug 29, 2015
A basic class for shared settings, allowing a key/value based settings file to be created or loaded, Lines starting with a # are used as comment lines and are ignored as settings. As an example, the class can be instantiated with: private SharedSettings sharedsettings = new SharedSettings("Contoso", "Test.cfg");
View sharedsettings.cs
/// <summary>
/// The shared settings class, responsible for reading and writing machine-wide shared settings.
/// </summary>
public class SharedSettings
/// <summary>
/// The file path to the shared settings file, computed using the common application data folder for wider OS support.
/// </summary>
private string sharedSettingsPath;
You can’t perform that action at this time.