Lite Touch

PowerShell is King – Testing OS Deployment Web Services using PowerShell

Recently I was setting up Maik Kosters OS Deployment Web Services for a customer and I need to test them, sure, you can do that interactively directly by running them, but I wanted the “PowerShell” way to do it.

You can get the Web Services from Maik Koster here: http://mdtcustomizations.codeplex.com/documentation?referringTitle=Home

Testing a Web Services the Non PowerShell Way.

image
Browsing to the Web Services

image
Select the DoesComputerExists

image
Type in a value and Invoke.

Testing a Web Services the PowerShell Way.

Since PowerShell has the function built-in it is very much a no-brainer.

To connect and get all members from the Web Services execute this:

$ADWebS = New-WebServiceProxy -Uri http://MDT01/OSD/ad.asmx?WSDL
$ADWebS | Get-Member -Type Method

That will give you something like this back

image

To connect and get one member with some detail execute this:

$ADWebS = New-WebServiceProxy -Uri http://MDT01/OSD/ad.asmx?WSDL
$ADWebS | Get-Member -Name DoesComputerExist -Type Method | Format-List

That will give you something like this back

image

So, to test the DoesComputerExists with a value you can now execute the following:

$CompuerNameToTest = "MDT01"
$ADWebS = New-WebServiceProxy -Uri http://MDT01/OSD/ad.asmx?WSDL
$ComputerExistsInAd = $ADWebS.DoesComputerExist("$CompuerNameToTest")

Write-Host "The Computer $CompuerNameToTest exists in Active Directory: $ComputerExistsInAd"

So if the Computer Exists in Active Directory you should get something like this back

image

/mike

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.