Automation

 View Only
Expand all | Collapse all

Power CLI script to clone the virtual machine

skasai_1

skasai_1Aug 07, 2018 10:15 AM

  • 1.  Power CLI script to clone the virtual machine

    Posted Aug 06, 2018 02:56 PM

    HI,

    Am having the error with following script to take clone for virtual machine

    Could you please someone corrects the error

    $VC='10.20.10.8'

    $pwd = Get-Content C:\scripts\ap-vcs-credentials.txt | ConvertTo-SecureString

    $credentials = New-Object System.Management.Automation.PsCredential “administrator@masscloudspace.local“, $pwd

    Connect-VIServer -10.20.10.8 $VC

    $vmName = 'MC-P-MailServer'

    $cloneName = "$($)Varnikmail_Backup_$((Get-Date).ToString('MMddyyyy'))"

    $oldCloneName = "$($)Varnikmail_Backup_$((Get-Date).AddDays(-2).ToString('MMddyyyy'))"

    $ds = Get-Datastore | -Name 'Production_Backup'

    $esx = Get-Cluster -VM $vmName | Get-VMHost | Get-Random

    $start = Get-Date

    Get-VM -Name $oldCloneName -ErrorAction SilentlyContinue |

        Remove-VM -DeletePermanently:$true -Confirm:$false

    $vm = New-VM -VM $vmName -Name $cloneName -Datastore $ds -VMHost $esx

    $cloneEvent = Get-VIEvent -Entity $vm -Start $start |

      where{$_ -is [VMware.Vim.VmClonedEvent] -and $_.Vm.Vm.Value -eq $vm.ExtensionData.MoRef.Value}



  • 2.  RE: Power CLI script to clone the virtual machine
    Best Answer

    Posted Aug 06, 2018 03:42 PM

    It would help if you showed us the error you are getting.

    The line with Get-Datastore doesn't need the pipeline symbol there.

    Try with

    $ds = Get-Datastore -Name 'Production_Backup'



  • 3.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 09:15 AM

    HI LucD,

    Thanks for the reply...

    I received below error while executing the command

    Connect-VIServer : A positional parameter cannot be found that accepts argument

    '10.20.10.8'.

    At C:\Scripts1\New vcenter clone.ps1:7 char:1

    + Connect-VIServer -Server 10.20.10.8 $VC

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : InvalidArgument: (:) [Connect-VIServer], Paramet

       erBindingException

        + FullyQualifiedErrorId : PositionalParameterNotFound,VMware.VimAutomation

       .ViCore.Cmdlets.Commands.ConnectVIServer

    $ : The term '$' is not recognized as the name of a cmdlet, function, script fi

    le, or operable program. Check the spelling of the name, or if a path was inclu

    ded, verify that the path is correct and try again.

    At C:\Scripts1\New vcenter clone.ps1:10 char:17

    + $cloneName = "$($)Varnikmail_Backup_$((Get-Date).ToString('MMddyyyy'))"

    +                 ~

        + CategoryInfo          : ObjectNotFound: ($:String) [], CommandNotFoundEx

       ception

        + FullyQualifiedErrorId : CommandNotFoundException

    $ : The term '$' is not recognized as the name of a cmdlet, function, script fi

    le, or operable program. Check the spelling of the name, or if a path was inclu

    ded, verify that the path is correct and try again.

    At C:\Scripts1\New vcenter clone.ps1:11 char:20

    + $oldCloneName = "$($)Varnikmail_Backup_$((Get-Date).AddDays(-2).ToString('MMd

    dyy ...

    +                    ~

        + CategoryInfo          : ObjectNotFound: ($:String) [], CommandNotFoundEx

       ception

        + FullyQualifiedErrorId : CommandNotFoundException

    Get-Datastore : 07-08-2018 10:06:48    Get-Datastore        You are not current

    ly connected to any servers. Please connect first using a Connect cmdlet.

    At C:\Scripts1\New vcenter clone.ps1:13 char:7

    + $ds = Get-Datastore -Name 'Production_Backup'

    +       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : ResourceUnavailable: (:) [Get-Datastore], ViServ

       erConnectionException

        + FullyQualifiedErrorId : Core_BaseCmdlet_NotConnectedError,VMware.VimAuto

       mation.ViCore.Cmdlets.Commands.GetDatastore

    Get-Cluster : 07-08-2018 10:06:48    Get-Cluster        You are not currently c

    onnected to any servers. Please connect first using a Connect cmdlet.

    At C:\Scripts1\New vcenter clone.ps1:15 char:8

    + $esx = Get-Cluster -VM $vmName | Get-VMHost | Get-Random

    +        ~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : ResourceUnavailable: (:) [Get-Cluster], ViServer

       ConnectionException

        + FullyQualifiedErrorId : Core_BaseCmdlet_NotConnectedError,VMware.VimAuto

       mation.ViCore.Cmdlets.Commands.GetCluster

    Get-Cluster : 07-08-2018 10:06:48    Get-Cluster        VirtualMachine paramete

    r: Could not find any of the objects specified by name.

    At C:\Scripts1\New vcenter clone.ps1:15 char:8

    + $esx = Get-Cluster -VM $vmName | Get-VMHost | Get-Random

    +        ~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : ObjectNotFound: (VMware.VimAutom...ualMachine[]

       VM:RuntimePropertyInfo) [Get-Cluster], ObnRecordProcessingFailedException

        + FullyQualifiedErrorId : Core_ObnSelector_SetNewParameterValue_ObjectNotF

       oundCritical,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetCluster

    Get-VM : 07-08-2018 10:06:49    Get-VM        You are not currently connected t

    o any servers. Please connect first using a Connect cmdlet.

    At C:\Scripts1\New vcenter clone.ps1:18 char:1

    + Get-VM -Name $oldCloneName -ErrorAction SilentlyContinue |

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : ResourceUnavailable: (:) [Get-VM], ViServerConne

       ctionException

        + FullyQualifiedErrorId : Core_BaseCmdlet_NotConnectedError,VMware.VimAuto

       mation.ViCore.Cmdlets.Commands.GetVM

    New-VM : Cannot validate argument on parameter 'Datastore'. The argument is nul

    l or empty. Provide an argument that is not null or empty, and then try the com

    mand again.

    At C:\Scripts1\New vcenter clone.ps1:20 char:54

    + $vm = New-VM -VM $vmName -Name $cloneName -Datastore $ds -VMHost $esx

    +                                                      ~~~

        + CategoryInfo          : InvalidData: (:) [New-VM], ParameterBindingValid

       ationException

        + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom

       ation.ViCore.Cmdlets.Commands.NewVM

    Get-VIEvent : 07-08-2018 10:06:49    Get-VIEvent        You are not currently c

    onnected to any servers. Please connect first using a Connect cmdlet.

    At C:\Scripts1\New vcenter clone.ps1:22 char:15

    + $cloneEvent = Get-VIEvent -Entity $vm -Start $start |

    +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : ResourceUnavailable: (:) [Get-VIEvent], ViServer

       ConnectionException

        + FullyQualifiedErrorId : Core_BaseCmdlet_NotConnectedError,VMware.VimAuto

       mation.ViCore.Cmdlets.Commands.GetEvent

    Send-MailMessage : Cannot validate argument on parameter 'Body'. The argument i

    s null or empty. Provide an argument that is not null or empty, and then try th

    e command again.

    At C:\Scripts1\New vcenter clone.ps1:40 char:18

    + Send-MailMessage @sMail

    +                  ~~~~~~

        + CategoryInfo          : InvalidData: (:) [Send-MailMessage], ParameterBi

       ndingValidationException

        + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Power

       Shell.Commands.SendMailMessage

    PowerCLI C:\Scripts1>



  • 4.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 09:42 AM

    Hi LucD,
    It's working good.. How to schedule the script on Task Scheduler



  • 5.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 09:56 AM

    Do you mean the Windows Task Scheduler?



  • 6.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 10:12 AM

    Yes, windows task scheduler

    This the error am getting while scheduling the task.

    The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID

    {228826AF-02E1-4226-A9E0-99A855E455A6}

    and APPID

    {2FD08A73-D1F1-43EB-B888-24C2496F95FD}

    to the user MSSI\exchadmin SID (S-1-5-21-2695450852-3893545975-3138387318-10271) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.



  • 7.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 10:15 AM



  • 8.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 10:34 AM

    Looks like a DCOM permissions issue.

    Something similar to this one Task scheduler error 10016

    You'll have to add the permission with DCOMCNFG (see a sample here, but you'll have to find the AppName first)



  • 9.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 11:58 AM

    HI LucD,

    Thank you!!

    I have tried the steps given on above article but am unable to modify the permission getting an access denied error. Also, i did the same local administrator account.




  • 10.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 12:11 PM

    I suspect you will have to talk with your domain administrators.
    It seems the authority of the local administrator is restricted.



  • 11.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 12:43 PM

    Am the person to take care of the domain controller also, can you able to guide me where i have to modify the permission level.



  • 12.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 12:56 PM

    In the DCOMCNFG utility you have to select Application concerned, right-click and select Properties.

    Then go to the Security Tab.

    In there you'll find a Launch and Activation entry.

    Select the Customize option and then click Edit.

    In there you should be able to add the user (or one of the groups he belongs to) that you are using to create the Scheduled Task entry.



  • 13.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 06:32 PM

    Sorry for the inconvenience ..those options are grayed out can't editable format.



  • 14.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 06:57 PM

    That indicates you are missing permissions.
    It seems the permissions for the local administrator are restricted.
    Do you have access to the domain admin account?



  • 15.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 07:13 PM

    Yes, For my domain account also having domain admin privilege.

    Also, i can able to access Ad object with full permission with my domain account. 



  • 16.  RE: Power CLI script to clone the virtual machine

    Posted Aug 07, 2018 07:46 PM

    Then you probably have to look higher up.
    You obviously don't have the permission to change the settings.
    And this is kind of a Windows problem, not really my specialty I'm afraid.



  • 17.  RE: Power CLI script to clone the virtual machine

    Posted Aug 08, 2018 03:25 PM

    Luc,

    Thanks for the guidance.

    I Have referred the article, task scheduler executing successfully but the VM clone is not executive the clone task in vsphere.

    Fix Error 10016 in Windows Event Viewer 

    https://s10629.pcdn.co/wp-content/pictures/2017/09/PowershellScript.txt @

    attached task scheduler events..



  • 18.  RE: Power CLI script to clone the virtual machine

    Posted Aug 08, 2018 03:30 PM

    FYI..

    Information 08-08-2018 10:56:11 PowerShell (PowerShell) 403 Engine Lifecycle

    Information 08-08-2018 10:56:11 PowerShell (PowerShell) 400 Engine Lifecycle

    Information 08-08-2018 10:56:11 PowerShell (PowerShell) 600 Provider Lifecycle

    Information 08-08-2018 10:56:11 PowerShell (PowerShell) 600 Provider Lifecycle

    Information 08-08-2018 10:56:11 PowerShell (PowerShell) 600 Provider Lifecycle

    Information 08-08-2018 10:56:11 PowerShell (PowerShell) 600 Provider Lifecycle

    Information 08-08-2018 10:56:11 PowerShell (PowerShell) 600 Provider Lifecycle

    Information 08-08-2018 10:56:11 PowerShell (PowerShell) 600 Provider Lifecycle

    Information 08-08-2018 10:56:07 PowerShell (PowerShell) 403 Engine Lifecycle

    Information 08-08-2018 10:56:07 PowerShell (PowerShell) 400 Engine Lifecycle

    Information 08-08-2018 10:56:07 PowerShell (PowerShell) 600 Provider Lifecycle

    Information 08-08-2018 10:56:07 PowerShell (PowerShell) 600 Provider Lifecycle

    Information 08-08-2018 10:56:07 PowerShell (PowerShell) 600 Provider Lifecycle

    Information 08-08-2018 10:56:07 PowerShell (PowerShell) 600 Provider Lifecycle

    Information 08-08-2018 10:56:07 PowerShell (PowerShell) 600 Provider Lifecycle

    Information 08-08-2018 10:56:07 PowerShell (PowerShell) 600 Provider Lifecycle

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:11

    Event ID:      403

    Task Category: Engine Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Engine state is changed from Available to Stopped.

    Details:

    NewEngineState=Stopped

    PreviousEngineState=Available

    SequenceNumber=15

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=4.0

    RunspaceId=f83c85f6-ac06-45cd-9b7f-375084b2c652

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">403</EventID>

        <Level>4</Level>

        <Task>4</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:11.000000000Z" />

        <EventRecordID>378</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Stopped</Data>

        <Data>Available</Data>

        <Data> NewEngineState=Stopped

    PreviousEngineState=Available

    SequenceNumber=15

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=4.0

    RunspaceId=f83c85f6-ac06-45cd-9b7f-375084b2c652

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:11

    Event ID:      400

    Task Category: Engine Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Engine state is changed from None to Available.

    Details:

    NewEngineState=Available

    PreviousEngineState=None

    SequenceNumber=13

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=4.0

    RunspaceId=f83c85f6-ac06-45cd-9b7f-375084b2c652

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">400</EventID>

        <Level>4</Level>

        <Task>4</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:11.000000000Z" />

        <EventRecordID>377</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Available</Data>

        <Data>None</Data>

        <Data> NewEngineState=Available

    PreviousEngineState=None

    SequenceNumber=13

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=4.0

    RunspaceId=f83c85f6-ac06-45cd-9b7f-375084b2c652

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:11

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "Variable" is Started.

    Details:

    ProviderName=Variable

    NewProviderState=Started

    SequenceNumber=11

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:11.000000000Z" />

        <EventRecordID>376</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Variable</Data>

        <Data>Started</Data>

        <Data> ProviderName=Variable

    NewProviderState=Started

    SequenceNumber=11

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:11

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "Registry" is Started.

    Details:

    ProviderName=Registry

    NewProviderState=Started

    SequenceNumber=9

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:11.000000000Z" />

        <EventRecordID>375</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Registry</Data>

        <Data>Started</Data>

        <Data> ProviderName=Registry

    NewProviderState=Started

    SequenceNumber=9

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:11

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "Function" is Started.

    Details:

    ProviderName=Function

    NewProviderState=Started

    SequenceNumber=7

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:11.000000000Z" />

        <EventRecordID>374</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Function</Data>

        <Data>Started</Data>

        <Data> ProviderName=Function

    NewProviderState=Started

    SequenceNumber=7

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:11

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "FileSystem" is Started.

    Details:

    ProviderName=FileSystem

    NewProviderState=Started

    SequenceNumber=5

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:11.000000000Z" />

        <EventRecordID>373</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>FileSystem</Data>

        <Data>Started</Data>

        <Data> ProviderName=FileSystem

    NewProviderState=Started

    SequenceNumber=5

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:11

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "Environment" is Started.

    Details:

    ProviderName=Environment

    NewProviderState=Started

    SequenceNumber=3

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:11.000000000Z" />

        <EventRecordID>372</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Environment</Data>

        <Data>Started</Data>

        <Data> ProviderName=Environment

    NewProviderState=Started

    SequenceNumber=3

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:11

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "Alias" is Started.

    Details:

    ProviderName=Alias

    NewProviderState=Started

    SequenceNumber=1

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:11.000000000Z" />

        <EventRecordID>371</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Alias</Data>

        <Data>Started</Data>

        <Data> ProviderName=Alias

    NewProviderState=Started

    SequenceNumber=1

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=2590e3e4-9500-4e5c-a67c-324e8bf7bd73

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:07

    Event ID:      403

    Task Category: Engine Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Engine state is changed from Available to Stopped.

    Details:

    NewEngineState=Stopped

    PreviousEngineState=Available

    SequenceNumber=15

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=4.0

    RunspaceId=ce7df196-454e-4c98-8541-33480eb3b159

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">403</EventID>

        <Level>4</Level>

        <Task>4</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:07.000000000Z" />

        <EventRecordID>370</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Stopped</Data>

        <Data>Available</Data>

        <Data> NewEngineState=Stopped

    PreviousEngineState=Available

    SequenceNumber=15

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=4.0

    RunspaceId=ce7df196-454e-4c98-8541-33480eb3b159

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:07

    Event ID:      400

    Task Category: Engine Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Engine state is changed from None to Available.

    Details:

    NewEngineState=Available

    PreviousEngineState=None

    SequenceNumber=13

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=4.0

    RunspaceId=ce7df196-454e-4c98-8541-33480eb3b159

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">400</EventID>

        <Level>4</Level>

        <Task>4</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:07.000000000Z" />

        <EventRecordID>369</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Available</Data>

        <Data>None</Data>

        <Data> NewEngineState=Available

    PreviousEngineState=None

    SequenceNumber=13

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=4.0

    RunspaceId=ce7df196-454e-4c98-8541-33480eb3b159

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:07

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "Variable" is Started.

    Details:

    ProviderName=Variable

    NewProviderState=Started

    SequenceNumber=11

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:07.000000000Z" />

        <EventRecordID>368</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Variable</Data>

        <Data>Started</Data>

        <Data> ProviderName=Variable

    NewProviderState=Started

    SequenceNumber=11

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:07

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "Registry" is Started.

    Details:

    ProviderName=Registry

    NewProviderState=Started

    SequenceNumber=9

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:07.000000000Z" />

        <EventRecordID>367</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Registry</Data>

        <Data>Started</Data>

        <Data> ProviderName=Registry

    NewProviderState=Started

    SequenceNumber=9

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:07

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "Function" is Started.

    Details:

    ProviderName=Function

    NewProviderState=Started

    SequenceNumber=7

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:07.000000000Z" />

        <EventRecordID>366</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Function</Data>

        <Data>Started</Data>

        <Data> ProviderName=Function

    NewProviderState=Started

    SequenceNumber=7

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:07

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "FileSystem" is Started.

    Details:

    ProviderName=FileSystem

    NewProviderState=Started

    SequenceNumber=5

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:07.000000000Z" />

        <EventRecordID>365</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>FileSystem</Data>

        <Data>Started</Data>

        <Data> ProviderName=FileSystem

    NewProviderState=Started

    SequenceNumber=5

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:07

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "Environment" is Started.

    Details:

    ProviderName=Environment

    NewProviderState=Started

    SequenceNumber=3

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:07.000000000Z" />

        <EventRecordID>364</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Environment</Data>

        <Data>Started</Data>

        <Data> ProviderName=Environment

    NewProviderState=Started

    SequenceNumber=3

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>

    Log Name:      Windows PowerShell

    Source:        PowerShell

    Date:          08-08-2018 10:56:07

    Event ID:      600

    Task Category: Provider Lifecycle

    Level:         Information

    Keywords:      Classic

    User:          N/A

    Computer:      MC-P-VEEAM.masscloudspace.local

    Description:

    Provider "Alias" is Started.

    Details:

    ProviderName=Alias

    NewProviderState=Started

    SequenceNumber=1

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name="PowerShell" />

        <EventID Qualifiers="0">600</EventID>

        <Level>4</Level>

        <Task>6</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2018-08-08T09:56:07.000000000Z" />

        <EventRecordID>363</EventRecordID>

        <Channel>Windows PowerShell</Channel>

        <Computer>MC-P-VEEAM.masscloudspace.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Alias</Data>

        <Data>Started</Data>

        <Data> ProviderName=Alias

    NewProviderState=Started

    SequenceNumber=1

    HostName=ConsoleHost

    HostVersion=4.0

    HostId=5e540acb-6cd2-45e6-8421-8c0d12bae3ce

    HostApplication=powershell.exe -ExecutionPolicy Bypass C:\Scripts1\New vcenter clone.ps1

    EngineVersion=

    RunspaceId=

    PipelineId=

    CommandName=

    CommandType=

    ScriptName=

    CommandPath=

    CommandLine=</Data>

      </EventData>

    </Event>



  • 19.  RE: Power CLI script to clone the virtual machine

    Posted Aug 08, 2018 03:48 PM

    Not too sure what you expect me to do with that dump of events.

    If the script is not doing what you want it to do, I would suggest adding a Start-Transcript at the beginning of the script.

    That way we can see what the script is actually doing.



  • 20.  RE: Power CLI script to clone the virtual machine

    Posted Aug 21, 2018 10:50 AM

    Thanks a lot, LucD......



  • 21.  RE: Power CLI script to clone the virtual machine

    Posted Aug 21, 2018 10:51 AM

    Your suggestions very much help full...



  • 22.  RE: Power CLI script to clone the virtual machine

    Posted Nov 12, 2018 11:17 PM

    did you look in Local Security Policy/ Local Policies / Security options / Network Access : Do not allow storage of passwords and creds... set to disable.



  • 23.  RE: Power CLI script to clone the virtual machine

    Posted Nov 14, 2018 07:41 AM

    HI Richie, Where i have to do this setup



  • 24.  RE: Power CLI script to clone the virtual machine

    Posted Nov 14, 2018 08:17 AM

    Run secpol.msc, then go to Local Policies.
    But that setting might be set by a GPO, and then you need to talk with your domain admins.



  • 25.  RE: Power CLI script to clone the virtual machine

    Posted Nov 14, 2018 12:05 PM

    Let me try this.