Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Overflow Exception "Add-Computer : Value was either too large or too small for Int32." #31

Open
HarshdeepSingh4084 opened this issue Sep 8, 2022 · 3 comments

Comments

@HarshdeepSingh4084
Copy link

First of all, great work creating this plugin. Thanks, it helped a lot.

Issue Description:

I am facing Add-Computer : Value was either too large or too small for Int32. error after every few tries (it's random). After getting this error, if I run the provision action again without any other change, it runs successfully the second time.

Screenshot of error:
image

Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "WindowsBox"
  config.vm.box_url = ENV['VAGRANT_SERVER_URL']
  config.winrm.username = 'johndoe'
  config.winrm.password = 'foobar'

  config.vm.provider :vsphere do |vsphere|
	vsphere.user = 'john_doe'
	vsphere.password = :ask
	vsphere.template_name = '~~~Templates/LAB - Windows Server 2022 Stnd'
	vsphere.vm_base_path = 'john_doe/vagrant_vms'
	vsphere.name = 'vlab018101'
	vsphere.customization_spec_name = '_Windows 2022 - All'
	vsphere.notes = "Windows 2022 Standard with Desktop\nCreated using:\nen-us_windows_server_2022_x64_dvd_620d7eac.iso"
  end
  
  config.vm.synced_folder '.', '/vagrant', disabled: true

  config.vm.provision :windows_domain do |domain|
	domain.domain = "nsldev.com"
	domain.username = "john_doe"
	domain.password = "foo_bar"
  end
end

In case of any more details required, please let me know.

@mefellows
Copy link
Owner

Hi! Thanks for the kind words. Unfortunately I don't have any time to work on this project these days (and it's been a long while since I last looked at the code!).

I think you'd need to pull out the PowerShell being used to get a sense of what value might be causing that Int32 issue.

@HarshdeepSingh4084
Copy link
Author

Hi! Thanks for the kind words. Unfortunately I don't have any time to work on this project these days (and it's been a long while since I last looked at the code!).

I think you'd need to pull out the PowerShell being used to get a sense of what value might be causing that Int32 issue.

Ok, I'll dig into the issue and update what I found. Maybe raise a PR if found solution.

@HarshdeepSingh4084
Copy link
Author

Couldn't find anything useful in my case but Add-Computer can fail for a lot of reasons, one of them could be having two NICs.
The only solution I can find is to run a loop to retry Add-Computer (maybe twice or thrice) in case of failure. The condition to break the loop can be result of the command (Get-WmiObject -Class Win32_ComputerSystem).PartOfDomain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants