Skip to content

Instantly share code, notes, and snippets.

@mekuls
mekuls / SendAsAlias.ps1
Created May 16, 2012 13:22
Exchange User send as alias
<#
.SYNOPSIS
Allow a microsoft 2007 exchange enabled mailbox user the ability to send as
an alias
.DESCRIPTION
From time to time customers want to have the ability to add an extra email
address to their mail service at no extra cost. This can be accomplished
by creating a new distribution group, subscribing the existing mailbox
to the new distributino group and giving the AD user object send-as permission
over the group object.
@mekuls
mekuls / gist:2760294
Created May 21, 2012 02:21
Powershell - Set All MsExchRequireAuthToSend To Null
Function Set-AllMsExchRequireAuthToSendToNull
{
Param(
[Parameter(Mandatory=$true)]
[String[]]$HostingContainerDn
)
foreach ($container in $HostingContainerDn)
{
$ou = Get-QADObject $container
@mekuls
mekuls / greylistnoretry.py
Created June 1, 2012 10:21
Retrieve a list of postfix greylisted emails that didn't retry
import glob
fileNames = glob.glob("/var/log/mail*")
recipient = "username@example.com"
greylistEntries = []
for fileName in fileNames:
for line in open(fileName).xreadlines():
@mekuls
mekuls / Get-InstalledSoftware.ps1
Created June 20, 2012 23:04
Get's a list of installed software on a system
Param(
[Parameter(Mandatory=$true)]
$FilePath
)
$computername=$env:COMPUTERNAME
$uninstallKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computername)
@mekuls
mekuls / gist:3075222
Created July 9, 2012 08:56
JQuery Cycle text
<html>
<head>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script src='http://malsup.github.com/jquery.cycle.all.js'></script>
</head>
<body>
<div id='slideshow'>
<div>Morons</div>
<div>Not Morons</div>
@mekuls
mekuls / gist:3102851
Created July 13, 2012 05:13
Powershell - Remove files with extension
rm -r *.ext
@mekuls
mekuls / gist:3102944
Created July 13, 2012 05:38
dcpromo.exe DCINSTALL example for new domain
[DCINSTALL]
InstallDNS=yes
NewDomain=forest
NewDomainDNSName=au.sky
DomainNetBiosName=au
ReplicaOrNewDomain=domain
ForestLevel=4
DomainLevel=4
DatabasePath=%systemroot%\ntds
LogPath=%systemroot%\ntds
@mekuls
mekuls / Compare
Created July 26, 2012 06:47
Compare IP range - BASIC
/**
* Created with IntelliJ IDEA.
* User: luke.muccillo.admin
* Date: 26/07/12
* Time: 4:18 PM
* To change this template use File | Settings | File Templates.
*/
public class EntryPoint {
public static void main(String[] args)
{
@mekuls
mekuls / Get-ExchangeEmailAddresses.ps1
Created August 3, 2012 03:04
List email addresses belonging to exchange user list
Function Get-EmailAddresses
{
Param(
[Parameter(Mandatory=$true)]
$Identity)
$mailbox = Get-Mailbox $Identity
$aliases = @()
$addresses = $mailbox.EmailAddresses | % { $_.addressString }
@mekuls
mekuls / Get-UserLoginActivity.ps1
Created August 31, 2012 06:04
Get-UserLoginActivity lists user log in and log out events for any server for any given NTAccountName
<#
.Synopsis
Get-UserLoginActivity lists user log in and log out events for a given NTAccountName
.Example
Get-UserLoginActivity -ServerName "." -NTAccountName "contoso\username"
Gets all user log on and log off events on the current server for the
user with ntAccountName - contoso\username.