BostonTechGuy
Enthusiast
Enthusiast

Error Message when Cloning

Jump to solution

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

0 Kudos
1 Solution

Accepted Solutions
BostonTechGuy
Enthusiast
Enthusiast

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

View solution in original post

0 Kudos
9 Replies
RvdNieuwendijk
Leadership
Leadership

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.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
LucD
Leadership
Leadership

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

Afaik the CryptoSupport.dll is 32-bit only.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

BostonTechGuy
Enthusiast
Enthusiast

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

0 Kudos
BostonTechGuy
Enthusiast
Enthusiast

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.

0 Kudos
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
BostonTechGuy
Enthusiast
Enthusiast

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

0 Kudos
BostonTechGuy
Enthusiast
Enthusiast

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

View solution in original post

0 Kudos
LucD
Leadership
Leadership

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)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
BostonTechGuy
Enthusiast
Enthusiast

{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.

0 Kudos