أستخدم WDS على خادم مستقل لإعداد ملف جديد أجهزة الكمبيوتر ولإعادة الصورة أجهزة الكمبيوتر عندما ينتهي بهم الأمر مشوهين بشكل لا يمكن إصلاحه. مع عدد لا بأس به من أجهزة الكمبيوتر في منزلي ، من المفيد إعادة رسمها من حين لآخر عند تبديل الأجهزة أو ترقيتها. تتم الآن معظم هذه العملية تلقائيًا بواسطة ملف unattend.xml ، ولكن يبدو أن عملية إعادة التسمية لا تدعمها إحدى الخطوات أجهزة الكمبيوتر العودة إلى اسمهم الأصلي.
كل ما عندي أجهزة الكمبيوتر have static DHCP reservations with their correct hostname (والتي تم تسجيلها أيضًا في DNS) so I figured there must be a way to pull this information and use it to rename them. After much fiddling about I have produced a batch script that will do this (عند تشغيله كمسؤول).
Simple paste the following code into a .cmd file and run it as part of your unattended process (أصف لي أدناه)
1 2 3 4 5 6 7 8 9 10 11 12 13 | @echo off set ip_address_string=“IPv4 Address” FOR /F “usebackq” %%i IN (‘hostname‘) DO SET MYVAR=%%i for /f “usebackq tokens=2 delims=:” %%f in (‘ipconfig ^| findstr /c:%ip_address_string%‘) do ( for /f “usebackq tokens=2 delims=:” %%g in (‘nslookup %%f ^| findstr /c:Name‘) do ( for /F “tokens=1 delims=.” %%a in (“%%g”) do ( for /F “tokens=1 delims= ” %%b in (“%%a”) do ( WMIC ComputerSystem where Name=”%myvar%” call Rename Name=”%%b” goto :eof ) ) ) ) |
أدعو البرنامج النصي الخاص بي من <FirstLogonCommands>
section of ImageUnattend.xml.
1 2 3 4 5 | <SynchronousCommand wcm:action=“add”> <Order>5</Order> <Description>Rename system</Description> <CommandLine>c:\extras\elevate -c c:\extras\rename-pc-from-dns.cmd</CommandLine> </SynchronousCommand> |
To run it as admin I use a little utility (يسمى elevate.exe) هذا يفعل هذا (commands run during setup can elevate without popping up a prompt!). يمكنك الحصول عليه منه المصدر الأصلي
The final piece of the puzzle for my setup is that I modify the windows install image to include an exe file and a little poweershell script — these allow the copying of all the other installers from the network. The exe file is ‘تيارات’ which is a sysinternals (الآن جزء من Microsoft) utility to remove the “this file came from the internet are you sure you want to run it” warning.
I also have the following script as a .ps1 file
1 | copy-item -Path \\wds-server\RemInst\Custom\*.* -Destination C:\Extras |
الخاص بي أولا 4 LogonCommands are then as follows…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <SynchronousCommand wcm:action=“add”> <Order>1</Order> <Description>No standby during setup</Description> <CommandLine>powercfg -change standby-timeout-ac 0</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action=“add”> <Order>2</Order> <Description>Add credentials for access to server via network</Description> <CommandLine>cmdkey /add:wds-server /user:wds-server\administrator /pass:password123</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action=“add”> <Order>3</Order> <Description>Copy scripts and apps from network to extras folder</Description> <CommandLine>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -ExecutionPolicy ByPass -File C:\Extras\copyapps.ps1</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action=“add”> <Order>4</Order> <Description>Remove internet warning from copied apps</Description> <CommandLine>C:\Extras\Streams64.exe -d -d -nobanner C:\Extras\*.* /accepteula</CommandLine> </SynchronousCommand> |
ما رأيك? ترك لنا تعليق أدناه! إذا كنت ترغب في الاشتراك يرجى استخدام الرابط الاشتراك في القائمة في اعلى اليمين. يمكنك أيضا مشاركة هذا مع أصدقائك باستخدام الروابط الاجتماعية أدناه. في صحتك.
اترك رد