Skip to content

Instantly share code, notes, and snippets.

@hh
Created August 18, 2014 22:27
Show Gist options
  • Save hh/a5341d4322a118790e46 to your computer and use it in GitHub Desktop.
Save hh/a5341d4322a118790e46 to your computer and use it in GitHub Desktop.
Knife VCHS create windows server with auto login failing
$ time bundle exec knife vchs server create --winrm-password 'Miocmup4uVszX4y@' --image W2K12-STD-R2-64BIT --bootstrap-protocol winrm --customization-script ./install-winrm-2k12.bat
...
...
...
[1] pry(#<Fog::Compute::VcloudDirector::Real>)> continue
excon.request
:body => "<?xml version=\"1.0\"?>\n<GuestCustomizationSection xmlns=\"http://www.vmware.com/vcloud/v1.5\" xmlns:ovf
=\"http://schemas.dmtf.org/ovf/envelope/1\">\n <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>\n <Enabled>true</E
nabled>\n <ChangeSid>true</ChangeSid>\n <JoinDomainEnabled>false</JoinDomainEnabled>\n <UseOrgSettings>false</UseOrgSettings>\n
<AdminPasswordEnabled>true</AdminPasswordEnabled>\n <AdminPasswordAuto>false</AdminPasswordAuto>\n <AdminPassword>Miocmup4uVsz
X4y@</AdminPassword>\n <ResetPasswordRequired>false</ResetPasswordRequired>\n <CustomizationScript>cmd.exe /c winrm quickconfig
-q\ncmd.exe /c winrm quickconfig -transport:http\ncmd.exe /c winrm set winrm/config @{MaxTimeoutms=\"1800000\"}\ncmd.exe /c winrm
set winrm/config/winrs @{MaxMemoryPerShellMB=\"300\"}\ncmd.exe /c winrm set winrm/config/service @{AllowUnencrypted=\"true\"}\ncmd
.exe /c winrm set winrm/config/service/auth @{Basic=\"true\"}\ncmd.exe /c winrm set winrm/config/client/auth @{Basic=\"true\"}\ncm
d.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port=\"5985\"} \ncmd.exe /c netsh advfirewall firewall set rul
e group=\"remote administration\" new enable=yes\ncmd.exe /c netsh firewall add portopening TCP 5985 \"Port 5985\"\ncmd.exe /c net
stop winrm\ncmd.exe /c sc config winrm start= auto\ncmd.exe /c net start winrm \npowershell -Command \"Set-ExecutionPolicy -Execu
tionPolicy RemoteSigned -Force\"\n</CustomizationScript>\n <ComputerName>vchs-554972837</ComputerName>\n <AdminAutoLogonEnabled>
true</AdminAutoLogonEnabled>\n <AdminAutoLogonCount>100</AdminAutoLogonCount>\n</GuestCustomizationSection>\n"
:chunk_size => 1048576
:ciphers => "HIGH:!SSLv2:!aNULL:!eNULL:!3DES"
:connect_timeout => 60
:debug_request => true
:debug_response => true
:expects => 202
:headers => {
"Accept" => "application/*+xml;version=5.6"
"Content-Type" => "application/vnd.vmware.vcloud.guestCustomizationSection+xml"
"Host" => "p3v11-vcd.vchs.vmware.com:443"
"User-Agent" => "fog/1.23.0"
"x-vcloud-authorization" => "3e17dd2fcc4e48de832631af591de1f2"
}
:host => "p3v11-vcd.vchs.vmware.com"
:idempotent => nil
:instrumentor => Excon::StandardInstrumentor
:instrumentor_name => "excon"
:method => "PUT"
:middlewares => [
Excon::Middleware::ResponseParser
Excon::Middleware::Expects
Excon::Middleware::Idempotent
Excon::Middleware::Instrumentor
Excon::Middleware::Mock
]
:mock => false
:nonblock => true
:omit_default_port => false
:path => "/api/vApp/vm-46b2a791-2775-4b1b-ad73-168e86d7ab60/guestCustomizationSection"
:persistent => false
:port => 443
:query => nil
:read_timeout => 60
:response_block => #<Proc:0x000000065f8f60@/home/pair/src/fog/lib/fog/xml/sax_parser_connection.rb:29 (lambda)>
:retries_remaining => 4
:retry_limit => 4
:scheme => "https"
:ssl_verify_peer => true
:tcp_nodelay => false
:uri_parser => URI
:versions => "excon/0.39.5 (x86_64-linux) ruby/1.9.3"
:write_timeout => 60
excon.error
:error => #<Excon::Errors::BadRequest: Expected(202) <=> Actual(400 Bad Request)
excon.error.request
:body => "<?xml version=\"1.0\"?>\n<GuestCustomizationSection xmlns=\"http://www.vmware.com/vcloud/v1.5\" xmlns:ovf
=\"http://schemas.dmtf.org/ovf/envelope/1\">\n <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>\n <Enabled>true</$
nabled>\n <ChangeSid>true</ChangeSid>\n <JoinDomainEnabled>false</JoinDomainEnabled>\n <UseOrgSettings>false</UseOrgSettings>\$
<AdminPasswordEnabled>true</AdminPasswordEnabled>\n <AdminPasswordAuto>false</AdminPasswordAuto>\n <AdminPassword>Miocmup4uVs$
X4y@</AdminPassword>\n <ResetPasswordRequired>false</ResetPasswordRequired>\n <CustomizationScript>cmd.exe /c winrm quickconfig
-q\ncmd.exe /c winrm quickconfig -transport:http\ncmd.exe /c winrm set winrm/config @{MaxTimeoutms=\"1800000\"}\ncmd.exe /c winrm
set winrm/config/winrs @{MaxMemoryPerShellMB=\"300\"}\ncmd.exe /c winrm set winrm/config/service @{AllowUnencrypted=\"true\"}\ncmd
.exe /c winrm set winrm/config/service/auth @{Basic=\"true\"}\ncmd.exe /c winrm set winrm/config/client/auth @{Basic=\"true\"}\ncm
d.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port=\"5985\"} \ncmd.exe /c netsh advfirewall firewall set rul
e group=\"remote administration\" new enable=yes\ncmd.exe /c netsh firewall add portopening TCP 5985 \"Port 5985\"\ncmd.exe /c net
stop winrm\ncmd.exe /c sc config winrm start= auto\ncmd.exe /c net start winrm \npowershell -Command \"Set-ExecutionPolicy -Execu
tionPolicy RemoteSigned -Force\"\n</CustomizationScript>\n <ComputerName>vchs-554972837</ComputerName>\n <AdminAutoLogonEnabled>
true</AdminAutoLogonEnabled>\n <AdminAutoLogonCount>100</AdminAutoLogonCount>\n</GuestCustomizationSection>\n"
:chunk_size => 1048576
:ciphers => "HIGH:!SSLv2:!aNULL:!eNULL:!3DES"
:connect_timeout => 60
:debug_request => true
:debug_response => true
:expects => 202
:headers => {
"Accept" => "application/*+xml;version=5.6"
"Content-Length" => 1591
"Content-Type" => "application/vnd.vmware.vcloud.guestCustomizationSection+xml"
"Host" => "p3v11-vcd.vchs.vmware.com:443"
"User-Agent" => "fog/1.23.0"
"x-vcloud-authorization" => "3e17dd2fcc4e48de832631af591de1f2"
}
:host => "p3v11-vcd.vchs.vmware.com"
:idempotent => nil
:instrumentor => Excon::StandardInstrumentor
:instrumentor_name => "excon"
:method => "PUT"
:middlewares => [
Excon::Middleware::ResponseParser
Excon::Middleware::Expects
Excon::Middleware::Idempotent
Excon::Middleware::Instrumentor
Excon::Middleware::Mock
]
:mock => false
:nonblock => true
:omit_default_port => false
:path => "/api/vApp/vm-46b2a791-2775-4b1b-ad73-168e86d7ab60/guestCustomizationSection"
:persistent => false
:port => 443
:query => nil
:read_timeout => 60
:response_block => #<Proc:0x000000065f8f60@/home/pair/src/fog/lib/fog/xml/sax_parser_connection.rb:29 (lambda)>
:retries_remaining => 4
:retry_limit => 4
:scheme => "https"
:ssl_verify_peer => true
:tcp_nodelay => false
:uri_parser => URI
:versions => "excon/0.39.5 (x86_64-linux) ruby/1.9.3"
:write_timeout => 60
excon.error.response
:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error xmlns=\"http://www.vmware.com/vcloud/v1.5\" majorErrorCod$
=\"400\" message=\"Bad request\n - Unexpected JAXB Exception\n - cvc-complex-type.2.4.a: Invalid content was found starting with $
lement 'AdminAutoLogonEnabled'. One of '{&quot;http://www.vmware.com/vcloud/v1.5&quot;:Link, WC[##other:&quot;http://www.vmware.c$
m/vcloud/v1.5&quot;]}' is expected.\" minorErrorCode=\"BAD_REQUEST\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:$
chemaLocation=\"http://www.vmware.com/vcloud/v1.5 http://10.6.50.3/api/v1.5/schema/master.xsd\"></Error>\n"
:headers => {
"Content-Length" => "585"
"Content-Type" => "application/vnd.vmware.vcloud.error+xml;version=5.6"
"Date" => "Mon, 18 Aug 2014 22:24:45 GMT, Mon, 18 Aug 2014 22:24:45 GMT"
"Vary" => "Accept-Encoding"
"X-VMWARE-VCLOUD-REQUEST-EXECUTION-TIME" => "19"
"X-VMWARE-VCLOUD-REQUEST-ID" => "0fe0ff8f-7939-4e0e-a382-32b306e5d6ea"
}
:local_address => "192.168.109.7"
:local_port => 35492
:remote_ip => "216.136.198.42"
:status => 400
>
ERROR: Fog::Compute::VcloudDirector::BadRequest: Bad request - Unexpected JAXB Exception - cvc-complex-type.2.4.a: Invalid conte
nt was found starting with element 'AdminAutoLogonEnabled'. One of '{"http://www.vmware.com/vcloud/v1.5":Link, WC[##other:"http://
www.vmware.com/vcloud/v1.5"]}' is expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment