''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright (c) Microsoft Corporation. All rights reserved.
'
' THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE
' RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE
' USER. USE AND REDISTRIBUTION OF THIS CODE, WITH OR WITHOUT MODIFICATION, IS
' HEREBY PERMITTED.
'
' Name:     DelIsaConfig.vbs
' Abstract: Deletes the Array-root node from a remote ISA storage machine
'
' Author:   Yoav Yassour
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Set args = Wscript.Arguments
if(0 = args.Count) then
    ShowUsageAndQuit
End If

ISA_STORAGE_PORT_NUMBER = "2171"

wscript.echo "Connecting to " & args(0)
ConnectionString = "LDAP://" & args(0) & ":" & ISA_STORAGE_PORT_NUMBER & "/CN=Array-root,CN=FPCConfiguration"
Set FpcArrayRoot = GetObject(ConnectionString)

wscript.echo "Deleting ISA configuration from " & args(0)
FpcArrayRoot.DeleteObject(0)

wscript.echo "Done"

Sub ShowUsageAndQuit()
    Wscript.echo "Usage: DelIsaConfig.vbs <remote storage machine name>"
    Wscript.Quit
End Sub
