PowerShell

PowerShell – ProperCase Function

Change any case to Proper Case (‘ITNOTES DoT net’ to ‘Itnotes Dot Net’):
This is very useful for us during scripted user creations when the usernames and such from the source were in random cases. This script could also be useful with auto user provisioning with ILM from another datasource, we currently us a VBScript that is much longer.

This script basically converts everything to lowercase the capitalizes the first letter of each word.

?View Code POWERSHELL
function ToProperCase ([String]$in)
{
 $in = $in.Tolower()
 $textInfo = [System.Threading.Thread]::CurrentThread.CurrentCulture.TextInfo  
 return $textInfo.ToTitleCase($in)
}

Example of use

?View Code POWERSHELL
$Title = "ITNOTE DOT NET"
$Title = ToProperCase($Title)

Returns:

Itnotes Dot Net

Complete Script

?View Code POWERSHELL
function ToProperCase ([String]$in)
{
 $in = $in.Tolower()
 $textInfo = [System.Threading.Thread]::CurrentThread.CurrentCulture.TextInfo  
 return $textInfo.ToTitleCase($in)
$Title = "ITNOTE DOT NET"
$Title = ToProperCase($Title)

Tags: , ,

Monday, March 1st, 2010 Identity Management, Powershell No Comments

PowerShell 2.0 Release Candidate for Windows XP SP3 and Server 2003 SP2

Finally we see a release candidate for Windows XP, but you must have SP3 installed.

Download here: https://connect.microsoft.com/windowsmanagement/Downloads

Tags: ,

Monday, September 14th, 2009 Powershell No Comments