Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 180259

Import-Module via scheduled task results in different $env:modulepath

$
0
0

Just upgraded to PowerCLI 6.0 R3

Has anyone run into this?  I was updating my scheduled task scripts to start importing the module rather than adding the snapins, but for some reason when task scheduler runs the scripts, it basically errors out w/ unable to find valid module.

 

When the task scheduler job as the service account runs it, $env:modulepath looks like this:

C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;D:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\;C:\Dell_PSCmdlets;C:\Program Files (x86)\AWS Tools\PowerShell\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement


When I run it interactively as the service account, I see that the module is listed properly in the modulepath environment variable.

C:\Users\svcLDAPVMware\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;D:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\;C:\Dell_PSCmdlets;C:\Program Files (x86)\AWS Tools\PowerShell\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement;D:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules


Viewing all articles
Browse latest Browse all 180259

Trending Articles



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