Tag: PowerShell

  • 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

  • New to my PowerShell Profile: VMware PowerCLI

    This will add the PowerShell CLI tools if they exist. Thanks to this thread

  • Exchange 2010 SP1 and New-DatabaseAvailabilityGroup

    I was progressing along on with my offline Exchange install, and I ran into a problem when creating my Database Availability Group (DAG). I wanted to put the witness directory on a non exchange server and the instructions say: If the witness server you specify isn’t an Exchange 2010 server, you must add the Exchange Trusted Subsystem universal security group to the local Administrators group…

  • A second addition to my PowerShell install script

    I added even more functionality in my PowerShell install script (original script, and first update). I wanted the ability to display an informational popup to let the user know what we were up to. The function below takes the text to display from the config xml file and displays it in a windows form, with…

  • An update to my new PowerShell install script

    I needed new functionality in my PowerShell install script (previously mentioned here). I needed the ability to make sure a process is not running, and if it is running, I could prompt the user to close it. The new function takes the process name value from the config xml file (as I mentioned in previos…

  • My new PowerShell install script

    I wanted to write a PowerShell script that can execute common activities involved in deploying software. We require signed PowerShell scripts, so it was not practical to rewrite the script for every piece of software. Instead, I moved the configuration to an XML file. The first function below takes an object (pulled from the XML…