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 / PortScanner.ps1
Last active May 11, 2016 18:24
Analyse what ports a process is using (uses Dynamic Parameters)
#Requires -Version 5.0
Function Show-Port {
<#
.SYNOPSIS
Can run and terminate or refresh at specified interval (1 - 60 seconds)
.DESCRIPTION
Show open network connections for a given process
The active process list are presented dynamically for selection
.EXAMPLE
Displays the ports in use by the process firefox and refreshes at 5 second intervals
@micmaher
micmaher / getForwardingAddr.ps1
Created March 31, 2016 20:56
Gets mailboxes that have forwarders in place, the contact they use, the contacts address and if Store and Forward is on
# Gets mailboxes that have forwarders in place, the contact they use, the contacts address and if Store and Forward is on
$fwds = get-mailbox -ResultSize Unlimited | Where-Object { $_.ForwardingAddress -ne $null } | select Name, Alias, ForwardingAddress
foreach ($fwd in $fwds) {
$fwd | add-member -membertype noteproperty -name "ContactAddress" -value (get-contact $fwd.ForwardingAddress).WindowsEmailAddress
}
Write-Output $fwds | Format-Table -Autosize | Out-String -Width 10000 | Out-File -FilePath c:\temp\output.txt
@micmaher
micmaher / noEPOcontact5Days.sql
Created March 30, 2016 10:51
Workstations on the network having not contacted EPO in 5 days
USE [build]
GO
/****** Object: StoredProcedure [dbo].[AVRule1] Script Date: 30/03/2016 11:45:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Michael Maher
-- Create date: 10 January 2012
@micmaher
micmaher / outDateDATFiles.sql
Created March 30, 2016 10:48
Find Outdated DAT files
USE [build]
GO
/****** Object: StoredProcedure [dbo].[AVRule3] Script Date: 30/03/2016 11:45:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ================================================================
-- Author: Michael Maher
-- Create date: 12th January 2012
@micmaher
micmaher / noEPOcontact30Days.sql
Created March 30, 2016 10:42
Workstations on the network having not contacted EPO in 30 days
USE [build]
GO
/****** Object: StoredProcedure [dbo].[AVRule5] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Michael Maher
-- Create date: 25 August 2015
#Requires RunAsAdministrator
Function Create-WindowsForm(){
<#
.DATE
11/3/16
.NOTE
Send username, new password, old
Enables user account, creates home drive
# M.Maher
# 3/3/16
# Check out all 'Get-' network cmdlets
$commands = Get-Command *net* |
where {$_.commandtype -eq 'Function' -or $_.commandtype -eq 'Cmdlet' -and $_.Name -like "Get-*" }|
select name
foreach ($c in $commands){
$c.Name
@micmaher
micmaher / packageMgmt.ps1
Created March 28, 2016 19:10
A collection of Package Management commands
# Get through proxy challenge
$wc = New-Object System.Net.WebClient
$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$wc.DownloadString('http://microsoft.com')
Install-PackageProvider -Name NuGet -Force
Get-PackageProvider
Find-Package *MVA* -Source psgallery
Find-Package *MVA* -Source psgallery | select -Property summary
@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")
)
@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