.net script with Powershell

Hi,

Im trying to run just a basic runbook which grabs the string from the SR and do some magic in PS. When i run the script in ISE (with scorch account) it runs great, even if i try with step trought i completes, but when it is run auto it failes on .net script

I whent through many articles regarding powershell and orchestrator. Script is based on powershell bestpractices.

$DataBusInput1 = "\`d.T.~Ed/{613484C6-C7F4-41BB-B1CA-A388EC02C929}.{23AF8698-5852-4AC3-B8E6-529135D1D6F0}\`d.T.~Ed/"

$DataBusInput2 = "\`d.T.~Vb/{FE4626E4-3EAB-47CF-ACD0-64C3AAB9E86F}\`d.T.~Vb/"

#-----------------------------------------------------------------------

## Initialize result and trace variables

# $ResultStatus provides basic success/failed indicator

# $ErrorMessage captures any error text generated by script

# $Trace is used to record a running log of actions

$ResultStatus = ""

$ErrorMessage = ""

$Trace = (Get-Date).ToString() + "`t" + "Runbook activity script started" + " `r`n"

# Create argument array for passing data bus inputs to the external script session

$argsArray = @()

$argsArray += $DataBusInput1

$argsArray += $DataBusInput2

# Establish an external session (to localhost) to ensure 64bit PowerShell runtime using the latest version of PowerShell installed on the runbook server

# Use this session to perform all work to ensure latest PowerShell features and behavior available

$Session = New-PSSession -ComputerName $env:COMPUTERNAME -Authentication Default -EnableNetworkAccess

# Invoke-Command used to start the script in the external session. Variables returned by script are then stored in the $ReturnArray variable

$ReturnArray = Invoke-Command -Session $Session -Argumentlist $argsArray -ScriptBlock {

I also could not find the Powershell IP 1.2 anywhere.

Thanks anyone/everyone for the help

Bostjan

1 reply