Hey all,
I've got a really weird issue. I've written a small script for my team to automate the build out of our VMs. However, whenever it gets to the point in the script that has the `New-VM` cmdlet, it will error out with the following error:
New-VM : 11/14/2022 12:23:59 PM New-VM Cannot find path '\\domain' because it does not exist.
At \\domain\datadfs\SysAdmin\Scripts\New-Server\New-Server.ps1:594 char:18
+ ... cloneTask = New-VM -ResourcePool $cluster -Datastore $datastore -Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-VM], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM
The relevant part of the script is this
$cloneTask = New-VM -ResourcePool $cluster -Datastore $datastore -Name $server -Template $template -Location $folder -OSCustomizationSpec 'Default OSCustomizationSpec' -RunAsync
My team runs the script from Powershell using the network location, for example "\\domain\datadfs\SysAdmin\Scripts\New-Server\New-Server.ps1". The error also occurs if the FQDN is used. The only time I don't get the error is if I map the network location as a local drive and run it from there. Does anyone know if this is a PowerCLI limitation or am I doing something wrong?