Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Running Powershell Script with Orchestrator

Posted on 2013-06-12
1
Medium Priority
?
967 Views
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

0
Comment
Question by:itnifl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

704 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