Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Maher micmaher

  • Home
  • Dublin, Ireland
View GitHub Profile
View GetFirewallState.ps1
#Requires -Version 4.0
<#
.SYNOPSIS
Gets the Firewall State for for a local, remote or a piped list of machines
.DESCRIPTION
Will require PowerShell 4.0 or later
Gets Public, Private and Domain Profiles
.EXAMPLE
View Get-TaskDuration.ps1
Function Get-TaskDuration {
<#
.SYNOPSIS
Returns the duration (execution time) of the most recent run of the specified scheduled task.
Michael Klement did a great deal of this
.DESCRIPTION
Returns the execution time of the most recent completed run of the specified scheduled tasks as [timespan] instances.
@micmaher
micmaher / moveImageCloudFiles.ps1
Created Jun 13, 2016
Move Rackspace Image to Cloud Files using the Pitchfork API
View moveImageCloudFiles.ps1
$DDI='YOUR ID HERE'
$Region = 'YOUR SITE HERE'
$AuthToken = "YOUR TOKEN HERE"
$URI="https://$region.images.api.rackspacecloud.com/v2/$DDI/tasks/"
# ImageID
$imageid = 'YOUR IMAGE ID HERE'
$container = "YOUR CONTAINER HERE"
# Request Headers
View CreateTableforStatusUpdate.sql
USE [build]
GO
/****** Object: StoredProcedure [dbo].[inserthotfixPresent] Script Date: 26/04/2016 17:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
View installHotfix.ps1
# PowerShell 2.0 Compatible Web Call deployed as an SCCM Package
$h = get-hotfix | where {$_.HotFixID -eq 'KB3050265'}
If ($h){
# Already Installed
$uri = "http://webserver/winupdate/wuaccept.asp?installed='$env:COMPUTERNAME','Yes'"
(New-Object System.Net.WebClient).DownloadString($uri)
Exit
}
@micmaher
micmaher / customPSEnv.psm1
Last active Sep 5, 2018
Customise the your PowerShell Environment
View customPSEnv.psm1
Function Set-PSEnv{
<#
.SYNOPSIS
Customise PowerShell Environment
.DESCRIPTION
Can set up PowerShell profile
Can Set up Package Management (PowerShell Gallery), Chocolatey, Implicit Remoting, Themes,
Can map a PSDrive to OneDrive, Update Help
.NOTES
Author: Michael Maher
@micmaher
micmaher / CitrixPermstoAGDLP.ps1
Last active Apr 15, 2016
Change Citrix Permissions to meet AGDLP rule
View CitrixPermstoAGDLP.ps1
$csvFile = "C:\temp\CtxGroups2.csv"
import-module activeDirectory
############################### 1. Get the Citrix Groups ################################
# Run in MWTRADERS Domain
Get-ADGroup -Filter * -SearchBase "ou=Retail,ou=Dublin,dc=contoso,dc=com" | Select Name, distinguishedName | Export-Csv $csvFile
break
################################ 2. Create a Domain Local equivalent on IE ################################
@micmaher
micmaher / putACESonSharedMBX.ps1
Created Apr 10, 2016
Change Shared Mailbox Permissons
View putACESonSharedMBX.ps1
# Michael Maher
# 22/5/13
# Get ACLs from CSV and write to AD
$arrRecord = @()
$spreadsheet = Import-Csv C:\scripts\ACLs2.csv
# Get just the mailbox name which will be used to create group names later
# Store this in an array so we can sort it and get unique values later
# Also need a second array with the full email address and ACL for applying permissions later
@micmaher
micmaher / getFreshADUser.ps1
Last active Oct 10, 2017
Get AD Users Created since (x) Days - include Office 365 attributes
View getFreshADUser.ps1
Function Get-FreshADUser
<#
.Synopsis
Check for users created in AD since (x) days
.DESCRIPTION
Lists users created in AD since specified date
The number of days to check back is a mandatory prarmeter
Useful in a domain migration scenario
@micmaher
micmaher / getLastLoginDatefromEPO.sql
Created Apr 10, 2016
Get Last Login Date from EPO
View getLastLoginDatefromEPO.sql
USE [build]
GO
/****** Object: StoredProcedure [dbo].[EPOLastLogon2] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ================================================================
-- Author: Michael Maher
-- Create date: 12th June 2014