[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Clean Batch File - Deploying Service Pack 1 for Win7x64Pro

Posted on 2011-04-28
5
Medium Priority
?
1,221 Views
Last Modified: 2012-05-11
I've got a basic computer startup script to deploy Windows 7 SP1:

\\svr\share$\win7sp1\windows6.1-kb976932-x64.exe /quiet /nodialog /forcerestart

I want to add something ahead of this line to have the script check whether SP1 is already installed, and if it is, to terminate the script entirely.  Can this still be done w/ batch or does it have to be done with VBS?  What's the syntax?
0
Comment
Question by:NAMEWITHELD12
  • 2
4 Comments
 
LVL 71

Expert Comment

by:Chris Dent
ID: 35484207
I can't speak for batch scripting really, but WMI knows. And you can get CMD to tell you it with:

WMIC OS GET CSDVersion

If the output from that can be tested...

Chris
0
 
LVL 7

Accepted Solution

by:
CitizenRon earned 2000 total points
ID: 35484759
There's a few ways it can be done, mostly all dealing with server pack or build numbers.

Here's my stab at it using a one-line script, but it's a pretty hefty one-liner.  I went with a REG QUERY comparing the "CurrentBuildNumber" value since Microsoft actually started incrementing that when service packs are added since Microsoft Vista.  Windows 7 is "7600" and Windows 7 SP1 is "7601".

For /f "tokens=3 delims= " %%A In ('REG QUERY "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /V CurrentBuildNumber ^|Find "CurrentBuildNumber"') Do (If %%A LSS 7601 \\svr\share$\win7sp1\windows6.1-kb976932-x64.exe /quiet /nodialog /forcerestart)

Open in new window


Let me know if you need something additional such as OS type detection (WinVista, Win7, etc) as well
0
 
LVL 1

Author Comment

by:NAMEWITHELD12
ID: 35484925
I'll give this a shot on my dev box and post results
0
 
LVL 1

Author Closing Comment

by:NAMEWITHELD12
ID: 35490275
Short and sweet, it seems to work like a charm..thanks!
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
While Plesk offers many potential benefits to website administrators, including compatibility with Windows Server and other leading technologies, the company has also been working to differentiate it from other control panels for content management…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses
Course of the Month18 days, 11 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question