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

Invoke-VMScript to ps script using RunAsUser and LoadProfile as local administrator

$
0
0

Hello, I'd like to run the following PS script under a domain\service account which is a local admin on the machine.

 

The problem, I am having with the below script, that it needs to be logged in ie. load the user profile of the user in order to register all the services etc.

 

I found one example that Luc has provided, but I can seem to figure out how to make it work.

 

$script06 = 'Configure_XD_SiteA.ps1'

$ISOpath = 'D:\Deploy\Applications\Citrix\XenDesktop'

$fullpath06 = join-path -path $ISOpath -childpath $script06

 

$CTXServiceUser = "CTXLAB\Service.vad"

$CTXServicePWord = ConvertTo-SecureString -String "VMware1!" -AsPlainText -Force

$CTXServiceCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $CTXServiceUser, $CTXServicePWord

 

Write-Verbose -Message "Configure XenDesktop Site." -Verbose

Invoke-VMScript -VM $vm -ScriptText $fullpath06 -GuestCredential $CTXServiceCredential -ScriptType Powershell

 

Many thanks!

MP


Viewing all articles
Browse latest Browse all 180329

Trending Articles



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