Not identifying custom cmdlets when the batch file to launch a powershell script is invoked through a window service


hi,

i've powershell script consists of custom cmdlets stored in powershell profiles.

i made batch file invoke script this:

powershell.exe c:\myscript.ps1 -remotemachineslist abc123,abc456 -testserver xxx.xxx.xx.xxx -testversion 3.7

when run batch file normally(by double clicking), script runs identifying custom cmdlets used in script.

but when invoke same via windows service, batch file invoked, in turn launches powershell script , says term not recognized name of cmdlet, funtion, script file,..... , closes window. i'm able see gui because i'm calling cmd.exe application using 'startprocessandbypassuac' in windows service.

what's difference makes here not identifying custom cmdlets ? can see both ways opens cmds , powershell windows in admin mode itself. please .

thanks in advance,

/aravind 


if there noprofile need specify explicitly in script includint location of modules want load.

services not load profiles.   do.  contact service vendor assistance.


¯\_(ツ)_/¯



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

server manager error: ADAM.events.xml could not be enumerated.

Cannot access Anywhere Access using domain name?

WMI Failure: Unable to update Local Resource Group