Invoke-VMscript A general system error occurred: vix error codes = (1, 0).

At the moment I try to create a domain controller with PowerShell direct on VMware with the Invoke-VMScript command. I was having problems with the credentials I provided in my script. the steps I take to create my first DC.

  1. Created a VMware template windows server 2016
  2. Created a new VM from that template
  3. Applied my preferred OS specs
  4. Added some CPU en MEM (is optional in my script)
  5. Injected a static IP
  6. Create a AD config variable with all the necessary stuff

Then the script will execute the invoke-VMscript. So here is my problem and solution/workaround.

Problem:
Invoke-VMscript starts running and create the domain I want, but at the end I get this error. After some searching on the internet it turnsout that you cannot login into a domain with local credentials…
Invoke-VMScript : 7/13/2018 12:57:46 PM Invoke-VMScript         A general system error occurred: vix error codes = (1, 0).
At line:1 char:6
+ try{ Invoke-VMScript -VM $Servername -ScriptText $ADconfig -GuestUser …
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Invoke-VMScript], SystemError
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_GetProcessOutputInGuest_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript


Solution:
We start to find the .net object in the error

You will get something like this:
writeErrorStream      : True
PSMessageDetails      :
Exception             : VMware.VimAutomation.ViCore.Types.V1.ErrorHandling.SystemError: 7/13/2018 12:47:23 PM   Invoke-VMScript         A general system error occurred: vix error codes = (1, 0).
—> VMware.Vim.VimException: A general system error occurred: vix error codes = (1, 0).
—> System.ServiceModel.FaultException: A general system error occurred: vix error codes = (1, 0).

Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

*deleted the rest of the stack trace*

TargetObject          :
CategoryInfo          : NotSpecified: (:) [Invoke-VMScript], SystemError
FullyQualifiedErrorId : Client20_VmGuestServiceImpl_GetProcessOutputInGuest_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}

The fist part of the Exception is important VMware.VimAutomation.ViCore.Types.V1.ErrorHandling.SystemError. If you put that in the brackets before the curly brackets and leave the curly brackets empty it will skip this specific error. Because you already know this error is expected…

Off course you can put something in the curl bracket from catch, but i choose not to.

So my Invoke-VMscript command look like this:

 

About the Author

Sander

No Comments

Comments are closed.