Top-Themen

AppleEntwicklungHardwareInternetLinuxMicrosoftMultimediaNetzwerkeOff TopicSicherheitSonstige SystemeVirtualisierungWeiterbildungZusammenarbeit

Aktuelle Themen

Administrator.de FeedbackApache ServerAppleAssemblerAudioAusbildungAuslandBackupBasicBatch & ShellBenchmarksBibliotheken & ToolkitsBlogsCloud-DiensteClusterCMSCPU, RAM, MainboardsCSSC und C++DatenbankenDatenschutzDebianDigitiales FernsehenDNSDrucker und ScannerDSL, VDSLE-BooksE-BusinessE-MailEntwicklungErkennung und -AbwehrExchange ServerFestplatten, SSD, RaidFirewallFlatratesGoogle AndroidGrafikGrafikkarten & MonitoreGroupwareHardwareHosting & HousingHTMLHumor (lol)Hyper-VIconsIDE & EditorenInformationsdiensteInstallationInstant MessagingInternetInternet DomäneniOSISDN & AnaloganschlüsseiTunesJavaJavaScriptKiXtartKVMLAN, WAN, WirelessLinuxLinux DesktopLinux NetzwerkLinux ToolsLinux UserverwaltungLizenzierungMac OS XMicrosoftMicrosoft OfficeMikroTik RouterOSMonitoringMultimediaMultimedia & ZubehörNetzwerkeNetzwerkgrundlagenNetzwerkmanagementNetzwerkprotokolleNotebook & ZubehörNovell NetwareOff TopicOpenOffice, LibreOfficeOutlook & MailPapierkorbPascal und DelphiPeripheriegerätePerlPHPPythonRechtliche FragenRedHat, CentOS, FedoraRouter & RoutingSambaSAN, NAS, DASSchriftartenSchulung & TrainingSEOServerServer-HardwareSicherheitSicherheits-ToolsSicherheitsgrundlagenSolarisSonstige SystemeSoziale NetzwerkeSpeicherkartenStudentenjobs & PraktikumSuche ProjektpartnerSuseSwitche und HubsTipps & TricksTK-Netze & GeräteUbuntuUMTS, EDGE & GPRSUtilitiesVB for ApplicationsVerschlüsselung & ZertifikateVideo & StreamingViren und TrojanerVirtualisierungVisual StudioVmwareVoice over IPWebbrowserWebentwicklungWeiterbildungWindows 7Windows 8Windows 10Windows InstallationWindows MobileWindows NetzwerkWindows ServerWindows SystemdateienWindows ToolsWindows UpdateWindows UserverwaltungWindows VistaWindows XPXenserverXMLZusammenarbeit

Script für WDS Konfiguration mit unterschiedlichen XML Dateien

Frage Entwicklung Batch & Shell

Mitglied: JoSchFN

JoSchFN (Level 1) - Jetzt verbinden

12.06.2014, aktualisiert 09:01 Uhr, 1506 Aufrufe, 1 Kommentar

Hallo zusammen,

ich bin gerade dabei, die Windows Deployment Services (WDS) über ein Script automatisch zu konfigurieren. Dabei habe ich verschiedene Install-Images, welche je nach Namen unterschiedliche XML Dateien mit Konfigurationen erhalten. Das funktioniert eigentlich auch ganz gut. Nur im Punkt ":: find install images and add it to WDS" gibts noch Probleme. Dabei soll folgendes gemacht werden:
1.) Es soll der Ordner D:\MSI2008\WDS\Install nach allen vorhandenen .wim Dateien durchsucht werden
2.) Abhänging davon, ob im Dateinamen der Begriff "Rocky" vorkommt, soll entweder die Datei "win7_unattend_RALRKE.xml" oder die Datei "win7_unattend_client.xml" angehängt werden. Also wenn Rocky im Dateinamen vorhanden, dann "win7_unattend_RALRKE.xml" sonst "win7_unattend_client.xml".

Das Problem momentan ist, dass er einfach gar nichts macht. Evtl liegt am Aufbau der If Else Abfrage, aber sicher bin ich mir nicht.
Könnt Ihr mir weiterhelfen?

Danke schonmal

