Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

vRO + Get-Tag issue

$
0
0

Hey guys,

 

I havnt been able to find an answer to this question so i thought i would see if anyone here has tried this before. I am currently trying to get an action going to do dynamic input off a script i am writing. When i run this script on the PS server itself it does exactly what i would like it to do, that is display all the names only under the get-tag command. Whats odd is that when i set an script in vRO to launch an external script it always errors out on the Get-Tag command saying " Get-Tag      Value cannot be null.". To trouble shoot my issue I have been doing some log sending on the PS side to see what the variable looks like when it gets sent from vRO, and to me it looks normal. I have tried various combinations to get it to stop with this error but at the end i cant seem to get past it. It is basically the same issue this person is experiencing https://communities.vmware.com/thread/509103?start=0&tstart=0 but with no answers. The goal is to have an action that queries for all the user names in presentation mode and after the user selects the name it would than set the tag for that VM created. Thanks guys for your help with this!! I am also using vRO 7.2 with the latest PowerCli.

 

Error:

(com.vmware.library.powershell/invokeScript) Error in (Dynamic Script Module name : invokeScript#14) PowerShellInvocationError: Errors found while executing script

VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.VimException: 11/29/2016 12:29:04 PM   Get-Tag      Value cannot be null.

Parameter name: collection    ---> System.ArgumentNullException: Value cannot be null.

Parameter name: collection

   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)

   at VMware.VimAutomation.ViCore.Impl.V1.Service.ViCoreObjectInteropCoreServiceProviderImpl.GetObn(IList`1 connectionIdList, IList`1 objectNameList, IList`1 objectInterfaceTypeList, IList`1 contextList)

   at VMware.VimAutomation.Sdk.Impl.V1.CoreServiceImpl.GetObn(IList`1 connectionIdList, IList`1 objectNameList, IList`1 objectInterfaceTypeList, IList`1 contextList, String contextRelationName)

   at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.GetObjectsByNameCore(PropertyInfo parameter, String objectName)

   at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.SelectObjectByNameCore(PropertyInfo parameter, String objectName)

   at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.SelectObjectByName(PropertyInfo parameter)

   at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.SelectObjectsByName()

   at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()

   at VMware.VimAutomation.ViCore.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()

   --- End of inner exception stack trace ---

   at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)

 

Snippet of my powercli script:

 

param(

$TagType

)

 

$tag = [String]$TagType

$tag | Out-File D:\Scripts\Logs\tags.txt -Append

if($tag -ne $null){

$TagName = New-Object System.Collections.ArrayList

$TagArray = Get-Tag -Category $tag | select -ExpandProperty Name | ? {$_}

    foreach ($IndTag in $TagArray) {

 

 

    $TagName.Add($IndTag)

    }

}

 

Snippet of the vRO script:

 

try{

  session = PSHost.openSession();

  System.log(session);

 

  var arguments = TagType; <---- This is just an input string using the word Owner

  System.log(arguments);

 

 

  var script =  '& "' + ScriptPath + '" ' + arguments;

  System.log(script);

 

  Output = System.getModule("com.vmware.library.powershell").invokeScript(PSHost,script,session.getSessionId());

 

On the log side of the PS server this is what it appends to a txt file for me:

 

Owner

utlvcend

utlvcenp

utlvcenp


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>