Invoke Powershell Activity


#1

i want to run powershell script and it will give an integer type output
i have used read text file to read my ps script
so i have tried with invokepowershell activity but i am getting the below error:

Source: Throw

Message: Unable to cast object of type ‘System.Int32’ to type ‘UiPath.Core.GenericValue’.

Exception Type: InvalidCastException

System.InvalidCastException: Unable to cast object of type ‘System.Int32’ to type ‘UiPath.Core.GenericValue’.
at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

how to resolve this?


#2

Hi,

It looks like your issue is a cast exception. It look that you have a generic value over there and you have to convert to Integer previews to use it. ( cint(yourString)).

Thanks,
Ninett