Reputation: 23
I am having a problem with my Powershell Workflow that I am authoring in Windows Azure Pack Admin Site. In Powershell ISE, the following works but in Service Management Portal Admin Site Runbook Authoring, it does not work. Where it is getting stuck is that it is saying that it cannot validate the arguments passed -Name. I remove -Name out and now -FullName doesnt work. It seems like all the switch parameters for the command is not working. Can anyone help me out?
param (
[string]$DomainAdminAcct,
[string]$DomainAdminPass,
[string]$ServerName
)
InlineScript {
Add-PSSnapin VMWare.VimAutomation.Core
$vCenter = "test300"
Connect-ViServer -server $vCenter -ErrorAction Stop
$myCluster = Get-Cluster -Name "DC Test"
$myTemplate = Get-Template -Name "2012dc" -Location "our company"
$OSCustomizationSpec = New-OSCustomizationSpec –Name “$ServerName” –FullName “$ServerName” –OrgName “our company” –Domain “our.domain.com” –DomainUsername “$DomainAdminAcct” –DomainPassword "$DomainAdminPass" -AdminPassword "changeme" -ChangeSid
New-VM -Name $ServerName -ResourcePool $myCluster -Template $myTemplate -OSCustomizationSpec $OSCustomizationSpec
}
}
Upvotes: 0
Views: 201
Reputation: 1
for using parameters inside INLINESTRING structure, you must use $using:<>
Upvotes: 0
Reputation: 893
Sounds like you have Hyper-V and PowerCLI modules loaded and the commands are conflicting. It is trying to run New-VM from the Hyper-V module. You can confirm this by running:
get-command New-VM -all
You should see two commands one from the Hyper-V module and one from the Vmware module. To get past the problem you can add the module name to the command name:
VMware.VimAutomation.Core\New-VM
Upvotes: 0