Unable to cast object of type 'system.management.automation.PSModuleinfo' to System.management.psobject

Hi All,

During invoke powershell i am getting this error.

“unable to cast object of type ‘system.management.automation.PSModuleinfo’ to System.management.psobject”

My script is getting susccessful in powershell ISE.

I am using Read text file in which I am importing session on server with credentials.

Any suggestions for this error.