Automation

 View Only
  • 1.  Error Message when Cloning

    Posted Jul 29, 2013 05:16 PM

    Hello,

    Getting an error message when doing a clone script.  Have a number of servers to clone and trying to automate it.  Its a variation of the autodeploy script I have been using.  The error message is odd, its complaining about .DLLs.  However New-VM cmdlet to do a clone is working fine.

    I am pulling information from CSV file and doing custom configs through Customization Specification Manager.

    SCRIPT:

    --># List to deploy from. Standard CSV file with headings for script to pull from
    $deploylist = "C:\Scripts\Deploy_Scripts\Clone\clonelist1.csv"

    # VCenter you are connecting too. For the name, use FQDN
    $vcserver = "myvcenter"

    # Connect to vCenter server. It will use cache creds of user logged into workstation
    Connect-VIServer $vcserver

    # Deployment loop and customization done during server creation
    Import-Csv $deploylist -UseCulture | %{
       
    Get-OSCustomizationSpec $_."Customization" | Get-OSCustomizationNicMapping | `
       
    Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $_."IP Address" `
           
    -SubnetMask $_."Subnet" -DefaultGateway $_."Gateway" -Dns $_."First DNS",$_."Second DNS"  
    New-VM -Name $_."Server Name" -VM $_."Source Server" -VMHost $_."Esx Host" `
           
    -Datastore $_."Datastore" -OSCustomizationSpec $_."Customization" `
           
    -Confirm:$false -RunAsync
    }

    Disconnect-VIServer -Confirm:$false

    Error Message from Powershell:

    New-VM : 7/29/2013 1:02:07 PM New-VM    Could not load file or assembly

    'CryptoSupport.dll' or one of its dependencies.  is not a valid Win32 application. (Exception

    from HRESULT: 0x800700C1)   

    At C:\Scripts\Deploy_Scripts\Clone\clone_server2.ps1:23 char:5

    + New-VM -Name $_."Server Name" -VM $_."Source Server" -VMHost $_."Esx Host" `
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo      : NotSpecified: (:) [New-VM], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlet

       s.Commands.NewVM

    Thanks,

    Boston Tech Guy



  • 2.  RE: Error Message when Cloning

    Posted Jul 29, 2013 05:52 PM

    You are probably running the 64-bit version of PowerCLI. You can try if the problem is solved if you run the 32-bit version of PowerCLI.



  • 3.  RE: Error Message when Cloning

    Posted Jul 29, 2013 05:53 PM

    Try running the script from a 32-bit PowerCLI session.

    Afaik the CryptoSupport.dll is 32-bit only.



  • 4.  RE: Error Message when Cloning

    Posted Jul 29, 2013 05:56 PM

    Just did it Luc, was typing my reply as your were asking the question.

    Why would starting a CLONE in a LOOP be an issue? Cloning all by itself with hard names for the new server and source server works perfectly fine in 64bit.



  • 5.  RE: Error Message when Cloning

    Posted Jul 29, 2013 05:53 PM

    UPDATE:

    If I launch the script above in VMware vSphere PowerCLI (32-Bit) it will run.  :smileyconfused:

    If I run the follow command from x64 PowerCLI using hard names for cloning, (No Loop, No CSV file) it works fine

    New-VM -Name "Server Name" -VM "Source Server" -VMHost "Esx Host"

    Seems adding Clone option with a CSV File loop in x64 PowerCLI is a no go.  Has anyone heard something like this?

    Thanks,

    Boston Tech Guy



  • 6.  RE: Error Message when Cloning

    Posted Jul 29, 2013 05:56 PM

    It's the cloning part, the OSCustomizationSpec most probably contains a user/password for the local administrator of the new VM.

    The CSV part has nothing to do with it



  • 7.  RE: Error Message when Cloning

    Posted Jul 29, 2013 06:14 PM

    Hmmm didnt think of that.. Let me try creating a new Custom Script Manager that doesnt have the user password option in it.



  • 8.  RE: Error Message when Cloning
    Best Answer

    Posted Jul 30, 2013 01:40 PM

    Follow up.

    Tried what I could.  It comes down to using the Customization Script Manager and Cloning.  Seems its a no no in 64-bit version of PowerCLI.  Only way I could get it to work is to run the 32-bit.  I hope VMware is reading, I would like this to be added to the "Ahhhh OOPS" List for them.

    Thanks everyone.

    Thanks,

    Boston Tech Guy



  • 9.  RE: Error Message when Cloning

    Posted Jul 30, 2013 01:58 PM

    In their defense, it says so in the Release Notes :smileygrin:

    The following PowerCLI features are supported only on the 32-bit version of Windows PowerShell.

    • New-OSCustomizationSpec and Set-OSCustomizationSpec
    • New-VM and Set-VM (only when used for applying customization specifications)


  • 10.  RE: Error Message when Cloning

    Posted Jul 30, 2013 03:21 PM

    {Shaking Fist}  I dont want to be told of direct, documented, simple logic!  I want to cry, complain and blame someone else. :smileysilly:

    In all seriousness, that is interesting that the scripts are working for New-VM & Set-OSCustomizationSpec when using -TEMPLATES in 64-bit.