Gruß

JoSchFN

Hier noch mein Script:

01.
@echo on 
02.
 
03.
:: define environment 
04.
setlocal EnableDelayedExpansion 
05.
 
06.
:: set variables 
07.
set Hostname=%computername% 
08.
set ImageGroupName="Win7 x64" 
09.
 
10.
set BootImagePath= 
11.
set BootImageName="BootImage - WIN7 x64 Pro SP1 German clients" 
12.
 
13.
set InstallImagePath= 
14.
 
15.
set UnattendFileName_Client=win7_unattend_client.xml 
16.
set UnattendFileName_RALRKE=win7_unattend_RALRKE.xml 
17.
set UnattendFilePath_Client="C:\Install\%UnattendFileName_Client%" 
18.
set UnattendFilePath_RALRKE="C:\Install\%UnattendFileName_RALRKE%" 
19.
 
20.
 
21.
:: initialize WDS Server 
22.
echo. 
23.
echo Initialize WDS Server 
24.
echo ------------------------------------------------------------ 
25.
echo %date% %time% - Initialize WDS Server >> C:\Startup_Logging.txt 
26.
wdsutil /initialize-server /server:%Hostname% /reminst:"D:\RemoteInstall" 
27.
echo %date% %time% - Initialize WDS Server finished - Errorlevel: %errorlevel% >> C:\Startup_Logging.txt 
28.
echo. 
29.
 
30.
 
31.
:: copy wdsunattend image files 
32.
if exist %UnattendFileName_Client% copy %UnattendFilePath_Client% "D:\RemoteInstall\WDSClientUnattend" 
33.
if exist %UnattendFileName_RALRKE% copy %UnattendFilePath_RALRKE% "D:\RemoteInstall\WDSClientUnattend" 
34.
 
35.
 
36.
:: add wdsunattend image files 
37.
wdsutil /set-server /wdsunattend /policy:enabled /file:wdsclientunattend\%UnattendFileName_Client% /Architecture:x86 
38.
wdsutil /set-server /wdsunattend /policy:enabled /file:wdsclientunattend\%UnattendFileName_Client% /Architecture:x64 
39.
 
40.
 
41.
:: create image group 
42.
wdsutil /add-imagegroup /imagegroup:%ImageGroupName% /server:%Hostname% 
43.
 
44.
 
45.
:: configure dhcp and respond options 
46.
wdsutil /set-server /usedhcpports:no /dhcpoption60:yes 
47.
wdsutil /set-server /answerclients:known /responsedelay:0 
48.
 
49.
 
50.
:: enable x64 support 
51.
wdsutil /set-server /architecturediscovery:yes 
52.
 
53.
 
54.
:: enable check port usage before bind WDS to any port 
55.
:: refer to http://support.microsoft.com/kb/977512 
56.
reg add HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\WDSServer\Parameters /v "UdpPortPolicy" /t REG_DWORD /d "0" /f > nul 2>&1 
57.
 
58.
 
