dkegg

Posts
  • Get-O365user.ps1 = MSOLuser and EXOUser and EXOMailUser or EXOUserMailbox attributes combined!

    Have you ever been troubleshooting Exchange Online (EXO) and MSOnline (Azure) objects and wished there was a way to aggregate all the data together into a single object that you could manipulate either via script or pipeline, output via FT, manipulate...
  • msExchRecipientTypeDetails

    msExch

  • Ugly GALsync

    Ugly

  • So what comes after the ...

    If you're like me, you constantly find yourself running powershell scripts and one or more array never returns the full list, it adds that pesky ... whether or not you try the FT -wide - autosize or FL and you never get the whole list. This...
  • Fattening up an Exchange mailbox

    Fatten

  • PowerShell connectivity to Azure, Exchange Online and Exchange on-premises all-in-one

    I use the following function in my PowerShell profile so that I can use the Microsoft Online cmdlets, the Exchange cmdlets against Exchange online and the Exchange cmdlets against on-premises all in one session... Firstly - If you are unsure how...
  • Testing ADFS Federation with Office 365 without DirSync in place

    Sometimes, as you are deploying ADFS, DirSync, Hybrid etc... you might decide that you want to test ADFS with your tenant before you have DirSync in place (maybe you're waiting on a server, or a firewall rule etc..). This bit of code below allows...
  • Office 365 Exchange Attribute migration between forests

    Attr

  • Auto-Licensing script for Office 365

    You can use the following script with task scheduler to connect to your tenant via powershell, check for any unlicensed users and apply a license. It will alert via email when the number of free licenses in your tenant falls below a certain number...
  • Duplicating an on-prem mail-enabled security group as a cloud DL

    Many Office 365 customers run into problems in a non-hybrid (simple coex) configuration where they used to have on-premise mail-enabled security groups, but they alllowed the group owners to update membership using the GAL in Outlook (with the Modify...
  • Monitoring for MX record changes with VBScript

    Sometimes, like in the case of an email migration, it is necessary to wait for DNS changes (MX records for example) to replicate before continuing your migration, otherwise mail might bounce or other nastiness may occur. The following VB Script runs...
  • Autodefrag via a VBScript

    Drive defragmentation is not a very exciting subject, however in the past I've had a need to automate drive defragmentation via a scheduled task so I've used the following VB script. It allows for email notification and varying levels of status messages...
  • Removing a proxy address from an NT Account

    Occasionally it might be necessary to remove one or more items from the ProxyAddresses array in AD, this array contains all the SMTP addresses stamped on the AD object. Here's a VBScript that you can use to clean proxies off your AD accounts. 1) Change...
  • NT Account to SID translation .... and back again.

    I keep the following nifty functions in my Powershell profile, it helps when working with SIDs and Active Directory, it allows you to easily convert a SID back to the NTACCOUNT and vice versa... function ConvertTo-Sid ( $NtAccount ) {( new-object...
  • Group Nesting Powershell report using Quest Activeroles

    I was recently asked to provide a report on the number (and depth) of nested groups in AD. Getting a list of the groups inside a group is pretty simple using get-qadgroupmember <groupname> -type group , however getting the groups inside that...
  • Zipping files older than X days

    Recently I was working with a firewall that wrote some tremendously large log files and was eating disk at an alarming rate, so to remedy this, and sharpen my Powershell pencil, I decided to write a script that could be setup with task scheduler to zip...
  • Powershell and Hyper-V Management

    There's an awesome tool on codeplex for managing Hyper-V using Powershell called PSHyperV, it's especially handy if you're working with Hyper-V on a Windows Server Core installation. http://pshyperv.codeplex.com/ Just download the library, drop...
  • Powershell Remote User Logoff / Reboot

    When patching servers, any disconnected user sessions typically prevent the post-patch auto reboot. To remedy this you could use the following Powershell script : foreach ( $_ in get-content servers.txt ) {( gwmi win32_operatingsystem -ComputerName...
  • Merging and appending to CSV files using Powershell

    The time-tested approach of appending data to the end of a file using >> doesn't necessarily work with CSV files in Powershell, and Out-File with the -append switch typically results in a corrupted CSV file. Recently I wrote a Powershell script...
  • Powershell - Deleting files X days old

    Here’s a powershell script you can use to delete files in a directory (and all sub-directories) X days old or older. $Now = Get-Date $Days = " 3 " $TargetFolder = " u:\backup " $LastWrite = $Now . AddDays( - $days ) $Files = get...
  • Creating secondary proxy addresses

    Often times it may become necessary to stamp an additional SMTP address (proxy address) on a user account, either as part of a migration, or organizational domain name change etc... Here's a VBScript example of how to add a new SMTP domain name to...
  • Putting colorized Powershell code in your blog \ documentation

    I love powershell, I love it's power, flexibility and extensibility, however I I do most of my work in the shell because I cannot stand to use the ISE. The only feature of the ISE that I like it is the way it changes the color of variables, cmdlets...
  • First things first

    My name is Darryl Kegg and I am a Senior Deployment Consultant at Microsoft, I am part of the Premier Deployment team within the America's Cloud Services group deploying Office 365. My background has been primarily focused on Exchange, Directory Services...