Category: PowerShell
-
PowerShell to set ACLs that prevent renaming of top-level directories in a share
We have a shared folder that is replicated to all our sites using the fantastic GlobalScape WAFS (@GlobalScape). This folder is huge. People go into the folder, and “type ahead” to get the subfolder they want, but what keeps happening (and I am sure you have seen this) is that when users click and try…
-
PowerShell, Event Triggers, MailboxMoves and email notification
We are in the process of moving our Mailboxes from Exchange 2003 to Exchange 2010. I am using this script to automate the moves. I wanted to find a way to get an email notification when the move is complete. I figured I could keep the PowerShell script running in a “while loop” until Get-MailBoxMoveStatistics reports “Completed”,…
-
PowerShell to assign Exchange 2010 Retention Policies based on AD group membership
In exchange 2003 we maintained a 6 month and 12 month purge policy that was applied based on group membership. I described that configuration here. I wanted to migrate our purge policies to the new 2010 Recipient policies. I needed to find the members of an AD group and assign a retention policy to their mailbox. Here is…
-
Scheduled PowerShell script to resume Mailbox Moves (New-MoveRequest)
Moving mailboxes from 2003 to 2010 is easy, but there is not a “Gui” to schedule it. So I created the following PowerShell script to find all the suspended MoveRequest(s) with the correct date, and resume them. MailboxMove.ps1: Next I create a scheduled task with the following command to run a script with the code…
-
PowerShell Function to get uptime on multiple computers
I wanted to create a function that I could use to find the uptime of several workstations. I did not want to read a list of machine name from csv, I just wanted pass a list of workstation names and get their uptime back. I also added a ping check to make sure the machine…
-
Powershell script to install Cygwin
I like having Cygwin installed on my machine, and since I always re-image, I needed a script to install Cygwin automatically. This will download and install Cygwin and install the openssh package.
-
PowerShell to list all users and when their password expires
I wanted to dump a list of accounts and their password expiration dates – accounts that were not disabled, that had a certain description, and were not set with “Password never expires” (Get-ADUser -filter {(Description -notlike “Service*”) -and (Enabled -eq “True”) -and (PasswordNeverExpires -eq “False”)} -properties *) | select samaccountname,description, @{N=”LastChanged”;E={(Get-Date([System.DateTime]::FromFileTimeUtc($_.pwdLastSet))).ToShortDateString()}}, @{N=”Expires”;E={(Get-Date([System.DateTime]::FromFileTimeUtc($_.pwdLastSet))).AddDays((Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge.TotalDays).ToShortDateString()}}
-
My PowerShell cheat sheet
I am trying to be a better PowerSheller. I thought I would create a post with queries I have figured out. I hope to keep adding more. We needed to change a whole bunch of distribution groups – append them with “-NewName”. This query created our origianl list, the last 50 distribution groups created, with columns representing the…
-
How to update ESXi 4.1 without vCenter
I wanted to update a standalone ESXi box from 4.1 to 4.1 Update 1. Here is how I went about it: Downloaded the update on a windwos box from here and unziped it Open the viClient datastore browser and upload the unzipped folder. If you put it off the root of your datastore, the path…
-
My PowerShell PowerCLI VMware guest provisioning script
This script will provision a 4GB Ram, 40 GB HD Server 2008 R2 VM, set the CD to an OSD iso, set the BootDelay to 5 seconds, and start the machine
