Jump to content

Recommended Posts

Posted

I would a piece of to put into my autunattend.xml and unattend.xml to search through all drives except a,b and c.  This code will set a variable to %Drive and then run a batch file called apps,utils and batches then run z.cmd inside a folder on  app,utils and batches.  how is done?  Show in code!


Posted

First of all, people typically don't respond well to demands to give answers or do all of the work for you. Second, it would be good for you to explain how exactly you are designing your deployment workflow.

Since you mention using both XML types (one for install, one for sysprep) it leads me to believe that you are making a deployment image. I have never personally found it useful to add any scripting into Autounattend.xml to begin with because that is only for creating the base installation. It is different if you also intend to use it for a recovery scenario, but in that case you wouldn't end up using two XML files anyways. I've only operated in a structured deployment environment where the need for determining drive letters or scanning for volumes wasn't needed. Nevertheless, for post deployment customizations I would use FirstLogonCommands in the oobeSystem phase to specify a single .cmd file. 

Then within that .cmd file that would be where I would include the scripts. But as I said, I never would need to have to scan for volumes and if I did have to do something like that, I would likely end up writing a program to handle that type of task so that I can leverage WMI and Win32 API calls.

Posted

Here's what I have so far... in AutoUnattend.xml :

<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Description>Search for the unique folder name, and set the drive letter as a variable</Description>
<Path>cmd /c for %i in (D E F G H I J K L N M O P Q R S T U V W X Y Z) do if exist %i\Batches setx /m USBDRIVE=%i:</Path>
</RunSynchronousCommand>
<Description>Dirs</Description>
<Order>2</Order>
<Path>%USBDRIVE%\batches\Directories.cmd</Path>
</RunSynchronousCommand>
</RunSynchronous>

Should This Boot the VM over and over again? How do I stop the Reboots?

How do I visually see what this is doing?

Can this be done in the <RunSyncronous> or do I have to use <RunAsyncronous>?

Should the line with setx be set? 

is the if exist line correct? 

Where do I add the line %USBDrive%\Batches is on %USBDirve?

this should cycle through the Hard Drive and use the drive letter where the directory "batches" and put it into a variable %i .  Then it should use whatever is in %USBrive to run Directories in the directory batches.   Where is the error!?

TIA JTM

Posted

I have not tried to do an installation the way you are thinking about. I would use a solution where the drive letter doesn't matter, which typically means to include the files I need to be installed (including the .cmd file) in the image itself, so that all paths are relative aka on C:\ already. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...