Azure Services Training Kit and PowerShell
Following a note on this blogpage about Powershell for needed for the Azure Services Training Kit, I decided to check it out :
And yes the dowload page states you need PowerShell for this, so I downloaded this Kit and did a DIR -REC on the directory for .PS1 files :
Directory: C:\AzureServicesKit\Assets\DependencyChecker\Scripts\Dependencies\Check
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 24-10-2008 20:01 501 CheckASPNETFutures.ps1
-a--- 24-10-2008 20:01 484 CheckCCT.ps1
-a--- 24-10-2008 20:01 98 CheckIis6Comp.ps1
-a--- 24-10-2008 20:01 162 CheckIis7AspNet.ps1
-a--- 24-10-2008 20:01 517 CheckLiveFrameworkTools.ps1
-a--- 24-10-2008 20:01 269 CheckLiveServicesSDK.ps1
-a--- 24-10-2008 20:01 493 CheckNET35.ps1
-a--- 24-10-2008 20:01 497 CheckNET35SP1.ps1
-a--- 24-10-2008 20:01 758 CheckNetServicesSDK.ps1
-a--- 24-10-2008 20:01 112 CheckServer2008.ps1
-a--- 24-10-2008 20:01 468 CheckSHSDK.ps1
-a--- 24-10-2008 20:01 486 CheckSilverlight.ps1
-a--- 24-10-2008 20:01 492 CheckSilverlightDevTools.ps1
-a--- 24-10-2008 20:01 490 CheckSQL2008.ps1
-a--- 24-10-2008 20:01 497 CheckVS2008.ps1
-a--- 24-10-2008 20:01 895 CheckVSTSSP1.ps1
-a--- 24-10-2008 20:01 162 CheckWCFHTTPAct.ps1
-a--- 24-10-2008 20:01 162 CheckWinAuth.ps1
-a--- 24-10-2008 20:01 85 CheckWmiIis7.ps1
-a--- 24-10-2008 20:01 498 CheckZermattSDK.ps1
-a--- 24-10-2008 20:01 59 QueryWmiIis7.ps1
Directory: C:\AzureServicesKit\Labs\AdvancedSQLDataServices\Assets
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 6-11-2008 18:25 2828 SDSCreateStorage.ps1
-a--- 6-11-2008 18:25 176 SDSFinalize.ps1
-a--- 6-11-2008 18:25 595 SDSSetup.ps1
Directory: C:\AzureServicesKit\Labs\ConcurrencySQLDataServices\Assets
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 6-11-2008 18:25 459 SDSCreateStorage.ps1
-a--- 6-11-2008 18:25 176 SDSFinalize.ps1
-a--- 6-11-2008 18:25 595 SDSSetup.ps1
you can see there are some basic prereq tests written in powerShell
I decided to do a quick check on the contents of the scripts
PS C:\AzureServicesKit> ls . -rec *.ps1 | gc
In the first directory we can find some scripts where PowerShell is just used to do some Dependency checks, all of them very simple and some are even oneliners (e.g. registry checks) and make for excelent example scripts to get started with PowerShell
I nice helper function that came back in a lot of the Dependency check scripts :
function SearchUninstall($SearchFor)
{
$uninstall = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
$uninstallObjects = ls -path $uninstall ;
$found = $FALSE;
foreach($uninstallEntry in $uninstallObjects)
{
$entryProperty = Get-ItemProperty -path registry::$uninstallEntry
if($entryProperty.DisplayName -like $searchFor)
{
$found = $TRUE;
break;
}
}
$found;
}
SearchUninstall -SearchFor 'Microsoft SQL Server 2008*';
and in the SDS (SQL Data Services) examples a custom snapin is used :
#Register the commandlets
$psSnapInDll = resolve-path Microsoft.Samples.AzureServices.PowerShell.dll
&$env:windir\Microsoft.net\Framework\v2.0.50727\installutil.exe -i $psSnapInDll >> $null
#Add the commandlet
Add-pssnapin AzureServicesManagement
. .\SDSSetup.ps1
You can see that PowerShell is mostly just used a GLUE here, and to provide access to a Custom DLL (SnapIn) as you mostly find in an SDK also.
This may not look much added value to make this Training Kit depending on PowerShell, but it (the Snapin Provided) does make Programatic (Script) access much easier for administrators as the Former SDK managed DLL only solution, with the sample scripts to get started with.
Also the other provided sample scripts are a good starting point for learning PowerShell a bit like the PowerShell support in SBS (Small Business Server), an not intrusive way to get into PowerShell as Susan Bradley, an SBS MVP, did a very good job in explaining in the latest PowerScripting Podcast :
Episode 49 - PowerScripting Podcast - Susan Bradley
So I think this is an excelent evolution ;-)
Enjoy,
Greetings /\/\o\/\/