/bundles/itninjaweb/img/Breadcrumb_cap_w.png

Blog Posts tagged with Windows 7

Ask a question

[Konf 2011] 100% Windows 7 Deployment Automation

For those of you who were at the Konference, you may have seen my presentation on Windows 7 automation that uses several methods to achieve total automation for the end user experience. For those of you who missed it or who didn't attend the Konference, here is the presentation:

100% Windows 7 Deployment Automation

I will be adding code examples to this post soon, but I at least wanted to make the presentation available. I will also post a link to the video of my presentation if and when it becomes available on the DellKACE website.

For the following examples, much of the code is written in AutoIT. If you are unfamiliar with AutoIT, head over to www.autoitscript.com and download the free IDE and compiler. Also, I wrote an O'Reilly book back in 2007 that is available on Amazon for $7.99 that gives you a basic start with the language. Now, here is the example list. This will be growing.

View comments (1)

Installing windows 7 admin tools as a post install task

A few people have asked if there was a scripted way to deploy the win 7 deployment tools so I thought I would share it.

This link has all the info that you need.


http://technet.microsoft.com/en-us/library/ee449483(v=ws.10).aspx

basically install Windows6.1-KB958830-x86-RefreshPkg.MSU using /quiet /norestart

(as a post install)

Then have a batch file that runs to install the components that you want.

dism /online /get-features to display the features that you need installed (on a machine that is already setup).

An example of using group policy management console is
dism /online /enable-feature /featurename:RemoteServerAdministrationTools /featurename:RemoteServerAdministrationTools-Features /featurename:RemoteServerAdministrationTools-Features-GP

Refer to the URL for additional options.

Be the first to comment

KACE: K2000 Windows 7 32bit Deployment

Start to deploy Windows 7 systems with K2000.

One question to ask:

License keys, currently, we do not have any volume licnese for Windows 7,and been told by our supplier that there is no such product.

Will follow up the license key settings before we can start to push the new Win7 systems with KACE.

 

View comments (3)

Windows 7 - UAC and Application Deployment using VB Script

One of the biggest challenges with Windows 7 is getting software installed with UAC enabled and the user is not an local administrator.  I found a VB script a few years ago that helped assist with just that. This VB Script is a very powerful asset in any IT organization.  I utilize it as a shell for all VB Scripts I write. I wish I could remember the original author(s) to give credit where credit is due.  I believe I stumbled upon it through Google Searches and several random forum boards.  Trying and experimenting with as many possible solutions as I could find.

'---------------------------------------------
'Run a VB Script after forcing a UAC challenge
'2/10/2012 Trinity Rolling
'-------------------------------------------- 
bElevate = False
if WScript.Arguments.Count > 0 Then If WScript.Arguments(WScript.Arguments.Count-1) <> "|" then bElevate = True
if bElevate Or WScript.Arguments.Count = 0 Then ElevateUAC
'--------------------------------------------
'Insert the script you want to run with elevated privledges below
'--------------------------------------------

' Check the operating system
Function IsWindows7
Set OSSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//" _
& "./root/cimv2").ExecQuery("select Caption from Win32_OperatingSystem")
For Each OS In OSSet
sOS = OS.Caption
Next
IsWindows7 = (InStr(1, sOS, "Windows 7", 1) + InStr(1, sOS, "Vista") > 0)
End Function
' Force a UAC challenge
Sub ElevateUAC
if not isWindows7 then Exit Sub
sParms = " |"
If WScript.Arguments.Count > 0 Then
For i = WScript.Arguments.Count-1 To 0 Step -1
sParms = " " & WScript.Arguments(i) & sParms
Next
End If
Set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "wscript.exe", WScript.ScriptFullName & sParms, , "runas", 1
WScript.Quit
End Sub

Below is an example of the script used to deploy Microsoft Lync 2010 to Field Agents at their convienence.  Field Agents are a challenge as they may require VPN, low bandwidth, and short attention spam.

'---------------------------------------------
'Run a VB Script after forcing a UAC challenge
'2/10/2012 Trinity Rolling
'--------------------------------------------
bElevate = False
if WScript.Arguments.Count > 0 Then If WScript.Arguments(WScript.Arguments.Count-1) <> "|" then bElevate = True
if bElevate Or WScript.Arguments.Count = 0 Then ElevateUAC

' Check for Software Title
'This script outputs to a .tsv file a list of applications installed on the computer
'Output file is software.tsv
'Usage: cscript applications.vbs

'----------------------------------------
softwareTitle = "Microsoft Lync 2010" 'Change the software title you are looking for here.
softwareVersion = "4.0.7577.0" 'Change the software version you are looking for here.
InstallScript = "C:\Updates\LyncInstall.cmd"
strTargetFolder = "C:\Updates\"
strSourceFolder = "\\FileShare\DeploymentShare\Applications\Lync\i386\"
strInstallFile1 = "LyncSetup.exe"
strInstallFile2 = "" 'Uncomment the lines below (100-103) if used.
strInstallFile3 = "" 'Uncomment the lines below (104-107) if used.
strInstallFolder1 = "" 'Uncomment the lines below (108-111) if used.

'----------------------------------------

'Begin Script Execution

Set objShell = CreateObject("WScript.Shell")
objShell.Popup "We are now checking for existing versions. This notification will disappear once we have finished checking for existing versions. Please wait... ", 60, softwareTitle, 64
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("C:\WINDOWS\Temp\software.tsv", True)

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product")

objTextFile.WriteLine "Caption" & vbtab & _
"Description" & vbtab & "Identifying Number" & vbtab & _
"Install Date" & vbtab & "Install Location" & vbtab & _
"Install State" & vbtab & "Name" & vbtab & _
"Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _
& "Version"

