Highlighted
PebbleMatt
1 Nickel

Using VBScript and XML API for quota management

I'd like to use the XMP API with VBScript in order to perform some quota reporting and management.  I have viewed an example that was posted (https://community.emc.com/docs/DOC-6372), but as the author mentions "It does not show how to parse XML or do anything with the return", and to be honest, my VBScript knowledge is pretty basic, so I've not figured out how to use XML and VBScript together.

I was hoping that someone could share some examples of how they use the  XML API in VBScript to send and retrieve commands to the control  station?  Would be very helpful if you could, Thank you.

0 Kudos
5 Replies
cking220011
1 Copper

Re: Using VBScript and XML API for quota management

I know this is old but I just spent some time figuring out the XML API and also started with that same sample script. I used it to see that I could connect to our control station but at that point quickly decided to use Powershell. You can use the same idea and create an Msxml2.ServerXMLHTTP.6.0 object to login and post the xml but you will find the Powershell version much easier to read and easier to deal with all the quotes in xml. Parsing the XML is much easier IMHO.

If this is still something you are interested in or if anyone wants to see my code, let me know. There seems to be one issue with dealing with the XML returned from the control station but I worked around it. Something with the namespaces but I am not XML expert (yet).

0 Kudos
PebbleMatt
1 Nickel

Re: Using VBScript and XML API for quota management

Hi Chris, it's been a while since I posted this, since then I had eventually figured out how to use the Msxml2.ServerXMLHTTP.6.0 object, so I was able to do some basic XML stuff with VBscript, but I would still be interested in any Powershell code that you would be willing to share.

Thanks.

0 Kudos
cking220011
1 Copper

Re: Using VBScript and XML API for quota management

Hopefully I did this right and you get to: https://community.emc.com/docs/DOC-20865

0 Kudos
Rainer_EMC
5 Rhenium

Re: Using VBScript and XML API for quota management

thanks Chris

Its very helpful to share code examples

0 Kudos
tomer77
1 Copper

Re: Using VBScript and XML API for quota management

i'm still trying to get the script against my VNX5300 but i can't succeed. unfortunately, i can't solve the errors of the cert but i think thats not the big issue, but it seems that the scritp isn't running on my site:

Do you have any idea whats wrong ? I'm on 7.1.71.1 code:

PS U:\emc> .\get-nas-cifs-share.ps1 *fs*

Exception calling "send" with "0" argument(s): "The certificate authority is invalid or incorrect

"

At U:\emc\get-nas-cifs-share.ps1:33 char:1

+ $objHTTP.send()

+ ~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : ComMethodTargetInvocation

Exception calling "send" with "1" argument(s): "The certificate authority is invalid or incorrect

"

At U:\emc\get-nas-cifs-share.ps1:42 char:1

+ $objHTTP.send($cifsURL)

+ ~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : ComMethodTargetInvocation

You cannot call a method on a null-valued expression.

At U:\emc\get-nas-cifs-share.ps1:49 char:1

+ $xml = $response.Replace("<ResponsePacket xmlns=`"http://www.emc.com/schemas/cel ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.

At U:\emc\get-nas-cifs-share.ps1:50 char:1

+ $xml = $xml.Replace("</ResponsePacket>", "")

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.

At U:\emc\get-nas-cifs-share.ps1:53 char:1

+ $shares = $xml.SelectNodes("/Response/CifsShare")

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.

At U:\emc\get-nas-cifs-share.ps1:56 char:6

+                     $server = $_.SelectNodes("CifsServers/li")."#text"

+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : InvokeMethodOnNull

PS U:\emc>

0 Kudos