Quantcast
Channel: VMware Communities : Discussion List - VMware PowerCLI
Viewing all 14549 articles
Browse latest View live

PowerCLI - Deploy VM-templates from CSV

$
0
0

Having issues with a script.  I feel I'm close but I'm still missing something...  I'm not sure if the issue lies within PowerCLI or my lacking PowerShell knowledge. 

 

My PowerCLI 6 script seems to work but only at a low level.  It creates the VMs but doesn't seem to assign the IP or hostname to the newly created VM.  So, when it's time to apply the Customization Specification, it either times out or just doesn't fully apply; I'm not sure which as no errors get spit back at me.  It creates the VM with the correct name & changes the port-group on which the NIC will sit but that seems to be about it.  I've manually tested the Customization Specification and template that are being used in this script and it looks fine after a manual walk-through.  For some reason, some the info from the CSV is not being used correctly or at all.

 

The script I have is pretty long and I didn't want to muck up the page with it so I dumped it on PasteBin; hope that's ok...

 

Script: http://pastebin.com/XwFHLHER

 

CSV: http://pastebin.com/u59TwBu4


Powercli script to get VM resource utilization from VROPS

$
0
0

Hello,

 

We have a vCLoud infrastructure and no access to vCenter as it is managed by third party. We need to get the VM resource utilization for capacity planning.

we have the vROPS to view the VM utilzation but the reporting feature is not enabled for us.

So I am using the power CLI 6.3 R1 to fetch the data from vCloud director and VROPS.

Need help with the script to get VM capacity data from VROPS

FAILED to use cmdlet Invoke-VMScript on a Rhel7 open-vm-tools linux VM

$
0
0

Invoke-VMScript -VM RHEL7VM -ScriptText "/tmp/script.bash" -ScriptType Bash -GuestUser XXXXX -GuestPassword XXXXX

Invoke-VMScript : 3/6/2018 7:03:28 AM    Invoke-VMScript        Permission to perform this operation was denied. Required privilege 'VirtualMachine.GuestOperations.Modify' on managed object with id
'VirtualMachine-vm-47320'. At line:1 char:1

+ Invoke-VMScript -VM vxmip-hswtst03 -ScriptText "/home/automation/script"
-Script ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-VMScript], NoPermission    + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_RunScriptInGuest_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript

is this cmdlet supported on open-vm-tools??

do i need to install wmare WMWareTools?   

 

trying to use cmdlet Invoke-VMScript on a open-vm-tools linux VM
 
Invoke-VMScript -VM RHEL7VM -ScriptText "/tmp/script.bash" -ScriptType Bash -GuestUser XXXXX -GuestPassword XXXXX
 
Invoke-VMScript : 3/6/2018 7:03:28 AM    Invoke-VMScript        Permission to perform this operation was denied. Required privilege 'VirtualMachine.GuestOperations.Modify' on managed object with id
'VirtualMachine-vm-47320'.
 
At line:1 char:1
+ Invoke-VMScript -VM vxmip-hswtst03 -ScriptText "/home/automation/script"
-Script ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-VMScript], NoPermission    + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_RunScriptInGuest_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript

IP Pools, Creating with PowerCLI

$
0
0

So I've been digging through documentation and such, and I cannot figure out how to script creating an IP Pool (with proper settings) for my Datacenters using PowerCLI.  Anyone have any insight into this?

Find all VMs which have ScheduledHardwareUpgradeInfo.UpgradePolicy = "never"

$
0
0

We have discovered an issue which is preventing VMs from migrating in our environment.

 

VMware Knowledge Base

 

This issue occurs if the hardware version upgrade process  fails to update the .vmx file.

 

I would like to determine how widespread this issue is.  I would imagine there is a get-vm statement I can use in PowerCLI with some switches, but I'm unsure how to find these settings.

 

How do I do a get-vm statement which will find the following lines in the .vmx file?

 

virtualHW.scheduledUpgrade.when = "always"
virtualHW.scheduledUpgrade.state = "done"
tools.upgrade.policy = "upgradeAtPowerCycle"

 

Thanks.

Powercli Script To Move VM's from 1 Virtual Machine DRS Group To Another Virtual Machine DRS Group and then back again.