For Each objSoftware in colSoftware
objTextFile.WriteLine objSoftware.Caption & vbtab & _
objSoftware.Description & vbtab & _
objSoftware.IdentifyingNumber & vbtab & _
objSoftware.InstallDate2 & vbtab & _
objSoftware.InstallLocation & vbtab & _
objSoftware.InstallState & vbtab & _
objSoftware.Name & vbtab & _
objSoftware.PackageCache & vbtab & _
objSoftware.SKUNumber & vbtab & _
objSoftware.Vendor & vbtab & _
objSoftware.Version
Next


' This searches for a string of txt in a file

Dim FoundTitle 'as boolean
Dim FoundVersion 'as boolean
FoundTitle=false 'initialize it to false
FoundVersion=false 'initialize it to false
With createobject("Scripting.FileSystemObject")
on error resume next
FoundTitle = (InStr(1,.OpenTextFile("C:\WINDOWS\Temp\software.tsv",1,true,-2).ReadAll, softwareTitle,1) <> 0)
FoundVersion = (InStr(1,.OpenTextFile("C:\WINDOWS\Temp\software.tsv",1,true,-2).ReadAll, softwareVersion,1) <> 0)
on error goto 0
End With

'wscript.echo FoundIt

' If Software title is found run script
Const wshYes = 6
Const wshNo = 7
Const wshYesNoDialog = 4
Const wshQuestionMark = 32
Const wshWarningMark = 48
Const wshInformationMark = 64
Const FOF_CREATEPROGRESSDLG = &H0&

Set objShell = WScript.CreateObject("Wscript.Shell")
' If Software title is found
If FoundTitle and FoundVersion Then
objShell.Popup softwareVersion & " is already installed. No further action is needed on your part. Thank you", _
-1, softwareTitle, wshInformationMark
Else
' Begin File Copy
Set objShellApp = CreateObject("Shell.Application")
Set objFolder = objShellApp.NameSpace(strTargetFolder)
'---------------------------------------------------------------------------
If objFSO.fileExists(strTargetFolder + strInstallFile1) Then
Else
objFolder.CopyHere strSourceFolder + strInstallFile1, FOF_CREATEPROGRESSDLG 'Change the install file(s) location as needed.
End If
REM If objFSO.fileExists(strTargetFolder + strInstallFile2) Then 'Remove/Comment out if not used
REM Else
REM objFolder.CopyHere strSourceFolder + strInstallFile2, FOF_CREATEPROGRESSDLG
REM End If
REM If objFSO.fileExists(strTargetFolder + strInstallFile3) Then 'Remove/Comment out if not used
REM Else
REM objFolder.CopyHere strSourceFolder + strInstallFile3, FOF_CREATEPROGRESSDLG
REM End If
REM If objFSO.folderExists(strTargetFolder + strInstallFolder1) Then 'Remove/Comment out if not used
REM Else
REM objFolder.CopyHere strSourceFolder + strInstallFolder1, FOF_CREATEPROGRESSDLG
REM End If
'---------------------------------------------------------------------------
' Begin Install
intReturn = objShell.Popup("Do you want to begin the install of " & softwareTitle & " now?", _
-1, softwareTitle, wshYesNoDialog + wshQuestionMark)
If intReturn = wshYes Then
'---------------------------------------------------------------------------
objShell.Run(InstallScript), 0, True 'Change the install script location as needed.
'---------------------------------------------------------------------------
intReboot = objShell.Popup("Install Complete! Would you like to reboot now?", -1, "Reboot Required", wshYesNoDialog + wshQuestionMark)
If intReboot = wshYes Then
objShell.Run ("C:\WINDOWS\system32\shutdown.exe -r -t 0")
ElseIf intReboot = wshNo Then
Wscript.Echo "Please reboot as soon as possible."
Else intForcedReboot = objShell.Popup("Your computer will reboot now.", 10, "Warning", wshWarningMark)
objShell.Run ("C:\WINDOWS\system32\shutdown.exe -r -t 0")
End If
ElseIf intReturn = wshNo Then
Wscript.Echo "Please run the update process as soon as possible. You will not be able to utilize the many features of Lync until you do so."
Else
'---------------------------------------------------------------------------
objShell.Run(InstallScript), 0, True 'Change the install script location as needed.
'---------------------------------------------------------------------------
objShell.Popup softwareTitle & " is complete!", _
-1, "Install complete", wshInformationMark
End If

' End If for software Title = false and install
End If

objTextFile.Close

' Check the operating system
Function IsWindows7
Set OSSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//" _
& "./root/cimv2").ExecQuery("select Caption from Win32_OperatingSystem")
For Each OS In OSSet
sOS = OS.Caption
Next
IsWindows7 = (InStr(1, sOS, "Windows 7", 1) + InStr(1, sOS, "Vista") > 0)
End Function

' Force a UAC challenge
Sub ElevateUAC
if not isWindows7 then Exit Sub
sParms = " |"
If WScript.Arguments.Count > 0 Then
For i = WScript.Arguments.Count-1 To 0 Step -1
sParms = " " & WScript.Arguments(i) & sParms
Next
End If
Set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "wscript.exe", WScript.ScriptFullName & sParms, , "runas", 1
WScript.Quit
End Sub

View comments (2)

Check for elevated admin rights in batch file

Just a few lines of code in a batch file will check if the batch file is executed with full administrator rights. This is great in eg. Win7 enviroments and when used with superusers who tends to forget :)

 

@ECHO OFF

::Admin check
AT > NUL
IF %ERRORLEVEL% EQU 0 (
    GOTO execute
) ELSE (
    ECHO Script must run as admin, exiting...
    Pause
    EXIT /B 1
)

::Script below

:execute

View comments (5)
Showing 1 - 5 of 58 results

Top Contributors

Talk About Admin Script Editor