Running Powershell Script with Orchestrator

Posted on 2013-06-12
Last Modified: 2013-06-12
The script works fine, but when run in Orhestrator I receive the following error:
error summary text: Only administrators can change settings for all users

This does not give me any clue.

The code gibberish below is from Orhestrator that is used for mapping values from other parts of the runbook to the script:
$vCenterHost = "xx.xx.xx.xx"
$vCenterUser = "xxx\xxxxxxxx"
$vCenterPass = "xxxxxxxx" 

$vmcluster = "\`d.T.~Ed/{3CE14789-2A92-4CFA-9D49-07125D3B5632}.{6004C665-6069-46F9-B0FC-496CBFD3B2AD}\`d.T.~Ed/"
$datastorecluster = "\`d.T.~Ed/{3CE14789-2A92-4CFA-9D49-07125D3B5632}.{8B61C2D5-95E5-45BF-9817-1618132FAFE6}\`d.T.~Ed/"
$ErrorID = 0

$vmname = "\`d.T.~Ed/{3CE14789-2A92-4CFA-9D49-07125D3B5632}.{518C9136-0F46-4B22-AA83-D716176BFA8E}\`d.T.~Ed/"
$NumCpu = \`d.T.~Ed/{3CE14789-2A92-4CFA-9D49-07125D3B5632}.{148BAB6B-AA13-409D-84F3-5CFCF5D68D2E}\`d.T.~Ed/
$MemoryGB = \`d.T.~Ed/{3CE14789-2A92-4CFA-9D49-07125D3B5632}.{E266FB8E-D17C-4ED7-8EDA-686BCB994948}\`d.T.~Ed/
$DiskStorageFormat = "\`d.T.~Ed/{3CE14789-2A92-4CFA-9D49-07125D3B5632}.{F9F636A5-3CE0-4B2E-81B9-AB0760979C15}\`d.T.~Ed/"
$osversion = "\`d.T.~Ed/{3CE14789-2A92-4CFA-9D49-07125D3B5632}.{1E4F231A-98EC-4196-815C-F69D2C1813F2}\`d.T.~Ed/"

if(-not (Get-PSSnapin VMware.VimAutomation.Core)) { 
    Add-PSSnapin VMware.VimAutomation.Core 

Set-PowerCLIConfiguration -DefaultVIServerMode Single -InvalidCertificateAction Ignore -confirm:$false
Connect-VIServer -Server $vCenterHost -User $vCenterUser -Password $vCenterPass

$vmname = $vmname.toUpper()

try {
      $name = ((Get-VM $vmname).name).toUpper()
} catch {

if ($name -eq $vmname) { 

	# Server exists

	$ErrorID = "1"
	throw "ERROR: 1 A server already exists with the same name" 

$osversion = $osversion.toUpper()

switch ($osversion)  { 
              "WIN2012" {	"Windows 2012"
			$OSCustomizationSpec = "W2K12-SE-64-CUSTOMIZATION"
			$vmtemplate = "win2012_template"
	"WIN2008" {	"windows 2008"
			$OSCustomizationSpec = "W2K8-SE-64-CUSTOMIZATION"
			$vmtemplate = "W2K8-R2-SE-64-MAL"
	default { 
			$ErrorID = "2"
	                                throw "ERROR: 2 Unknown OS version" 


$vmcluster = $vmcluster.toUpper()

switch ($vmcluster) { 
       	"HOSTECluster_xx" {	
			"annet cluster"
	default { 
			"VMCluster was set to default"
			$vmcluster = "CLUSTER 1"

$datastorecluster = $datastorecluster.toUpper()

switch ($datastorecluster) { 
       	"DatastoreCluster_xx" {	
			"Another datastore"
	default { 
			"Datastore Cluster was set to default"
			$datastorecluster = "DatastoreCluster_01"

Get-Cluster $vmcluster | New-VM -Name $vmname -OSCustomizationSpec $OSCustomizationSpec -DiskStorageFormat $DiskStorageFormat -Template $vmtemplate -Datastore $datastorecluster
Get-VM $vmname | Set-VM -NumCpu $NumCpu -MemoryGB $MemoryGB -confirm:$false
Get-VM $vmname | Start-VM

Open in new window

Question by:itnifl
1 Comment

Accepted Solution

itnifl earned 0 total points
ID: 39240987
I turned off UAC

Featured Post

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
Giving access to ESXi shell console is always an issue for IT departments to other Teams, or Projects. We need to find a way so that teams can use ESXTOP for their POCs, or tests without giving them the access to ESXi host shell console with a root …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question