$
0
0

Hello Group

 

I am looking for a powercli script to add vms to a Virtual Machine DRS group, without the need to manually add each vm to the group.

Not sure if this is possible or what is required, so any help would be greatly appreciated.

 

Kind Regards

 

Jitla

How would I extract targets, devices, and paths info from an HBA?

$
0
0

Hi all,

 

How would I extract targets, devices, and paths info from an HBA?

 

 

Thanks!

 

-Chris

Interactive Hard Disk Edit Function

$
0
0

Hello!

 

I am working on a function that will moderately ask for interaction from the user when calling it up. My issue is right from the beginning, when I am trying to list the current hard disks, it is not showing up - as if the line in the function is not there

 

#Interactive hard disk expansion

function Add-VMDiskSpace {

    [cmdltbind()]

    param(

        [Parameter(Mandatory=$true)][string]$VM,[string]$IncreaseSpaceGB ='20'

        )

    process {

    #Show current disks

    Write-Host "Current disks..." -ForegroundColor Yellow

    Get-HardDisk $VM | Select CapacityGB,Name<--- Being skipped and going right to the prompt in the next line

    #Input name of disk to increase

    $HardDisk = Read-Host -Prompt "Specify hard disk name to resize"

    #Get the size of disk

    $Size = Get-HardDisk -Name $HardDisk | Select-Object -ExpandProperty CapacityGB

    #Increase size of disk by the $IncreaseSpaceGB

    Get-HardDisk -Name $HardDisk $VM | Set-HardDisk -CapacityGB ($Size + $IncreaseSpaceGB) -Confirm:$true

    #Notify operation is complete

    Write-Host "Disk has been expanded." -ForegroundColor Green

    }

}

Have not been able to get much further yet, as I'm scratching my head as to why the first piece won't show up. The idea is to show the list of disks for the person to choose from, rather than doing it in a separate command sequence.

 

The function call is as

Add-VMDiskSpace -VM testvm -IncreaseSpaceGB 5

... and for me, goes to ...

Specify hard disk name to resize:

But there is no error as if the param is not being read or is seen as null. Not sure if there is a syntax issue with the mandatory params or not. Or something elsewhere.

 

EDIT: Changed the

| Select CapacityGB,FileName

to

| Select CapacityGB,Name


PowerCLI 6.5 Release 1 and get-remotesessions

$
0
0

Hello:

I am testing out VMware PowerCLI 6.5 Release 1 on a new server
Everything seems to be working out except for one cmdlet that we are using in our scripts.

I understand that The Get-remotesession cmdlet was present in the old View module (and only works with powershell 2.0) and on the CS server only.

My question is there any similar cmdlet in 6.5.1?
Our current scripts queries the duration of a remote session.

PS C:\Users\administrator.VLAB> Get-RemoteSession


session          : 0
Username         : xxxx
pool_id          : xxxx
startTime        : Thu Feb 15 08:12:15 PST 2018
session_id       : xxxx
DNSName          : xxxx
duration         : 22 minutes
lastSessionTicks : -1223468
state            : CONNECTED
protocol         : BLAST

BTW, is there page that has a list of arguments that you can pass the VMware.HV.Helper cmdlets?

Thanks,
Chris

Hello:
 
I am testing out VMware PowerCLI 6.5 Release 1 on a new server
Everything seems to be working out except for one cmdlet that we are using in our scripts.
 
I understand that The Get-remotesession cmdlet was present in the old View module (and only works with powershell 2.0) and on the CS server only.
 
My question is there any similar cmdlet in 6.5.1?
Our current scripts queries the duration of a remote session.
 
PS C:\Users\administrator.VLAB> Get-RemoteSession

How to check raid status with script

$
0
0

Hi, Friends.

Could you help me please.

I have ESXi host with LSI controller MegaRAID SAS 9361-8i , I also installed a storcli package on it, to check the state of the array.

The path were storcli is installed on ESXi is: /opt/lsi/storcli/storcli

Also a have windows machine with vSphere Perl SDK for vSphere 6.0 - VMware {code}

And, could you help me, how i can execute perl script on windows machine with Powercli ?

I tried 2 scripts:

https://www.thomas-krenn.com/en/wiki/LSI_RAID_Monitoring_Plugin

