Active Directory / Group Policy / Security Settings

Here’s one I just ran across.

If you have a GPO that enforces the password Age so it cannot be changed very often (IE:  Password must be at least 48 hours before you’re allowed to change it as an example) and don’t realize it there you can be banging you head against the wall

*HUH?!*

Yeah this threw me for a loop.  I was banging my head against the wall on this until I realized everything was working fine unless we tried to change our passwords more than once every two days (not a typical thing)

But the stupid thing was that error.

“Unable to update the password.  The value provided for the new password does not meet the length, complexity or history requirements of the domain.”

Each and every time I kept glancing and saying “It’s a new password, it’s stupid complexity, it’s 500 letters long…”

Never dawned on me about a Password MINIMUM age.

So if you find you get that error, don’t forget to check for password MINIMUM age as well.

“Grumble grumble grumble….”

Sean
The Energized Tech

Using #Powershell to auto start your Hyper-V Demo Environment

powershell

One of things you encounter when you start doing repeat presentations is the need to have your environment in a Consistent and Ready state every time.

We all know the rules after a while.  Don’t change your demo box.  Avoid altering your environment in any way prior to the demo.   Avoid Murphy’s law.

Well here’s something to help you out.   I wrote a simple Powershell script to fire up the Demo machines in a times manner, Get my Powerpoint on the screen and even start the Connections to “remotely view” the Virtual machines in Hyper-V.

First off, you need to goto http://pshyperv.codeplex.com/ and download the HyperV modules for Powershell.  If you’re running SCVMM you can use the modules from it if you choose, but not all of us are running a fully licensed copy of SCVMM on our Demo Hyper-V box Smile

Once the Hyper-V module is downloaded and installed things get a lot easier on your HyperV demo box.

So our first script is going

  • Launch Powerpoint with our provided Presentation
  • Start VMCONNECT.EXE and connect us up to our Child Partitions in Hyper-V
  • Start up one demo machine
  • Sleep
  • Start up the next demo machine

So why would I want a delay?  How about dependences?   The Domain Controller?  An SQL Server?   The point is you typically do start up your Demo environment in a particular order.

First off once you execute an

IMPORT-MODULE HYPERV

Execute a

GET-VM

and get the names of the Virtual Machines.  Once you have them, the rest of this is easy.

————– START-DEMOENV.PS1 ————————

# Import HyperV Management Modules from Codeplex
import-module hyperv

# Specify name of Powerpoint Presentation

$PPT=’c:usersAdministratorDesktopMyPowerpoint.pptx’

# Launch Powerpoint 2010 (32bit version)
# Just edit the Path and filename if you’re running a 64bit version instead or
# Previous version of Microsoft Office

& ‘C:Program Files (x86)Microsoft OfficeOffice14POWERPNT.EXE’ $PPT

# Launch VMConnect.exe connecting to the computer ‘localhost’
# and Virtual Machine called ‘HYPERV-DC1’ and the Virtual Machine called
# HYPERV-CLIENT

& ‘c:Program FilesHyper-Vvmconnect.exe’ localhost HYPERV-DC1
& ‘c:Program FilesHyper-Vvmconnect.exe’ localhost HYPERV-CLIENT

# Start the Child partition in Hyper-V called HYPERV-DC1
Start-VM "HYPERV-DC1"

# Sleep for 3 minutes (180 seconds) before starting up the client machines or those
# Dependant on your Demo Active Directory

Start-Sleep -Seconds 180

# Start the next machine (or machines) depedant on the Demo Active Directory
# environment.  this computer is called “HYPERV-CLIENT”

Start-VM “HYPERV-CLIENT"

————– START-DEMOENV.PS1 ————————

Now to have this script launchable from the desktop, you just need to create a shortcut pointing to the script and with the execution policy set

C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -file C:UsersAdministratorDesktopStart-DemoEnv.PS1 -executionpolicy ‘RemoteSigned’

 

The other script I have you may find handy is the one to undo all of this.   For each of these machines I have a single Snapshot created (always a good idea in a demo setup) to allow myself to rollback to a previous state.  So our next script will

  • Rollback to the original snapshot state of each of these machines.  The states are programmed originally to NOT startup automatically
  • Kill the Powerpoint presentation
  • Kill the Remote connections to the Child partitions in HyperV

 

————– END-DEMOENV.PS1 ————————

# Import HyperV Management Modules from Codeplex

Import-module HyperV

# Get Child Partition “HYPERV-DC1”, pull the Snapshot and Force a Restore

GET-VM "HYPERV-DC1" | Get-VMSnapshot | Restore-VMSnapshot –force

# Get Child Partition “HYPERV-CLIENT”, pull the Snapshot and Force a Restore

GET-VM "HYPERV-CLIENT" | Get-VMSnapshot | Restore-VMSnapshot –force

# GET VMCONNECT and POWERPNT – Shut them down

GET-PROCESS VMCONNECT | STOP-PROCESS
GET-PROCESS POWERPNT | STOP-PROCESS

————– END-DEMOENV.PS1 ————————

Like the previous script, we want a way to launch this with the execution policy set.

C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -file C:UsersAdministratorDesktopEnd-DemoEnv.PS1 -executionpolicy ‘RemoteSigned’

 

You of course may not have your scripts under the “Administrator” folder on the Desktop or be called END-DEMOENV.PS1 but that’s something you can always choose Smile

The nice part I like is the ability to have some consistency when start up just before you present to an audience.   The neater part is to notice something else.  Powershell launched standard executables in that run.

The Power of Shell is in YOU

Sean
The Energized Tech

Interviewed by Quest at MVP11

A good friend of mine from Quest, Dmitris cornered me with a video camera and decided to interview me

I apologize for my hoarse voice.  Apparently another good friend (who shall be named to protect his innocense) decided I should be a one man cheering squad for all the Canadian MVP’s.

No.  There is unfortunately NO video of that…. to my knowledge…