Clean a VSAN data store

I'm running VSAN in a laboratory and have noticed that the folders and files of virtual machines sometimes do not get deleted properly. Is there a command similar to the View Composer replicas VSAN to check unused objects in the data store?

Remove at your own risk by using/usr/lib/vmware/osfs/bin/objtool (run it in esxcli for help), you can check the object using vsan.object_info (in RVC) to get information about the object before you destroy.

I recently had to do this when a storage for vmotion failed 10 to VM and I found that I had lost 10 TB of space on the VSAN target.

Tags: VMware

Similar Questions

  • Disk groups are not visible cluster. vSAN datastore exists. 2 guests (on 8) cluster do not see the vSAN data store. Their storage is not recognized.

    http://i.imgur.com/pqAXtFl.PNG

    http://i.imgur.com/BnztaDD.PNG

    Do not know how even tear it down and rebuild it if the disk groups are not visible. The discs are in good health on each host storage adapters.

    Currently the latest version of vCenter 5.5. Hosts running 5.5 build 2068190

    Just built. Happy to demolish and rebuild. Just do not know why it is not visible on the two hosts and the disk groups are only recognized 3 guests when more are contributing. Also strange that I can't get the disk groups to fill in vCenter. I tried two different browsers (chrome and IE).

    I have now works.

    All the identical 5.5 relies on ESXi hosts. All hosts are homogeneous CPU/sum of the prospects for disk controller / installed RAM/storage.

    I have work. I had to manually destroy all traces of the vSAN on each single to help host node:

    (1) put the hosts in maintenance mode and remove the cluster. I was unable to disable vSAN in the cluster, I made on each node host (manually via the CLI below) then disconnected web client vCenter and return to finally refresh the ability to disable on the cluster.

    esxcli vsan cluster get - to check the status of each host.

    esxcli vsan cluster drop - the vSAN cluster host.

    storage of vsan esxcli list - view records in the individual host group

    esxcli vsan storage remove-d naa.id_of_magnetic_disks_here - to remove each of the disks in the disk group (you can ignore this using the following command to remove the SSD only falling each disc in this host group).

    esxcli vsan storage remove s naa.id_of_solid_state_disks_here - this is the SSD and all the magnetic disks in a given disk group.

    After that, I was able to manually add hosts to the cluster, leave maintenance mode and configure the disk groups. Aggregated data of the vSAN data store is correct now, and everything is functional.

    Another question for those of you who still read... How to configure such as the VM storage strategy that migrates towards (or inspired) the vSAN data store will immediately resume the default storage policy, I built for VSANs?

    Thanks for anyone who has followed.

  • Cannot create a vSAN data store

    Hi all

    I'm unable to create the data aVSAN store

    I have 3 ESXi

    I connected them using CF

    Passthrough RAID
    Unbale to see drivers

    Dear Madlabs

    Please put the disks in JBOD mode
    Can I know what OEM servers are we talking about?

  • remove the Cluster data store data store

    I have an infrastructure with vCenter and ESXi 4 5.5 I have a data cluster store in SAN with 8 Mon, I need to remove 3 Lun (to be used for other purposes) what is the appropriate procedure

    to remove the Lun (end then to destroy)? Thank you

    Do you want the LUN to use for purpose of non-vSphere? If so, you can just storage vMotion virtual machines since associated LUN data warehouses that you want to decommission (or simply putting the data store in maintenance mode, in this way, that the virtual machines will automatically be migrated). Cleaning after the data store, move the data store from the cluster data store, and then delete the VMware environment data store as described here: best practices: how to properly remove a unit number logic of a host ESX - VMware vSphere Blog - VMware Blogs

  • Error during activation of data store single heartbeat

    Hello

    I have a cluster HA (5.5) newly created using vSAN as a data store unique. HA cluster is configured with das.ignoreInsufficientHbDatastore, but when I select vSAN datastore in the favorite heartbeat datastore, I get the following error:

    The userHeartbeatDs setting is not valid for the cluster NOMCLUSTER

    Google could not find a single post/page mentioning this error.

    Any help would be much appreciated!

    Perhaps this explains - it.

    VSAN part 9 - host failure scenarios & amp; vSphere HA Interop | CormacHogan.com

    Another notable difference with vSphere HA on VSAN, it's that the VSAN data store cannot be used for the heartbeat of data store. ...

    I guess that this is due to the local VMFS-L version used with VSAN that does not use the same locking mechanism as a VMFS default data store.

    André

  • Empty folders "masters" and "clones" on the data store

    Clean an old data store, so I can get back to the place of SAN, I migrated all the models and virtual computers out of the data store (and deleted empty folders that leaves behind migration.  (Grrr...).  There are two empty folders left on this data store, called "clones" and "masters".  Nobody here knows how they got there, but they look like type system.  Anyone know if they are system files that may be moved or may be deleted?  (Screen attached)

    no system records, if they are empty it is safe to delete.

  • 0 blocks free PTR - cannot create new files on the data store

    We have been experiencing problems trying to power on virtual machines. When attempting to power on virtual machines, we see the error "cannot extend the pagefile from 0 KB to 2097152 KB".

    We checked the .vswp file are created in the folder of the Virtual Machine on the data store. Connection to the ESXi host, we have seen the following in vmkernel.log error message:

    (2016 01-16 T 21: 19:40.556Z cpu1:4971732) WARNING: Res3: 6984: "freenas-6-ds": [rt 3] No. Space - has not found enough resources after the second pass! (requis_:_1,_trouvé_:_0) 2016-01 - 16 T 21: 19:40.556Z cpu1:4971732) Res3: 6985: "freenas-6-ds": [rt 3] resources t 0, e 0, PN 16, BM 0, b 0, RCs u 0, i 0, 4031 nf, pe 0, 0 2016-01-16 T 21 oe: 19:40.556Z cpu1:4971732) WARNING: SwapExtend: 683: impossible to extend the pagefile from 0 KB to 2097152 KB.

    This was surprising given that we have about 14 TB of space available on the data store:

    [root@clueless:~] df h

    Size of filesystem used available use % mounted on

    VMFS-5 20.0 T 5.4 T 14.6 T/vmfs/volumes/freenas-six-ds 27%

    However, when we use "dd" to write a 20 GB file, we would get "no space left on device:

    [root@clueless:/vmfs/volumes/55a00d31-3dc0f02c-9803-025056000040/deleteme] dd if = / dev/urandom of = deleteme bs = 1024 count = 2024000

    DD: writing "deleteme": no space is available on the device

    263734 + 0 records in

    out 263733 + 0 reviews

    [root@clueless:/vmfs/volumes/55a00d31-3dc0f02c-9803-025056000040/deleteme] ls - lh deleteme

    -rw - r - r - 1 root root 19 Jan 255,1 M 01:02 deleteme

    We checked that we have free inodes:

    The ramdisk name system include in reserved Coredumps used Maximum reserved free use pic free maximum allocated Inodes used Inodes Inodes Mount Point

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    root of true true 32768 KiB 32768 KiB KiB KiB 99% 99% 9472 4096 3575 176 176.

    true true etc 28672 KiB 28672 KiB 284 KiB 320 KiB 99% 99% 4096 1024 516/etc

    Choose true true 0 KiB KiB 0 KiB KiB 0 100% 0% 8 1024 8192 32768 / opt

    var true true 5120 KiB 49152 484 516 99% 90% 8192 384 379 KiB KiB KiB / var

    tmp false false 2048 KiB 262144 KiB 20 KiB 360 KiB 99% 99% 8 256 8192/tmp

    false false hostdstats KiB 310272 KiB 3076 KiB 3076 KiB 99 0% 0% 8192 32 5/var/lib/vmware/hostd/stats


    We believe that our cause is due to have 0 free blocks of PTR:

    [root@clueless:/vmfs/volumes/55a00d31-3dc0f02c-9803-025056000040] vmkfstools Pei - v 10/vmfs/volumes/freenas-six-ds.

    System file VMFS-5, 61 extending on 1 partition.

    File system label (if applicable): freenas-six-ds

    Mode: public TTY only

    Capacity 21989964120064 (blocks of files 20971264 * 1048576), 16008529051648 (15266923 blocks) prevail, max supported size of the 69201586814976 file

    Volume creation time: Fri Jul 10 18:21:37 2015

    Files (max / free): 130000/119680

    Blocks of PTR (max / free): 64512/0

    Void / blocks (max / free): 32000/28323

    The secondary blocks of Ptr (max / free): 256/256

    Drop blocks (approve/used/approve %): 0/5704341/0

    Blocks of PTR (approve/used/approve %): 64512/0/0

    Void / blocks (approve/used/approve %): 3677/0/0

    Size of volume metadata: 911048704

    UUID: 55a00d31-3dc0f02c-9803-025056000040

    Logical unit: 55a00d30-985bb532-BOI.30-025056000040

    Partitions split (on 'lvm'):

    NAA.6589cfc0000006f3a584e7c8e67a8ddd:1

    Instant native is Capable: YES

    OBJLIB-LIB: ObjLib cleaned.

    WORKER: asyncOps = 0 maxActiveOps = 0 maxPending = 0 maxCompleted = 0

    When we turn off a virtual machine, it will release 1 block of PTR and we would be able to on another VM / create the 20 GB file using "dd". Once we reached 0 free blocks of PTR, we are unable to create new files.

    Can anyone give any suggestions on how we may be able to clear the blocks PTR? We have already tried to restart all services of management on all ESXi hosts connected.

    FreeNAS is not running on a virtual machine.

    We solved the problem by finding a lot PTR blocks have been used by many of our models of virtual machine. Remove the disk models solved the problem.

  • List of virtual machines in the data store that is not in stock

    Hi guys

    PowerCLI rookie here, sorry for the stupid questions.

    I'm trying to clean up a bunch of singehost with local data warehouses. So I need a script that can display a list of files of virtual machine on a data store that is not used by VMs in the inventory. One of the problems is that the files on the data store, isn't every means, named exactly the same as the virtual machine in the inventory.

    Summer watching this, but I think the term "orphan" is "sent, in my view, it is:

    https://communities.VMware.com/thread/266913

    Also it is - this one, I think that I should be able to change it to do what I want:

    http://www.wooditwork.com/2011/08/11/adding-VMX-files-to-vCenter-inventory-with-PowerCLI-gets-even-easier/

    Any tips or hints to push me in the right direction would be appreciated.

    Please try:

    $AllFilesLocalDatastore = get-data store 'localdatastorename ' | Get-fileindatastore

    $FilesIdentifiedAsAssociatedToAllVMs = get-FilesIdentifiedAsAssociatedToAllVMs

    #The two functions above are available here http://thecrazyconsultant.com/find-orphaned-vmdk-files-workflow/

    Check the contents of the two variables for example with VGO or export-csv

    $AllFilesInESX01LocalDatastore | OGV

    Try:

    $FilesNotIdentifiedAsAssociatedToAnyVM = $AllFilesLocalDatastore | {foreach-object

    $FullPath = $_. FullPath

    If ($FilesIdentifiedAsAssociatedToAllVMs.FileName - notcontains $FullPath) {}

    Return $_

    }

    }

    $FilesNotIdentifiedAsAssociatedToAnyVM | OGV

    #The over a will contain all the files that are not identified as associated with any virtual computer

    $ProbablyOrphanedFiles = $FilesNotIdentifiedAsAssociatedToAnyVM | where {$_.} FileTypeFullName-match "VMware.Vim.Vm *"-GOLD ($_.) FileTypeFullName - eq "VMware.Vim.FileInfo" - AND ($_.) FullPath-match ".vmsd" - or $_. FullPath-match ".vmxf" - or $_. FullPath-match "aux.xml" - or $_. FullPath-match ".vswp" - GOLD ($_.) FullPath-match "hard" - AND $_. FullPath - notmatch 'ctk.vmdk') - GOLD ($_.) FullPath-match ".vmx" - AND $_. FullPath - notmatch ".vmx ~"- AND $_. FullPath - notmatch "." VMX.lck")))}

    $ProbablyOrphanedFiles | OGV

    Edit:

    Changed the name of the data store, it seems that he was not supposed to be in the first screenshot.

    Edit2:
    The first command control switch, more details in the last post in this thread

  • Find files on the data store that have been removed from inventory, but not deleted from the disk

    I have ESXi 4.1 and with vSphere Client to manage virtual machines.

    Some of my users continue to use the 'remove from inventory"rather than the option" remove disc "in vSphere when they want to delete the virtual machine.

    This leaves the computer virtual on the data store but not used. I have since removed this privilege among the offending users but I need to do a bit of cleaning.

    I have a lot of files on the data store where users have done this in recent years. Probably about 150 records but only 80 VM listed in the inventory.

    Is there a way I can output, a report showing the data of each machine store directory in inventory so that I can remove anything not on this list? ID rather not to manually check the parameters of all 80 VM in the inventory.

    Out ideal would be something like:

    MyVmNameHere 1, \MyVmDirectoryHere1\ [DataStore1]

    MyVmNameHere2, \MyVmDirectoryHere2\ [DataStore1]

    A great tool to discover all this and much more is RVTools

    André

  • Good way to delete a data store

    I'm not sure this is the right forumr for my question. If not, can someone please point me to the right one?

    I need to remove two LUNS on a storage (HP LeftHand).

    The lun host 2 warehouses of data used by a 5.5 vSphere cluster composed of 3 5.5 U2 ESXi servers.

    I have to perform the activity during execution of virtual machines and I can not create any problem or performance for VMS running problem.

    So I need to create a checklist as accurate and complete as possible...

    Here's my Checklist:

    • I removed all the VMS since data warehouses
    • I deleted all the files from data warehouses
    • I removed data warehouses from the list of data used by pulsation HA stores
    • I checked that the sacratchconfig. ConfiguredScratchLocation for each node indicates a different datadtore of those that I am giung to remove

    Can I safely remove the files inside the folder .vSphere-HA?
    Should what else you check before removing the data store?

    Is there anything else I should consider?

    Concerning

    Marius

    For well detach and remove datatores take a look at http://kb.vmware.com/kb/2004605.

    In fact, there is nothing which will cause problems. If you try to take it apart (or delete) a data store it will work either (if anything accesses the database), or you receive an error/warning message. Once a datatore is disassembled or deleted, you must detach the LUNS for each host, and - after unpresenting a LUN of Lefthand CMC and run a new analysis on the hosts - you can do the cleaning (esxcli storage core detached unit remove d NAA_ID) on the hosts.

    André

  • Failed to create data store on LUN ISCSI

    Get the following error when attempting to create a new data store after a new installation of ESXi 5.5U2.

    Location:

    • UCS B200 servers using the VIC-1280 map and
    • Interfaces ISCSI connected directly from the fabric of interconnection to the NetApp FAS2552 with TwinAx cables
    • MTU is set for extended frames (9000) on the interface of NetApp, vNIC for ISCSI vKernel vSwitch and group interface ports
    • During the initial setup of the vSwitches, I forgot the MTU setting Port and interfaces group wouldn't even ping, so all the MTU setting are good
    • ISCSI connection is green and LUN created and present storage warehouses are considered as available on the ESX Server to create a data store (sizes 1 TB and 2 TB tested times)
    • The NetApp storage have been created as a thin provisioned and thick provisioned - neither works and gets the same error

    Any ideas would be very useful. Technical support has not yet responded.

    Thanks in advance.

    DM

    OK, after working with NetApp and VMware on a conference call (after both made each other) bottom line "fix" was to remove the iSCSI port bindings, remove broken paths, remove the vSwitches and rebuild again.

    1. create vKernel vSwitch with appropriate port group

    2. set the MTU to 9000 on the port group and vSwitch

    3. create the bindings for each interface iSCSI Port

    4 re-scan

    5 successfully create the data store

    Oddly enough, I had to repeat this process 3 times for one of the blades, but it worked the first time for 3 other involved blades.

    VMware technical support did provide the following as a look at the LUN of the CLI:

    1. / vmfs/devices/disks cd

    ls-l

    We see and out of all the available discs

    Identify the Lun Naa.xxxxxxxx

    2. run the Naa.xxxxx reported in step 2

    partedUtil getptbl /vmfs/devices/disks/naa.xxxxxxx

    If there is a partition, you might see something similar to

    1 63 2249099 131 128 > 1 is the partition number

    or

    You can see and error, if error please contact technical support

    3. If there is partition, you can delete

    partedUtil remove /vmfs/devices/disks/naa.xxxxxxx 1

    NOTE: This process did not work, but is still useful nonetheless. It could work if the LUN has been used by another operating system and need cleaning. But my situation was all greenfield.

  • Cannot add host to vCenter server as data store is shared with an existing host to vCenter

    Recently, I removed a physical host to a virtual appliance of vCenter Server and am not able to add it to vCenter Server because I get an error message on the existing data store.  I run a simple server vCenter environment with two physical hosts and shared storage.  I've only been administering vCenter for a few months, so I'm relatively new on the technology and processes.  I searched the Internet for a few days now, but have not found documentation everyone has the same problem I have (which I find strange considering the simplicity my problem and configuration), so I tried to get help from the community of VMware.

    I received an error message a day this vCenter Server cannot connect to either of the two hosts so I removed the host (rather than disconnect and plug as I should have done).  Now, I am not able to connect to the host to vCenter server because the shared storage data store comes into conflict with the same data store used by the host in vCenter Server.  I get the error message is ' "Datastore"datastore_name"is in conflict with a store of data that exists in the data center which has the same URL (ds: / / / vmfs/volumes/UUID /), but is supported by different physical storage." "  I try to remove the host data store, but get the following error message: "resource" data store name: datastore_name VMFS uuid: UUID' is in use. ".  The error stack said: "'HostStorageSystem.UnmountVmfsVolume' call failed for object 'storage system' on ESXi"IP address"."  Cannot unmount volume ' data store name: datastore_name VMFS uuid: 'UUID' because the file system is busy. Correct the problem and retry the operation. "I tried to delete all virtual machines of the inventory, put the hosts in maintenance mode, restart physical hosts, but none of my troubleshooting contributes.

    I don't know what steps to take to get this data store driving with the host so that I can add it in vCenter Server.  You can provide me with any help is appreciated.

    Good thing you already moved the VMs on.  For what is 'disconnect', 'remove' or 'delete' might work anyway.  You should maybe put the host in maintenance mode or even reboot the host before you can remove data warehouses.  In an extreme case, I even had to remove the host and the hypervisor installed completely rebuild on the spot.  It is not that difficult or does not take long to reinstall, so be not afraid on this subject.  A clean reinstall could still save time compared to the deletion of data warehouses.

  • Vcenter/VSphere/ESX 5.0.0 question: could not download /opt/vmware/www/build/Tenacity.iso for the san-core8 data store. == > Build fails

    I built this different ways now, and I still get this same exact error. I spin as 'Admin' and I have so any available privilege.

    There are no special characters in the password, I tried this file generation and he got away on my computer than this (v-soft bootable with interface).

    Please help me get to the next step, I'm stuck here.

    Everything seems fine until:

    09/10/2013 18:00:25 [info] validation available disk space...
    09/10/2013 18:00:25 [info] prepares the operating system installation files.
    09/10/2013 18:00:25 [info] looking for /opt/vmware/www/ISV/ISO/CentOS-6.4-x86_64-bin-DVD1.iso
    09/10/2013 18:00:25 [info] Validating md5 checksum for /opt/vmware/www/ISV/ISO/CentOS-6.4-x86_64-bin-DVD1.iso (may take a few minutes)
    09/10/2013 18:01:15 [info] verification of repositories of request for the installation of the packages packet...
    09/10/2013 18:01:16 [info] creating package repositories...
    09/10/2013 18:01:16 [info] create the virtual machine model.
    09/10/2013 18:01:17 [info] VM carrying from the Studio to the host configuration. This may take a few minutes...
    09/10/2013 18:02:20 [warn] cannot download /opt/vmware/www/build/Tenacity.1/Tenacity.1_provstart.iso for the s-core9 data store.
    09/10/2013 18:02:20 [warn]
    %3 %7% 11% 15% 19% 23% 26% 30% 34% 38% 42 failure: (22, ' the requested URL returned error: 401')
    09/10/2013 18:02:20 [error] met a unrecoverable build error!

    I am able to use this model for Centos on my computer actually install and build a paralytic with centos on that - unfortunately I do a

    hacks to make it work properly and I cannot get it to install other real applications (perhaps there is a new version for workstation 10?)

    So I went to vsphere, and I KNOW my generation model is ok, at least to get the installed operating system.

    What information can I give you or what can I try, thanks!

    Is it really "sort of" loading ie 42% or which is a total failure?

    OK, I have a build that WORKED, now I see what you mean about watching build/deploy the VM guest.

    Here is the solution to my problem: our vcenter uses names with spaces, we also use the domain names for our connections. In addition, each admin password was 'special characters', that I've debugged meticulously by ALL of them and much more. Basically, it did not matter that I have "URL" code things, used new tools or edited different scripts to encode things one way or another.

    What finally gave us successes was to go to a 'clean' Vcenter implementation that

    (a) use/did not require a domain name (not / credentials)

    (b) all had the "BACK original' legal names, IE no spaces, no special characters, etc..

    (c) the passwords contained NO "special characters".

    (because I changed this way, 'URL' encoding didn't work, tried it)

    Moral of the story: building a new, simply configured Vcenter or get one and use it.

    (Note: I even downloaded a new ovftool and tried every way that I could but it did not success)

  • Remove manually removed from device vCenter data store

    Hi all

    I was doing some cleaning storage today and accidentally deleted a LUN which had not yet been withdrawn from Vcenter data store (or one of the hosts).  Of course delete it, etc. does not now.  I found this article for manual removal of data warehouses, but it seems to be expecting Vcenter to run in a Windows Server/MSSQL database.  I am running the latest version of the Suse standard device.  Can anyone help translate these instructions in a game can I use the appliance?

    Thank you!

    Thank you both...

    In fact, I don't know why I don't think to do it anyway, but here's what I did:

    Switch to view Datastore

    Click on the dead DS, click the hosts tab. Guests who think that the DS is still alive will be listed.

    Click on each host and tell it to rescan the HBAs, etc..  When they have finished sweeping, he drops out of the list.  Finally, the DS will disappear.

    No need to restart the host, but this suggestion gave me this idea.  In addition, good info on the DB for the machine tools.  I maybe those reference again...

  • Clone the virtual machine to the local data store

    Hi all

    I'm looking to automate a task daily (or almost) of my friends with a small script with powercli.

    I'm trying to "backup" or to clone a virtual machine, I work in a storage of one of our servers.

    The servers are managed by a 5.1 vCenter and the machine is on a shared storage.

    From time to time, I clean, stop the machine, remove all snapshots and clone the virtual machine to one of the local server as a backup storage. So I put together a small script which almost works. It works as long as the target data store is a shared storage, but not with a local storage.

    I get always an error that claims it can not access the local data store and is not a permissions problem...

    Given that I can accomplish this via the customer without problem I thought it is possible via powercli too, or I'm wrong?

    My Script up to now:

    # Variables
    $VC = "vc.domain.com" #vCenter Server
    $User = "domain\user" #User
    $Pass = 'test123' #User PW
    $VMName = 'scripttest' #VM
    $BackupSuffix = "backup" #Suffix to add the name of VM to mark this as a backup
    $VmHost = "esx2.domain.com".
    $Datastore = 'ESX2-LocalData' #Datastore
    $BackupFolder = 'Backup' #Folder the VM gets classified


    # Register cmdlets to VMware

    If (-not (Get-PSSnapin VMware.VimAutomation.Core - ErrorAction SilentlyContinue)) {}

    Add-PSSnapin VMware.VimAutomation.Core

    }


    # Connect to the server

    SE connect-ViServer $VC - user $User-password $Pass


    # Remove the old clone

    $OldBackups = get - VM | WHERE {$_.} {Name: corresponds to '$VMName - $BackupSuffix'}

    If ($OldBackups - don't "")

    {

    If ($OldBackups.Count - gt 1)

    {

    Write-Host "better check! "Found several results:

    Foreach ($VM to $OldBackups)

    {

    Write-Host $VM. Name

    }

    }

    on the other

    {

    Remove-VM - VM $OldBackups - DeleteFromDisk-confirm: $false

    }

    }


    # Clone VM

    $VMInfo = get - VM $VMName | Get-View

    $CloneSpec = new-Object Vmware.Vim.VirtualMachineCloneSpec

    $CloneSpec.Snapshot = $VMInfo.Snapshot.CurrentSnaphshot

    $CloneSpec.Location = new-Object Vmware.Vim.VirtualMachineRelocateSpec

    $CloneSpec.Location.Datastore = (get-Datastore-name $Datastore |) Get - View). MoRef

    $CloneSpec.Location.Transform = [Vmware.Vim.VirtualMachineRelocateTransformation]: sparse

    $CloneFolder = $VMInfo.Parent

    $CloneName = "$VMName - $BackupSuffix".

    $TaskCloneID = $VMInfo.CloneVM_Task ($CloneFolder, $CloneName, $CloneSpec)


    # Check if the task is completed


    $Check = $false

    While ($Check - eq $false)

    {

    $Tasks = get-job | Select State, id | Where {$_.} State - eq "Running" - and $_. State - eq "pending"}

    ForEach ($Task in $Tasks)

    {

    If ($Task.id - eq $TaskCloneID)

    {$Check = $false}

    on the other

    {$Check = $true}

    }

    Start-Sleep 10

    }

    # Move clone to the backup folder

    Move-VM - VM '$VMName - $BackupSuffix' - Destination $BackupFolder


    # Disconnect

    Disconnect-VIServer-confirm: $false

    Can you show us the complete error message you get?

    BTW, the clone step can be replaced by the New-VM cmdlet with the setting of the virtual machine.

Maybe you are looking for