surfertje Posted September 4, 2008 Posted September 4, 2008 Because i wan't to automate as much as possible by restoring or making a image and want to delete a disk with all partitions and then off course create a new partition NTFS with use of Winpe and WDS/WAIK etc for windowsxp SP2 clients.Reading thru google says that i best use diskpart for the partitions and startnet.cmd to start diskpart.But i don't understand how to edit startnet.cmd to start a diskpart file and how to make a diskpart file to wipe out the disk and create new partition for restoring to that partition.I have read that i must mount a image with imagex but how do i edit the startnet.cmd then?Must i make a startnet.cmd in every image i got?
TheReasonIFail Posted September 4, 2008 Posted September 4, 2008 You'll have to create a text file with the command you want and add this to your startnet.cmd:DISKPART /S FILE.TXTMy text file has this:SELECT DISK 0CLEANCREATE PARTITION PRIMARYFORMAT FS=NTFS LABEL="Windows XP" QUICKSELECT PARTITION 1ASSIGN LETTER=CACTIVEEXIT
surfertje Posted September 5, 2008 Author Posted September 5, 2008 You'll have to create a text file with the command you want and add this to your startnet.cmd:DISKPART /S FILE.TXTMy text file has this:SELECT DISK 0CLEANCREATE PARTITION PRIMARYFORMAT FS=NTFS LABEL="Windows XP" QUICKSELECT PARTITION 1ASSIGN LETTER=CACTIVEEXITThx, but how do i add the textfile to a startnet.cmd?
jaclaz Posted September 5, 2008 Posted September 5, 2008 Thx, but how do i add the textfile to a startnet.cmd?You do not "add" FILE.TXT to startnet.cmdyou add the line:DISKPART /S FILE.TXTinside startnet.cmd, with notepad or other "pure text" editor.this invokes diskpart using the FILE.TXT as a series (or batch) of commands that will be executed automatically.FILE.TXT, with the contents of the previous post or your custom ones, must obviously be in the same directory of startnet.cmd.jaclaz
surfertje Posted September 6, 2008 Author Posted September 6, 2008 Thx, but how do i add the textfile to a startnet.cmd?You do not "add" FILE.TXT to startnet.cmdyou add the line:DISKPART /S FILE.TXTinside startnet.cmd, with notepad or other "pure text" editor.this invokes diskpart using the FILE.TXT as a series (or batch) of commands that will be executed automatically.FILE.TXT, with the contents of the previous post or your custom ones, must obviously be in the same directory of startnet.cmd.jaclazOk. The part of file.txt and diskpart is clear to me, but the startnet.cmd not yet. I have read that startnet.cmd is in the windows\system32 folder on every image. What must i do to add the command diskpart etc to startnet.cmd?Mount a image and then? or make a startnet.cmd of my own with notepad but how to add it to a image?
surfertje Posted September 9, 2008 Author Posted September 9, 2008 Thx, but how do i add the textfile to a startnet.cmd?You do not "add" FILE.TXT to startnet.cmdyou add the line:DISKPART /S FILE.TXTinside startnet.cmd, with notepad or other "pure text" editor.this invokes diskpart using the FILE.TXT as a series (or batch) of commands that will be executed automatically.FILE.TXT, with the contents of the previous post or your custom ones, must obviously be in the same directory of startnet.cmd.jaclazOk. The part of file.txt and diskpart is clear to me, but the startnet.cmd not yet. I have read that startnet.cmd is in the windows\system32 folder on every image. What must i do to add the command diskpart etc to startnet.cmd?Mount a image and then? or make a startnet.cmd of my own with notepad but how to add it to a image?Can you help me with this, i can't really find how to edit / make the startnet.cmd and how to add it etc?
jaclaz Posted September 9, 2008 Posted September 9, 2008 I am not sure I actually can.I am failing to see what your question actually is.Do you already have a startnet.cmd?Read this first thing:http://technet.microsoft.com/en-us/library/cc766521.aspxstartnet.cmd is a simple batch file (under NT/2K/XP/2003 batch files can have both the .bat or .cmd extension, the latter is the "proper" one) that is autoexecuted, you may think at it like the old AUTOEXEC.BAT of DOS/Win9x/Me.It is a plain TEXT .txt file (that you can make with Notepad) with it's extension changed to .cmd.Any batch command inside the startnet.cmd is executed.You either add the said line to an existing startnet.cmd or you create with notepad a new file named startnet.cmd adding to it that line.The said line:DISKPART /S FILE.TXTwill call DISKPART.EXE with the /S parameter (which makes diskpart parse a Script file) and feed to it the name of such a file: FILE.TXTFILE.TXT, with the contents seen before is a simple sequence of commands, that diskpart will execute, exactly as if they were given one by one on command line.jaclaz
surfertje Posted September 9, 2008 Author Posted September 9, 2008 Thx, but how do i add the textfile to a startnet.cmd?You do not "add" FILE.TXT to startnet.cmdyou add the line:DISKPART /S FILE.TXTinside startnet.cmd, with notepad or other "pure text" editor.this invokes diskpart using the FILE.TXT as a series (or batch) of commands that will be executed automatically.FILE.TXT, with the contents of the previous post or your custom ones, must obviously be in the same directory of startnet.cmd.jaclazOk. The part of file.txt and diskpart is clear to me, but the startnet.cmd not yet. I have read that startnet.cmd is in the windows\system32 folder on every image. What must i do to add the command diskpart etc to startnet.cmd?Mount a image and then? or make a startnet.cmd of my own with notepad but how to add it to a image?Can you help me with this, i can't really find how to edit / make the startnet.cmd and how to add it etc?I think i know a little more.I am mounting the boot.wim. ype in: edit d:\wds\mount\startnet.cmd (path where i mounted boot.wim).After the wpinit i put in the rule: diskpart /s diskpart.txt (this is a little confusing: diskpart.txt must excist but where do i put the diskpart.txt, must i also choose in the mounted boot.wim: edit c:\diskpart.txt and put in the lines?)And must i do this also voor the install image?Must i then add the boot.wim and install.wim to the wds first remove then add or is replace enough?
jaclaz Posted September 9, 2008 Posted September 9, 2008 surfetje,there is no need to quote entire previous posts, it only makes the topic pretty much unreadable.About the where to put diskpart.txt, try to look at it from another angle, when the startnet.cmd will be executed, at a certain point it will call diskpart.exe, and diskpart.exe will call diskpart.txt (without any drive/path specified).Isn't the answer easy? Diskpart.txt must be anywhere it can be found by diskpart.exe at the time it will run, i.e. in the same directory as startnet.cmd, which, as detailed in the given link, should be %SYSTEMROOT%\System32 of the image.I have no idea how you are mounting the .wim image, and what do you mean by "d:\wds\mount\startnet.cmd (path where i mounted boot.wim)" and "c:\diskpart.txt"Maybe we are using different "terms", but I really do not understand what you mean.jaclaz
surfertje Posted September 10, 2008 Author Posted September 10, 2008 With mounting to d"\wds\mount i mean: the image is mounted with imagex. I have read that i must mount the image to edit startnet.cmd and diskpart.When i don't mount the image the startnet.cmd cannot be edited?But on a article on the internet i saw it is also possible to use Unattend.xml fot automating like formatting etc. in the windowsPE phase, in combination with windowsXP. Can i use unattend.xml instead of startnet.cmd? Because this unattend can be edited with WAIK which makes it easyer. I have tried it already but unattend doesn't do anything when i make use of it with windowsxp..
jaclaz Posted September 10, 2008 Posted September 10, 2008 Of course the .wim needs to be mounted, how would you access it's contents otherwise?Maybe you should use one of the GUIS available:http://www.autoitscript.com/gimagex/http://www.msfn.org/board/GImageX-and-WIMM...ls-t107920.htmlhttp://www.911cd.net/forums//index.php?showtopic=20706http://www.boot-land.net/forums/?showtopic=3001But, no offence whatever intended , you appear to have not yet fully grasped the theory behind the use of .wim images.If I may give you some advice:You should re-study the available documentation and online one, start here:http://technet.microsoft.com/en-us/library/cc721929.aspxInitially do try building normal, simple deploying images, to get the hang of the procedure, and only later introduce variations, unattended install, partitioning and the like.I suspect that at the moment you are attempting to have "everything an now" without being sufficiently familiar with the basics. jaclaz
thuun derboy Posted April 26, 2009 Posted April 26, 2009 to use just a single cmd to perform the diskpart funtions; try somthing like...@echo offverset script=%temp%\vdisk.txt>"%script%" echo create vdisk file=c:\Win7_x86.vhd maximum=%1>>"%script%" echo select vdisk file=c:\Win7_x86.vhd>>"%script%" echo attach vdisk>>"%script%" echo exitdiskpart /s "%script%"info on above: cmd is part of my windows 7 vhd based setup script placed in the pe system32 dir.
eHyde Posted April 29, 2009 Posted April 29, 2009 Hi to all,reagrding this topic, i have some doubts:1) startnet cmd is not in my system32 folder, so i suppose that i need to create it in the pc that i want to clone. -> IS it true?2) how can i apply the image from the same script. This is my final scenario: i have a boot cd with os image and all the need to start ImageX enviroment. I can use the commands listed above in order to clean, create and format the partition, but how can i apply the image in this new partition? I don't know if in my final target pc there is one or more hd, so i can not refer to, in example, d:\myimage, because i'm not sure that cdrom is D.How can i dinamycally search the image to apply?!
ner Posted April 29, 2009 Posted April 29, 2009 (edited) This the cmd file that I use, I call this from a menu.... that is loaded during the loading of vistape (Winpe 2)This allows me then to choose which image i wish to install on the PC that I am working on... That way you still have control..@echo offcd /d %~dp0set imgx=%cd%if not exist "%cd%\imagex.exe" goto _notexistgoto _main:_notexistecho.echo IMAGEX.EXE executable not found. Please ensure that IMAGEX_APPLY.CMD echo is in the same folder as IMAGEX.EXE before executing this script.echo This script will now exit.echo.pauseexit:_mainecho.echo.echo.echo [i M A G E X A P P L Y M A I N M E N U]echo.echo 1) Specify or change source path (the path to you .wim image file)echo Source: [%_asource%]echo.echo 2) Specify or change target path, where your image will be restoredecho Target: [%_atarget%]echo.echo 3) Specify or change index you want to restore (a number, such as 2)echo Index: [%_index%]echo.if "%_asource%" == "" goto _menu1if "%_atarget%" == "" goto _menu1if "%_index%" == "" goto _menu1echo 4) Apply your image now where readyecho From [%_asource%] To [%_atarget%]echo.:_menu1echo Q) Quit. R) Reset all variables.echo.:_mainchset _ok=set /p _ok=Enter your choice: if "%_ok%" == "1" goto _getsrcif "%_ok%" == "2" goto _gettargetif "%_ok%" == "3" goto _getindexif "%_ok%" == "4" goto _applyif /I "%_ok%" == "q" goto _endif /I "%_ok%" == "r" goto _resetgoto _mainch:_getsrcset _ok=echo.echo Specify location of source image to restore with full path.set /p _ok=Enter Source path: for %%A in (%_ok%) do set _ext=%%~xAif not exist %_ok% ( echo. echo --------------------------------------------------------- echo Path does not exist. Please input a valid location again. echo --------------------------------------------------------- goto _getsrc) else ( if /I "%_ext%"==".wim" ( set _asource=%_ok% setx _asource %_ok% goto _main) else ( echo. echo --------------------------------------------------------------- echo Error: The path "%_ok%" does not seem to be a valid .wim image file. echo --------------------------------------------------------------- goto _getsrc pause)):_gettargetset _ok=echo.echo Specify target to install source image with full path.set /p _ok=Enter Target path: if exist "%_ok%" ( set _atarget=%_ok% setx _atarget %_ok%) else ( echo. echo --------------------------------------------------------------- echo Error: The path "%_ok%" is not a correct location. echo --------------------------------------------------------------- goto _gettarget pause)goto _main:_getindexset _ok=echo.echo Specify image index with numberset /p _ok=Enter Index number: set _index=%_ok%setx _index %_ok%goto _main:_applyecho.echo."%imgx%\imagex.exe" /apply "%_asource%" %_index% "%_atarget%"echo.pausegoto _end:_resetset _asource=set _index=set _atarget=goto _main:_end Edited April 29, 2009 by ner
eHyde Posted April 29, 2009 Posted April 29, 2009 (edited) Thanks ner for this usefull script, but i'm looking for a solution without asking to final user wich is Dvd drive letter (my final users are very stupid). Edited April 29, 2009 by eHyde
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now