59.
:: find boot images and add it to WDS 
60.
echo. 
61.
echo Find BOOT images and add it to WDS 
62.
echo ------------------------------------------------------------ 
63.
echo %date% %time% - Add BOOT Image to WDS >> C:\Startup_Logging.txt 
64.
for %%a in ("D:\MSI2008\WDS\Boot\*.wim") do ( 
65.
set BootImagePath=%%a 
66.
echo !BootImagePath! 
67.
wdsutil /add-image /imagefile:!BootImagePath! /imagetype:boot /name:%bootimagename% 
68.
echo %date% %time% - BOOT Image !BootImagePath! added 
69.
echo %date% %time% - BOOT Image !BootImagePath! added - Errorlevel: %errorlevel% >> C:\Startup_Logging.txt 
70.
71.
echo %date% %time% - BOOT Image added - Errorlevel: %errorlevel% >> C:\Startup_Logging.txt 
72.
 
73.
 
74.
:: find install images and add it to WDS 
75.
echo. 
76.
echo Find INSTALL images and add it to WDS 
77.
echo ------------------------------------------------------------ 
78.
echo %date% %time% - Add INSTALL Images to WDS >> C:\Startup_Logging.txt 
79.
	for %%a in ("D:\MSI2008\WDS\Install\*.wim") do ( 
80.
		set ImagePath=%%a 
81.
 
82.
		find /c /i "rocky" %ImagePath% > NUL 
83.
			 
84.
		if %ERRORLEVEL%==0 ( 
85.
			echo wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:%imagegroupname% /unattendfile:%UnattendFileName_RALRKE% 
86.
			wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:%imagegroupname% /unattendfile:%UnattendFileName_RALRKE% 
87.
			echo %date% %time% - INSTALL Image !InstallImagePath! added  
88.
			echo %date% %time% - INSTALL Image !InstallImagePath! added - Errorlevel: %errorlevel% >> C:\Startup_Logging.txt		 
89.
		) else ( 
90.
			echo wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:%imagegroupname% /unattendfile:%UnattendFileName_Client% 
91.
			wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:%imagegroupname% /unattendfile:%UnattendFileName_Client% 
92.
			echo %date% %time% - INSTALL Image !InstallImagePath! added 
93.
			echo %date% %time% - INSTALL Image !InstallImagePath! added - Errorlevel: %errorlevel% >> C:\Startup_Logging.txt 
94.
		)	 
95.
96.
echo %date% %time% - INSTALL Images successfully added - Errorlevel: %errorlevel% >> C:\Startup_Logging.txt 
97.
echo. 
98.
Pause
Mitglied: JoSchFN
12.06.2014, aktualisiert um 08:59 Uhr
Sieht sieht die Ausgabe aus, wenn ich sie in eine Datei umleite:


C:\Install>setlocal EnableDelayedExpansion

C:\Install>set Hostname=Server01

C:\Install>set ImageGroupName="Win7 x64"

C:\Install>set BootImagePath=

C:\Install>set BootImageName="BootImage - WIN7 x64 Pro SP1 German clients"

C:\Install>set InstallImagePath=

C:\Install>set UnattendFileName_Client=win7_unattend_client.xml

C:\Install>set UnattendFileName_RALRKE=win7_unattend_RALRKE.xml

C:\Install>set UnattendFilePath_Client="C:\Install\win7_unattend_client.xml"

C:\Install>set UnattendFilePath_RALRKE="C:\Install\win7_unattend_RALRKE.xml"

C:\Install>echo.


C:\Install>echo Initialize WDS Server
Initialize WDS Server

C:\Install>echo ------------------------------------------------------------
C:\Install>echo 11.06.2014 23:36:34,58 - Initialize WDS Server 1>>C:\Startup_Logging.txt

C:\Install>wdsutil /initialize-server /server:Server01 /reminst:"D:\RemoteInstall"
ÿþ
W i n d o w s D e p l o y m e n t S e r v i c e s M a n a g e m e n t U t i l i t y [ V e r s i o n 6 . 1 . 7 6 0 0 . 1 6 3 8 5 ]
C o p y r i g h t ( C ) M i c r o s o f t C o r p o r a t i o n . A l l r i g h t s r e s e r v e d .

T h e c o m m a n d c o m p l e t e d s u c c e s s f u l l y .

C:\Install>echo 11.06.2014 23:36:40,04 - Initialize WDS Server finished - Errorlevel: 0 1>>C:\Startup_Logging.txt

C:\Install>echo.


C:\Install>if exist win7_unattend_client.xml copy "C:\Install\win7_unattend_client.xml" "D:\RemoteInstall\WDSClientUnattend"
1 file(s) copied.

C:\Install>if exist win7_unattend_RALRKE.xml copy "C:\Install\win7_unattend_RALRKE.xml" "D:\RemoteInstall\WDSClientUnattend"
1 file(s) copied.

C:\Install>wdsutil /set-server /wdsunattend /policy:enabled /file:wdsclientunattend\win7_unattend_client.xml /Architecture:x86
ÿþ
W i n d o w s D e p l o y m e n t S e r v i c e s M a n a g e m e n t U t i l i t y [ V e r s i o n 6 . 1 . 7 6 0 0 . 1 6 3 8 5 ]
C o p y r i g h t ( C ) M i c r o s o f t C o r p o r a t i o n . A l l r i g h t s r e s e r v e d .

T h e c o m m a n d c o m p l e t e d s u c c e s s f u l l y .

C:\Install>wdsutil /set-server /wdsunattend /policy:enabled /file:wdsclientunattend\win7_unattend_client.xml /Architecture:x64
ÿþ
W i n d o w s D e p l o y m e n t S e r v i c e s M a n a g e m e n t U t i l i t y [ V e r s i o n 6 . 1 . 7 6 0 0 . 1 6 3 8 5 ]
C o p y r i g h t ( C ) M i c r o s o f t C o r p o r a t i o n . A l l r i g h t s r e s e r v e d .

T h e c o m m a n d c o m p l e t e d s u c c e s s f u l l y .

C:\Install>wdsutil /add-imagegroup /imagegroup:"Win7 x64" /server:Server01
ÿþ
W i n d o w s D e p l o y m e n t S e r v i c e s M a n a g e m e n t U t i l i t y [ V e r s i o n 6 . 1 . 7 6 0 0 . 1 6 3 8 5 ]
C o p y r i g h t ( C ) M i c r o s o f t C o r p o r a t i o n . A l l r i g h t s r e s e r v e d .

T h e c o m m a n d c o m p l e t e d s u c c e s s f u l l y .

C:\Install>wdsutil /set-server /usedhcpports:no /dhcpoption60:yes
ÿþ
W i n d o w s D e p l o y m e n t S e r v i c e s M a n a g e m e n t U t i l i t y [ V e r s i o n 6 . 1 . 7 6 0 0 . 1 6 3 8 5 ]
C o p y r i g h t ( C ) M i c r o s o f t C o r p o r a t i o n . A l l r i g h t s r e s e r v e d .

T h e c o m m a n d c o m p l e t e d s u c c e s s f u l l y .

C:\Install>wdsutil /set-server /answerclients:known /responsedelay:0
ÿþ
W i n d o w s D e p l o y m e n t S e r v i c e s M a n a g e m e n t U t i l i t y [ V e r s i o n 6 . 1 . 7 6 0 0 . 1 6 3 8 5 ]
C o p y r i g h t ( C ) M i c r o s o f t C o r p o r a t i o n . A l l r i g h t s r e s e r v e d .

T h e c o m m a n d c o m p l e t e d s u c c e s s f u l l y .

C:\Install>wdsutil /set-server /architecturediscovery:yes
ÿþ
W i n d o w s D e p l o y m e n t S e r v i c e s M a n a g e m e n t U t i l i t y [ V e r s i o n 6 . 1 . 7 6 0 0 . 1 6 3 8 5 ]
C o p y r i g h t ( C ) M i c r o s o f t C o r p o r a t i o n . A l l r i g h t s r e s e r v e d .

T h e c o m m a n d c o m p l e t e d s u c c e s s f u l l y .

C:\Install>reg add HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\WDSServer\Parameters /v "UdpPortPolicy" /t REG_DWORD /d "0" /f 1>nul 2>&1

C:\Install>echo.


C:\Install>echo Find BOOT images and add it to WDS
Find BOOT images and add it to WDS

C:\Install>echo ------------------------------------------------------------
C:\Install>echo 11.06.2014 23:36:40,58 - Add BOOT Image to WDS 1>>C:\Startup_Logging.txt

C:\Install>for %a in ("D:\MSI2008\WDS\Boot\*.wim") do (
set BootImagePath=%a
echo !BootImagePath!
wdsutil /add-image /imagefile:!BootImagePath! /imagetype:boot /name:"BootImage - WIN7 x64 Pro SP1 German clients"
echo 11.06.2014 23:36:40,60 - BOOT Image !BootImagePath! added
echo 11.06.2014 23:36:40,60 - BOOT Image !BootImagePath! added - Errorlevel: 0 1>>C:\Startup_Logging.txt
)

C:\Install>(
set BootImagePath=D:\MSI2008\WDS\Boot\boot_image_x86.wim
echo !BootImagePath!
wdsutil /add-image /imagefile:!BootImagePath! /imagetype:boot /name:"BootImage - WIN7 x64 Pro SP1 German clients"
echo 11.06.2014 23:36:40,60 - BOOT Image !BootImagePath! added
echo 11.06.2014 23:36:40,60 - BOOT Image !BootImagePath! added - Errorlevel: 0 1>>C:\Startup_Logging.txt
)
D:\MSI2008\WDS\Boot\boot_image_x86.wim
ÿþ
W i n d o w s D e p l o y m e n t S e r v i c e s M a n a g e m e n t U t i l i t y [ V e r s i o n 6 . 1 . 7 6 0 0 . 1 6 3 8 5 ]
C o p y r i g h t ( C ) M i c r o s o f t C o r p o r a t i o n . A l l r i g h t s r e s e r v e d .

T h e c o m m a n d c o m p l e t e d s u c c e s s f u l l y .
11.06.2014 23:36:40,60 - BOOT Image D:\MSI2008\WDS\Boot\boot_image_x86.wim added

C:\Install>echo 11.06.2014 23:36:45,15 - BOOT Image added - Errorlevel: 0 1>>C:\Startup_Logging.txt

C:\Install>echo.


C:\Install>echo Find INSTALL images and add it to WDS
Find INSTALL images and add it to WDS

C:\Install>echo ------------------------------------------------------------
C:\Install>echo 11.06.2014 23:36:45,15 - Add INSTALL Images to WDS 1>>C:\Startup_Logging.txt

C:\Install>for %a in ("D:\MSI2008\WDS\Install\*.wim") do (
set ImagePath=%a
find /c /i "rocky" 1>NUL
if 0 == 0 (
echo wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:"Win7 x64" /unattendfile:win7_unattend_RALRKE.xml
wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:"Win7 x64" /unattendfile:win7_unattend_RALRKE.xml
echo 11.06.2014 23:36:45,15 - INSTALL Image !InstallImagePath! added
echo 11.06.2014 23:36:45,15 - INSTALL Image !InstallImagePath! added - Errorlevel: 0 1>>C:\Startup_Logging.txt
) else (
echo wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:"Win7 x64" /unattendfile:win7_unattend_client.xml
wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:"Win7 x64" /unattendfile:win7_unattend_client.xml
echo 11.06.2014 23:36:45,15 - INSTALL Image !InstallImagePath! added
echo 11.06.2014 23:36:45,15 - INSTALL Image !InstallImagePath! added - Errorlevel: 0 1>>C:\Startup_Logging.txt
)
)

C:\Install>(
set ImagePath=D:\MSI2008\WDS\Install\HP_Z400_Z420_WIN7.wim
find /c /i "rocky" 1>NUL
if 0 == 0 (
echo wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:"Win7 x64" /unattendfile:win7_unattend_RALRKE.xml
wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:"Win7 x64" /unattendfile:win7_unattend_RALRKE.xml
echo 11.06.2014 23:36:45,15 - INSTALL Image !InstallImagePath! added
echo 11.06.2014 23:36:45,15 - INSTALL Image !InstallImagePath! added - Errorlevel: 0 1>>C:\Startup_Logging.txt
) else (
echo wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:"Win7 x64" /unattendfile:win7_unattend_client.xml
wdsutil /add-image /imagefile:!ImagePath! /imagetype:install /imagegroup:"Win7 x64" /unattendfile:win7_unattend_client.xml
echo 11.06.2014 23:36:45,15 - INSTALL Image !InstallImagePath! added
echo 11.06.2014 23:36:45,15 - INSTALL Image !InstallImagePath! added - Errorlevel: 0 1>>C:\Startup_Logging.txt
)
)
Bitte warten ..
Neuester Wissensbeitrag
Microsoft

Lizenzwiederverkauf und seine Tücken

(5)

Erfahrungsbericht von DerWoWusste zum Thema Microsoft ...

Heiß diskutierte Inhalte
Windows Netzwerk
Windows 10 RDP geht nicht (16)

Frage von Fiasko zum Thema Windows Netzwerk ...

Windows Server
Outlook Verbindungsversuch mit Exchange (15)

Frage von xbast1x zum Thema Windows Server ...

Microsoft Office
Keine Updates für Office 2016 (13)

Frage von Motte990 zum Thema Microsoft Office ...