Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1991
  • Last Modified:

Using Windows 7 OPK / WAIK and reagentc to create a hidden Windows RE Partition

I'm trying to create a script to deploy a Windows 7 image en mass, and although it works there is one thing about it that's annoying me and I'm hoping there is a fix.  I am trying to setup a second recovery partition with the Windows RE image as well as the initial system image.  My deployment script and diskpart scripts (see attached) work as they are supposed to, but I'm wondering if there is any way to setup the recovery partition without having a mount point (ie I don't want it to show up as a drive letter).

Is there anyway using reagentc to set the setREimage and setOSimage image paths using disk\partition information instead of a drive letter?  If not, is there a different utility I should be using to achieve what I'm trying to do?  Thanks!
SELECT DISK 0
CLEAN
CREATE PARTITION PRIMARY SIZE=7000 ID=27
FORMAT QUICK FS=NTFS LABEL="Recovery"
ASSIGN LETTER="D"
CREATE PARTITION PRIMARY
FORMAT QUICK FS=NTFS LABEL="Win7_OS"
ASSIGN LETTER="C"
EXIT

Open in new window

@ECHO OFF
SET DISK=%1
SET WIM=%2
CLS
ECHO =====  Specify Source Drive and WIM File =====
IF /I "'%DISK%'"=="''" (
SET /P DISK=Diskpart Config File:  
GOTO WIM
)
ECHO Diskpart Config File:  %DISK%
:WIM
IF /I "'%WIM%'"=="''" (
SET /P WIM=Full Path to Source WIM:  
GOTO VERIFY
)
ECHO Source WIM:  %WIM%
:VERIFY
CLS
ECHO ===============================================================================
ECHO Source:  %WIM%
ECHO Destination:
ECHO ===============================================================================
TYPE %DISK%
ECHO ===============================================================================
ECHO Continuing this program will DESTROY ALL DATA on the drive specified in the
ECHO above disk partitioning script above and then deploy the WIM image specified.
ECHO.
ECHO If the above information is not accurate, or you wish to abort press Ctrl + C
ECHO.
PAUSE
CLS
ECHO Beginning Disk Partitioning...
diskpart /s %DISK%
ECHO.
ECHO Applying WIM image...
imagex /apply %WIM% 1 c:
ECHO.
ECHO Modifying BCD...
bcdboot C:\Windows
ECHO.
ECHO Creating Recovery Partition...
mkdir D:\Recovery\WindowsRE
copy C:\Windows\System32\Recovery\winre.wim D:\Recovery\WindowsRE\
copy %WIM% D:\Recovery\WindowsRE\install.wim
ECHO.
ECHO Adding Recovery Options to F8 Menu...
C:\Windows\System32\reagentc /setREimage /path D:\Recovery\WindowsRE /target C:\Windows
C:\Windows\System32\reagentc /setOSimage /path D:\Recovery\WindowsRE /target C:\Windows
ECHO.
ECHO DONE!
ECHO.

Open in new window

0
swallsvcs
Asked:
swallsvcs
  • 2
1 Solution
 
SPC_75Commented:
either modify the code so that yuo don't need:
ASSIGN LETTER="D"


or Add the line:
REMOVE LETTER D
when the script has finished
0
 
SPC_75Commented:
Actually, the best method using you code seems to be to create a different diskpart script using the following commands:

list volume
Which will look something like the first snippet.
Then type: select volume 0
Then type remove letter X

(subbing in the appropriate values for X and 0)

Ideally you don't need to list the volumes, that just to work out which is which so you can integrate it into your script. I'd guess 0 for you as well since D is actually created first but i'm not 100% on that one.

So the final code should look like this:

SELECT DISK 0
select volume 0
remove letter X
EXIT

-SPC
Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  -------
  Volume 0     X                       DVD-ROM         0 B  No Media
  Volume 1     Y                       DVD-ROM         0 B  No Media
  Volume 2     Z                       DVD-ROM         0 B  No Media
  Volume 3     C                NTFS   Partition   1192 GB  Healthy    System

Open in new window

0
 
swallsvcsAuthor Commented:
Thanks!  At first I was afraid this wouldn't work because reagentc specifies the drive letter as part of the command... but I notice that the actual result is saving the \\disk\partition path to the BCD so this works perfectly.  Sleepy eyes last night :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now