http://marcdekeyser.com

Tag Cloud


December 2012 Entries

Installing Windows Deployment Services

While we will use the Microsoft Deployment Toolset (MDT) 2012 for our actually server deployments we are going to leverage the power WDS provides us to PXE boot (boot from the network) with a winPE image. You could argue this is not necessary if you are running all virtual machines but I want a solution as flexible as can be. Install WDS Add Server roles Select the windows deployment Services Read through the introduction if you feel like it… Make sure the transport & deployment components Confirm ......

Creating an automated OS deployment

To create a deployment environment we are going to use ADDS, DHCP, WDS, WSUS, MDT2012 and good old fashioned hard work! Note that a number of prerequisites need to be met to install certain services. I used 2 servers, but it is possible to do it with only one server, do note that you will need to research on how to set the WDS entries in DHCP as this will not be done automatically… There are a number of binaries you will need to download: MDT 2012: http://www.microsoft.com/en... ......

Installing and configuring Windows Server Update Services (WSUS)

Deploying images is one thing but actually having to run the update gauntlet on every deploy is terrifying to me. It often results in no updates being installed (cause I just could not be bothered) and this can cause discrepancies between test systems or even you missing out on cool new features! So let's install the WSUS component to handle that. Later on we'll see how to configure WSUS and set an automatic "Approve All" rule. What we will be doing as, albeit not in this part, is leveraging the ......

Powershell: If statements dependent on installed exchange role

Something I need to keep for usage in the future:$hostname=hostnameIf (get-exchangeserver $hostname | where {$_.isClientAccessServer -eq $true}) { } else { } If (get-exchangeserver $hostname | where {$_.isHubTransportServer -eq $true}) { } else { }If (get-exchangeserver $hostname | where {$_.isMailboxServer -eq $true}) { } else { }If (get-exchangeserver $hostname | where {$_.isUnifiedMessagingServer -eq $true}) { } else { }If (get-exchangeserver $hostname | where {$_.isEdgeServer -eq $true}) { } ......

Powershell: Connect to Exchange server powershell

Connecting to Exchange powershell is, for normal operations, as simple as opening the shortcut on you start menu :).However, if you have the need to have some scripts perform actions against your Exchange you can use the below code to make that happen!$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://YourCASServerFQDN/Po... -Authentication Kerberos Import-PSSession $s Add-PSSnapin Microsoft.Exchange.Manageme... . $env:ExchangeInstallPath\bi... ......

Powershell: Install-dotNET4 function

This function will download and install ,NET 4.0. It uses the Get-Framework-Versions function to determine if the installation is necessary or not. Internet Connectivity will be required as the script auto downloads the setup file (and sleeps for 360 seconds... I had a function in there to monitor for install completion at first, turns out the setup file spawns so many childprocesses the function just got confused and locked up -_-)Alternatively you could drop the installation file in the folder ......

Powershell: Get-Framework-Versions.

This function will use the test-key function posted earlier. It will check which .NET frameworks are installed (currently only checking for .NET 4.0) but can be easily adapted and/or expanded. function Get-Framework-Versions(){ $installedFrameworks = @() if(Test-Key "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Client" "Install") { $installedFrameworks += "4.0c" } if(Test-Key "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full" "Install") { $installedFrameworks += "4.0" } return $installedFrameworks} ......

Powershell Test Reg Key function

Disclaimer: Code is not mine but forgot where I got it. Ping me if this is yours and you will receive full kudos to it :)

function Test-Key([string]$path, [string]$key)
{
    if(!(Test-Path $path)) { return $false }
    if ((Get-ItemProperty $path).$key -eq $null) { return $false }
    return $true
}


Powershell Run-As Script

Disclaimer: This script is not of my own making. I found it on a share somewhere and it is so handy I started using in a bunch of scripts. To the writer: If you're out there, somewhere, when you see this, thank you! Check if script is running as Adminstrator and if not use RunAs # Use Check Switch to check if admin param([Switch]$Check) $IsAdmin = ([Security.Principal.Window... [Security.Principal.Windows... ).IsInRole([Security.Princi... "Administrator") ......