Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 179681

Running PowerCLI scripts remote from the vCenter server using LocalSystem

$
0
0

Hi

 

I have an issue where I need to run remote PowerCLI command on a server remotely from the vCenter Server itself using an orchestration tool. The orchestrator currently runs under the LocalSystem context which is where I'm seeing the following behaviour. If I run the same script directly on the vCenter box using LocalSystem I'm fine - the only issue I have is when I run remote PowerCLI scripts with LocalSystem

*As a last resort - I could change the user the orchestrator runs with - but this is last resort and wouldn't know what else would break if I did this *

Also, any ideas where I go to debug this or where to look for hints at why the snapin appears not to load properly?

The kind of output I'm seeing is:

 

Add-PSSnapin : Could not find a part of the path 'C:\Windows\system32\config\sy

stemprofile\AppData\Local\Temp\g3i4hpmm.tmp'.

At C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1:1 char:13

+ Add-PSSnapin <<<< VMware.VimAutomation.Core -ea "SilentlyContinue"

    + CategoryInfo          : NotSpecified: (:) [Add-PSSnapin], DirectoryNotFo

   undException

    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException,Microsoft.P

   owerShell.Commands.AddPSSnapinCommand

 

The term 'Get-PowerCLIVersion' is not recognized as the name of a cmdlet, funct

ion, script file, or operable program. Check the spelling of the name, or if a

path was included, verify that the path is correct and try again.

At D:\CASSP\MoveVM.ps1:77 char:35

+     $version = Get-PowerCLIVersion <<<<

    + CategoryInfo          : ObjectNotFound: (Get-PowerCLIVersion:String) [],

    CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

 

The term 'Connect-VIServer' is not recognized as the name of a cmdlet, function

, script file, or operable program. Check the spelling of the name, or if a pat

h was included, verify that the path is correct and try again.

At D:\CASSP\MoveVM.ps1:231 char:21

+     Connect-VIServer <<<<  -Server $Vserver -User $Vuser -Password $Vpassword

-WarningAction SilentlyContinue >$null

    + CategoryInfo          : ObjectNotFound: (Connect-VIServer:String) [], Co

   mmandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

 

The term 'Move-VM' is not recognized as the name of a cmdlet, function, script

file, or operable program. Check the spelling of the name, or if a path was inc

luded, verify that the path is correct and try again.

At D:\CASSP\MoveVM.ps1:243 char:12

+     Move-VM <<<<  -VM $VMname -destination $ContentionPool -confirm:$false

    + CategoryInfo : ObjectNotFound: (Move-VM:String) [], CommandNotF

   oundException

    + FullyQualifiedErrorId : CommandNotFoundException

 

The term 'Disconnect-VIServer' is not recognized as the name of a cmdlet, funct

ion, script file, or operable program. Check the spelling of the name, or if a

path was included, verify that the path is correct and try again.

At D:\CASSP\MoveVM.ps1:246 char:24

+     Disconnect-VIServer <<<<  -Server $Vserver -confirm:$false

    + CategoryInfo          : ObjectNotFound: (Disconnect-VIServer:String) [],

    CommandNotFoundException

  + FullyQualifiedErrorId : CommandNotFoundException


Viewing all articles
Browse latest Browse all 179681

Trending Articles



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