WinBatch® Technical Support Forum

Archived Boards => COM Automation and dotNet => Topic started by: mathia on February 28, 2014, 07:04:30 AM

Title: Quest AD tools
Post by: mathia on February 28, 2014, 07:04:30 AM
Has anyone been able to get these to work in Winbatch?  I probably need to do more studying up on using CLR, but I thought I would give it a shot.  I am finding that I don't know enough about dll's in general to make much headway.  So far, I've got...

assemblydir = 'C:\Program Files\Quest Software\Management Shell for AD\'
ObjectClrOption('appbase',assemblydir)
ObjectClrOption ('use','Quest.ActiveRoles.ArsPowerShellSnapIn, Version=1.1.0.0, Culture=neutral, PublicKeyToken=37ba620bec38a887')

ref = ObjectClrNew( 'Quest.ActiveRoles.ArsPowerShellSnapIn')

It seems to load, but fails on the last step.  I am not sure what the entry should be.  I'm not actually sure I am even using the correct dll.
Title: Re: Quest AD tools
Post by: Deana on February 28, 2014, 08:09:07 AM
Sorry not familiar with Quest AD tools. Do you have the documentation for the assembly?

If its a PowerShell cmdlet you want to execute see:  http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/dotNet/System_Management/Automation/PowerShell+PowerShell~Invoke~Command~with~Grid~PassThru.txt
Title: Re: Quest AD tools
Post by: td on February 28, 2014, 09:37:21 AM
Quote from: mathia on February 28, 2014, 07:04:30 AM
Has anyone been able to get these to work in Winbatch?  I probably need to do more studying up on using CLR, but I thought I would give it a shot.  I am finding that I don't know enough about dll's in general to make much headway.  So far, I've got...

assemblydir = 'C:\Program Files\Quest Software\Management Shell for AD\'
ObjectClrOption('appbase',assemblydir)
ObjectClrOption ('use','Quest.ActiveRoles.ArsPowerShellSnapIn, Version=1.1.0.0, Culture=neutral, PublicKeyToken=37ba620bec38a887')

ref = ObjectClrNew( 'Quest.ActiveRoles.ArsPowerShellSnapIn')

It seems to load, but fails on the last step.  I am not sure what the entry should be.  I'm not actually sure I am even using the correct dll.

Your best bet may very well be doing as Deana suggested and use the dotNet FCL Powershell classes to execute cmdlets. 

In theory, it might be possible to access the classes contained in the Quest.ActiveRoles.ArsPowerShellSnapIn assembly directly without having to use the PowerShell classes.  A call to ObjectClrNew might look something like

Code (winbatch) Select
objComp = ObjectClrNew( 'Quest.ActiveRoles.ArsPowerShellSnapIn.QADComputer')

This is only a very uneducated guess so I have no idea if it will work.  If you happen to be the adventurous type and with time to kill, it might be worth a try.