I was trying to use Windows Sandbox to run UniFi server and I wanted to install VC140 as a logon command which seemed to not work 🤔 I was mounting the Desktop folder where I had both the executable and the startup.cmd file. Opening the sandbox and running the script worked. This means that the LogonCommand should also work, right?
VC_redist.x64.exe /install /quiet /norestart |
Well, no, because the scripts needs to use full paths as mentioned in this youtube video.
In order to make the script work, I specified the full path name as follows:
C:\Users\WDAGUtilityAccount\Desktop\VC_redist.x64.exe /install /quiet /norestart |
The final wsb file is the following:
<Configuration> | |
<MappedFolders> | |
<MappedFolder> | |
<HostFolder>C:\sndboxfiles\Ubiquiti UniFi</HostFolder> | |
<SandboxFolder>C:\Users\WDAGUtilityAccount\Ubiquiti UniFi</SandboxFolder> | |
<ReadOnly>False</ReadOnly> | |
</MappedFolder> | |
<MappedFolder> | |
<HostFolder>C:\sndboxfiles\Desktop</HostFolder> | |
<SandboxFolder>C:\Users\WDAGUtilityAccount\Desktop</SandboxFolder> | |
<ReadOnly>False</ReadOnly> | |
</MappedFolder> | |
</MappedFolders> | |
<LogonCommand> | |
<!--You need to use full name paths in the bat script https://www.youtube.com/watch?v=4v0JmPEhaR8 --> | |
<Command>C:\Users\WDAGUtilityAccount\Desktop\startup.cmd</Command> | |
</LogonCommand> | |
<Networking>Enable</Networking> | |
</Configuration> |
In this file, I mount the Ubiquiti UniFi, which is found in my host machine C:\sndboxfiles. This folder contains the extracted files after installing the UniFi server through the downloaded UniFi-installer.exe. I also mount the C:\sndboxfiles\Desktop at the sandbox's user (WDAGUtilityAccount) Desktop. In that folder, I have the VC_redist.x64.exe file which I downloaded from Microsoft and the startup.cmd which installs Visual C++ quietly. The LogonCommand simply executes the script which now works, because the final script invokes the VC_redist.x64.exe with full path name, including the folders.
No comments:
Post a Comment