checkraid | unixadm.org

with this code (for example), but there is errors:

 

 

function Add-vCLIfunction {

  <#

  .SYNOPSIS

    Adds the VMware vSphere Command-Line Interface perl scripts as PowerCLI functions.

 

  .DESCRIPTION

    Adds all the VMware vSphere Command-Line Interface perl scripts as PowerCLI functions.

    VMware vSphere Command-Line Interface has to be installed on the system where you run this function.

    You can download the VMware vSphere Command-Line Interface from:

    http://communities.vmware.com/community/vmtn/server/vsphere/automationtools/vsphere_cli?view=overview

 

  .EXAMPLE

    Add-vCLIfunction

    Adds all the VMware vSphere Command-Line Interface perl scripts as PowerCLI functions to your PowerCLI session.

 

  .COMPONENT

    VMware vSphere PowerCLI

 

  .NOTES

    Author:  Robert van den Nieuwendijk

    Date:    21-07-2011

    Version: 1.0

  #>

 

  process {

    # Test if VMware vSphere Command-Line Interface is installed

    If (-not (Test-Path -Path "C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\")) {

      Write-Error "VMware vSphere CLI should be installed before running this function."

    }

    else {

      # Add all the VMware vSphere CLI perl scripts as PowerCLI functions

      Get-ChildItem -Path "C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\*.pl" | ForEach-Object {

        $Function = "function global:$($_.Name.Split('.')[0]) { perl 'C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\$($_.Name)'"

        $Function += ' $args }'

        Invoke-Expression $Function

      }

    }

  }

}

 

 

Add-vCLIfunction

$env:VI_USERNAME="root"

$env:VI_PASSWORD="My_password"

Get-VMHost russiam322 | ForEach-Object {

  check_lsi_raid --server $_.Name -p /opt/lsi/storcli/storcli

}

---

 

if I try if with terminal, i have something like this:

cd /opt/lsi/storcli

./storcli /c0 show

Could anybody help me please.

Can someone help me with formatting the output of this script into an easily readable CSV?

$
0
0

Can someone help me with formatting the output of this script into an easily readable CSV?

 

Import-Module VMware.VimAutomation.Core

Import-Module VMware.VimAutomation.VDS

Connect-VIServer -Server X.X.X.X -Protocol https -User administrator@vsphere.local -Password password

$VMhosts = Get-VMHost

$hosts = $VMhosts.Name

 

 

foreach($i in $hosts){

echo $i

$esxcli = Get-EsxCli -VMHost $i

$x=$Esxcli.network.nic.list() | Select-Object *, @{N="FirmwareVersion"; E={$Esxcli.network.nic.get($_.name).driverinfo.firmwareVersion}}, @{N="Version"; E={$Esxcli.network.nic.get($_.name).driverinfo.Version}}

$y = $esxcli.software.vib.list() | Where-Object {$_.ID -Like "*ixgbe*"}

echo $y | Select-Object -Property ID

echo $x | Select-Object -Property Name,Version

}

Script to show Powered Off VM along with Tag

$
0
0

Can anybody help me out? 

 

I need script that will show me what tag is assigned to a machine but only on machines that are powered off.

 

So far I have:

Get-VM |

 

Select-Object Name, 

@{N = 'Tags'; E = {(Get-TagAssignment -Entity $_).Tag -join '|'}} |

Export-Csv c:\PoweredOffTag.csv

 

This brings back the tags for all machines I am not sure where to place the "And" so that it queries just powered off VM's.

 

TIA.

PowerCLI script to Export standalone ESXi host License

$
0
0

Hi,

 

Could you you please help with correct script to Export standalone 200 vSphere6 ESXi host License. All hosts have common credentials and few are part of vCenter servers and few stand alone.

 

Regards,

The specified Href 'https://URL/api/Internal errror: ComposeOperationHref() : serviceUrl is not prefix of sourceHref' is not valid.

$
0
0

We're having issues setting up a PowerCLI script that automates creation of a new-org within vCloud Director 9.

The error PowerCLI is prompting: New-Org         The specified Href 'https://URL/api/Internal errror: ComposeOperationHref() : serviceUrl is not prefix of sourceHref' is not valid.

 

This environment is running vCloud Director 9.0.0.7553273 and we tryed both PowerCLI 6.5 and now 10.0 but same error.

We do know that regarding the compatibility matrix VMware Product Interoperability Matrices there is no support for vCD 8.2 and above with PowerCLI but I want to know if this is a problem with vCD or with the script.

 

Can you point me in the right direction?

 

Thanks in advance!

 

How to pull all the properties for Vmware tools advanced settings through power cli

$
0
0

Only on some of the windows Vm's in our production environment,  We noticed that restarting the vmware tools service within the guestOs updates the vmware tools and then reboots the machine automatically.

Interestingly we don't see all the Vm's reporting this behaviour although atleast from Gui level we can settings remain the same for affected and not-affected machines.

We are unable to repro this on a stock windows Vm with all the tools version available. There is absolutely no pattern seen at all. 

 

The only workaround is to uncheck the option that says " Check and upgrade tools during powercycle" before the service is restarted and then check this once the service is up. 

Fyi.We have VCO in the environment which auto checks the box for all the VM's in the environment.,

 

 

Why this question on power-cli blog ? 

 

>> What would be the script to pull all the advanced settings (every single thing)  related to Vmware tools so that we can compare the affected and not-affected machine settings and see if there is any additional flag on the affected machine which got to be removed to stop this issue.

  By the way we have exhausted enabling debug logging, opening support case with Vmware etc


move-vm - The specified delta disk format 'redoLogFormat' is not supported

$
0
0

Hi,

we are trying to migrate from VMFS5 datastore to VMFS6. As usually, I have tried simple script doing Move-VM. But it fails on vm with snapshots with error:

 

 

Move-VM   

The operation for the entity "xxx" failed with the following message: "The specified delta disk format 'redoLogFormat' is not supported."`

 

I have found this error also here PowerCLI Core - Bugs

 

Bugs bugs and bugs?

QLogic firmware version via PowerCLI

$
0
0

Hello, I checked all posts in this community and even outside of it. It seems that there is no way via PowerCLI to get the HBA firmware version unless going via plink and run something like this for instance:

 

"/usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -a | grep -i 'FW Version'"

 

Again, I checked all posts and although they report in the title or somewhere that they extract hba firmware version, they don't, at least through PowerCLI. However those posts are not very recent. So, is it still the case? I'd like to get rid of plink in my scripts possibly but this point is still bugging me. I have QLogic

 

 

Many thanks!

Hardening Script Problems

$
0
0

Hello, I am trying to write a script to harden a vSphere 6.5 host so I can build a host profile from one host to apply to the others in a newly built environment. I am having trouble with two lines of the script:

 

Get-VMHost -name $H |  Set-VMHostAdvancedConfiguration Syslog.global.logDir -Value [vsanDatastore]Logs

Get-VMHost -name $H |  Set-VMHostAdvancedConfiguration Syslog.global.logDirUnique -Value True

 

In both cases $H is the hostname

 

I have also tried this:

 

Get-AdvancedSetting -Entity (Get-vmhost -Name $H) -Name Syslog.global.logDir | Set-AdvancedSetting -Value "[vsanDatastore]Logs" -confirm:$false

 

Both fail with a rather nondescript error. Any ideas what might be wrong?

 

Thanks in advance.

PowerCLI script to disable vm affinity rules

$
0
0

I have a script to list VM affinity rules for all clusters in every datastore:

 

ForEach ($dc
inGet-Datacenter){$dc|Get-Cluster|Get-DrsRule–typeVMHostAffinity|
sortcluster
|selectName,Cluster,Enabled,
@{N=’DataCenter’;E={$dc}

}}

 

Is there a way to disable VM affinity rules for clusters by name? For example:

 

For all clusters in all datacenters in vCenter01

If -cluster.name = Cluster01,cluster02

then do nothing

else

affinityrules = remove

 

Above is just a rough draft of what im trying to accomplish and working on now. Any ideas?

Using customization specifications with Content Library ovf

$
0
0

Problem statement:
We are in the process of converting our provisioning code from utilizing conventional Templates stored in specific datastores to leveraging a Content Library per datacenter to allow templates to be used across a larger surface area.  Reading through the documentation for PowerCLI New-VM doesn't support the -OSCustomizationSpec when the VM is being created from a Content Library.

Question:
Is there a way via powershell and powercli (or other means) to set the OS Customization Spec after a vm has been created via New-VM?  If so, what am I missing?

Notes:
Current snippet is as follows.

# Workaround for misplaced Templates in various datacenters $templateName = Get-MyTemplateName -Site $decodedname.Site -OS $server.OperatingSystem -Version $server.OperatingSystemVersion -Server $vcenter -Credential $Credential # -DataCenter $datacenter $datacentername = Get-MyDataCenterName -Server $vcenter -Site $decodedname.Site -Zone $decodedname.Zone -Credential $Credential $clustername = Get-MyClusterName -Server $vcenter -Site $decodedname.Site -Zone $decodedname.Zone -Category $server.Category -Credential $Credential #-ComputerName $server.ComputerName $foldername = Get-MyFolderName -Server $vcenter -Type VM -ApplicationCode $decodedname.App -Datacenter $datacentername -Credential $Credential #-ComputerName $server.ComputerName # Build the hashtable which will be used to splat params to the call to New-VM $params = @{} $params.'Name' = $server.ComputerName.ToUpper() $params.'Datastore' = try { $datastoreclustername = Get-MyDataStoreClusterName -Server $vcenter -Category $server.Category -Credential $Credential Get-DatastoreCluster -Name $datastoreclustername -Server $vcenter -ErrorAction Stop } catch { $datastorename = Get-MyDataStoreName -Server $vcenter -ComputerName $server.ComputerName -Credential $Credential Get-Datastore -Name $datastorename -Server $vcenter } $params.'ResourcePool' = try { Get-Cluster -Name $clustername -Server $vcenter -ErrorAction Stop } catch { Get-VMHost -Name $clustername -Server $vcenter } $params.'ContentLibraryItem' = Get-ContentLibraryItem -Name $templateName.Name -Server $vcenter | Where-Object{$_.ContentLibrary.Name -eq ($templateName.ContentLibrary).Name} $params.'Location' = Get-Folder -Name $foldername -Server $vcenter -Location $datacentername $params.'Server' = $vcenter $params.'OSCustomizationSpec' = try { $customizationParams = @{} $customizationParams.'Name' = $server.ComputerName $customizationParams.'IPAddress' = $ipaddress $customizationParams.'SubnetMask' = Get-MySubnetMaskFromCIDR -CIDR $server.CIDRAddress.Split('/')[1] $customizationParams.'DefaultGateway' = Get-MyDefaultGatewayFromIPAddress -IPAddress $customizationParams.IPAddress $customizationParams.'Dns' = Get-MyDNSServerIPAddress -Site $decodedname.Site -Zone $decodedname.Zone $customizationParams.'Server' = $vcenter $customizationParams.'Specification' = ('OSC_{0}_{1}' -f $server.OperatingSystem,$server.Domain).ToUpper() $customizationParams.'Credential' = $Credential New-EzVmOSCustomizationSpec @customizationParams } catch { $customizationspec = Get-OSCustomizationSpec -Name ('temp_{0}' -f $params.Name) -ErrorAction SilentlyContinue if ($customizationspec -ne $null) { Remove-OSCustomizationSpec -OSCustomizationSpec $customizationspec -Confirm:$false -ErrorAction Stop } Write-Error ('Could not create OSCustomization Spec for {0}. Error details: {1}' -f $server.ComputerName,$Error[0].Exception) } Write-Verbose ('Creating virtual machine {0} using parameters:' -f $server.ComputerName) # Create the new VM try { $vm = New-VM @params -ErrorAction Stop # Doesn't work currently with OS Customization Specifications due to implementation of Content Library for storage of templates.
# How could we apply the OS Customization Specification after the New-VM command?

} catch { Write-Error ('Could not create VM {0}. Error details: {1}' -f $server.ComputerName,$Error[0].Exception) continue } finally { Remove-OSCustomizationSpec -OSCustomizationSpec $params.OSCustomizationSpec -Confirm:$false -ErrorAction Stop }

    # Workaround for misplaced Templates in various datacenters
    $templateName = Get-F5VMWareTemplateName -Site $decodedname.Site -OS $server.OperatingSystem -Version $server.OperatingSystemVersion -Server $vcenter -Credential $Credential # -DataCenter $datacenter
 
    $datacentername = Get-F5VmWareDataCenterName -Server $vcenter -Site $decodedname.Site -Zone $decodedname.Zone -Credential $Credential
    $clustername = Get-F5VmWareClusterName -Server $vcenter -Site $decodedname.Site -Zone $decodedname.Zone -Category $server.Category -Credential $Credential  #-ComputerName $server.ComputerName
    $foldername = Get-F5VmWareFolderName -Server $vcenter -Type VM -ApplicationCode $decodedname.App -Datacenter $datacentername -Credential $Credential #-ComputerName $server.ComputerName
    
    # Build the hashtable which will be used to splat params to the call to New-VM
    $params = @{}
    $params.'Name' = $server.ComputerName.ToUpper()
    $params.'Datastore' = 
        try 
        { 
            $datastoreclustername = Get-F5VmWareDataStoreClusterName -Server $vcenter -Category $server.Category -Credential $Credential
            Get-DatastoreCluster -Name $datastoreclustername -Server $vcenter -ErrorAction Stop
        }
        catch 
        {
            $datastorename = Get-F5VMWareDataStoreName -Server $vcenter -ComputerName $server.ComputerName -Credential $Credential
            Get-Datastore -Name $datastorename -Server $vcenter
        }
 
    $params.'ResourcePool' = 
        try 
        {
            Get-Cluster -Name $clustername -Server $vcenter -ErrorAction Stop 
        }
        catch 
        {
            Get-VMHost -Name $clustername -Server $vcenter
        }
 
    $params.'ContentLibraryItem' = Get-ContentLibraryItem -Name $templateName.Name -Server $vcenter | Where-Object{$_.ContentLibrary.Name -eq ($templateName.ContentLibrary).Name}
    $params.'Location' = Get-Folder -Name $foldername -Server $vcenter -Location $datacentername
    $params.'Server' = $vcenter
    $params.'OSCustomizationSpec' = 
        try 
        {
            $customizationParams = @{}
            $customizationParams.'Name' = $server.ComputerName     
            $customizationParams.'IPAddress' = $ipaddress 
            $customizationParams.'SubnetMask' = Get-F5SubnetMaskFromCIDR -CIDR $server.CIDRAddress.Split('/')[1]
            $customizationParams.'DefaultGateway' = Get-F5DefaultGatewayFromIPAddress -IPAddress $customizationParams.IPAddress
            $customizationParams.'Dns' = Get-F5DNSServerIPAddress -Site $decodedname.Site -Zone $decodedname.Zone
            $customizationParams.'Server' = $vcenter
            $customizationParams.'Specification' = ('OSC_{0}_{1}' -f $server.OperatingSystem,$server.Domain).ToUpper()
            $customizationParams.'Credential' = $Credential
 
            New-EzVmOSCustomizationSpec @customizationParams
        }
        catch 
        {
            $customizationspec = Get-OSCustomizationSpec -Name ('temp_{0}' -f $params.Name) -ErrorAction SilentlyContinue
            
            if ($customizationspec -ne $null) {
                Remove-OSCustomizationSpec -OSCustomizationSpec $customizationspec -Confirm:$false -ErrorAction Stop
            }
            
            Write-Error ('Could not create OSCustomization Spec for {0}.  Error details: {1}' -f $server.ComputerName,$Error[0].Exception)
        }
 
    Write-Verbose ('Creating virtual machine {0} using parameters:' -f $server.ComputerName)
 
    # Create the new VM
    try 
    {
        $vm = New-VM @params -ErrorAction Stop # Doesn't work currently with OS Customization Specifications due to implementation of Content Library for storage of templates.
        
    }
    catch
    {
        Write-Error ('Could not create VM {0}.  Error details: {1}' -f $server.ComputerName,$Error[0].Exception)
 
        continue
    }
    finally 
    {
        Remove-OSCustomizationSpec -OSCustomizationSpec $params.OSCustomizationSpec -Confirm:$false -ErrorAction Stop
    }
Viewing all 14549 articles
Browse latest View live


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