Skip to content

Instantly share code, notes, and snippets.

View micmaher's full-sized avatar

Michael Maher micmaher

  • Home
  • Dublin, Ireland
View GitHub Profile
@micmaher
micmaher / importContosoUser.psm1
Last active October 10, 2017 04:40
PowerShell Module - Create AD User with Attributes needed for Office 365 Integration
#Requires RunAsAdministrator
<#
.Author
Michael Maher on 2/2/16
#>
Function Request-Address{
<#
.DESCRIPTION
Reads in Office 365 required attributes and creates users
@micmaher
micmaher / enableContosoUser.ps1
Last active April 22, 2016 13:44
PowerShell Script - Enables user account, creates home drive, creates DFS link, sets permissions on home drive, sets 2GB quota
#Requires RunAsAdministrator
<######################################################################################
.AUTHOR
Michael Maher
.DATE
08/01/16
.NOTE
Expects CSV in format of username, new password, old username
@micmaher
micmaher / sendEWSemail.ps1
Last active February 4, 2022 22:53
PowerShell Script - Send Email over Internet using Exchange Web Services API
Function Send-EWSEmail
{
<#
.SYNOPSIS
Sends email via Exchange Web Services
.DESCRIPTION
Must be run with parameters
.PARAMETER Username
#Requires -Modules ConfigurationManager
# Needs Configuration Manager Cmdlets from . . .
# https://technet.microsoft.com/en-us/library/dn958404%28v=sc.20%29.aspx
$list = Invoke-Sqlcmd -Query "SELECT host FROM BUILD.DBO.SCCMBLOCK;" -ServerInstance "MYSQLSVR"
$collectionname = 'Blocked Clients'
Set-Location IRL:
foreach($c in $list.host) {
@micmaher
micmaher / ArchiveEvtLogs.ps1
Created March 19, 2016 08:44
Move Security Logs to Archive Point
<#
.DESCRIPTION
Move Security Logs to Archive Point
.REQUIREMENTS
1. Create Shares
Invoke-Command -ComputerName dc1,dc3,dc4,dc5,dc2 -ScriptBlock {
New-SmbShare Seclog$ -Path E:\Seclog -fullaccess "CONTOSO\Domain Admins"}
@micmaher
micmaher / Euro2016.psm1
Last active January 4, 2017 09:16
Get Euro 2016 Team and Player Data from UEFA
Function Get-AllTeams{
<#
.SYNOPSIS
List all qualifying teams
.NOTES
Author: Michael Maher
Date: 14/2/16
#>
[CmdletBinding()]
@micmaher
micmaher / Format Numbers
Created March 22, 2016 13:10
.NET Framework formatting
$a = 348
"{0:N2}" -f $a # Numeric to 2 decimal places = 348.00
"{0:D8}" -f $a # Decimal 8 places = 00000348
"{0:C2}" -f $a # Currency to two places = €348.00
"{0:P0}" -f $a # Percentage x 100 = 34,800 %
"{0:X0}" -f $a # Hex = 15C
@micmaher
micmaher / RemoveOldHomeDir.ps1
Created March 24, 2016 14:18
Remove Old home Directories
<######################################################################################
.AUTHOR
Michael Maher
.DATE
14/01/16
.NOTE
Removes old home drives
@micmaher
micmaher / Connect-Camera.ps1
Created March 28, 2016 18:49
FTP Module for managing Foscam Recordings
#Requires -Modules PSFTP
Function Connect-Camera
{
<#
.SYNOPSIS
Connects to Security Camera to get video
.DESCRIPTION
Can wipe videos or download
@micmaher
micmaher / signScript.ps1
Last active April 20, 2016 12:57
Sign Scripts
# Michael Maher
# 25/9/15
# Sign Script
# Usage: signScript.ps1 <path to script>
param (
$myScript = $(throw "Please specify a path to the script
For Example: .\signScript c:\scripts\archiveSecLog.ps1")
)