wiki:windows/configuration
Last modified 4 years ago Last modified on 11/04/13 10:27:00

Windows Configuration

Remarks about how to configure Windows, mainly from generating OPSI packages.

Silent Installation

Overview about the different installers:

Silent Uninstall

Native:

[HKLM\SOFTWARE\Microsoft\windows\CurrentVersion\Uninstall\]

32bit Programs on 64bit Systems:

[HKLM\SOFTWARE\Wow6432node\Microsoft\windows\CurrentVersion\Uninstall\]

Silent Uninstall using wmi

C:\>wmic
wmic:root\cli>product get name,version
Name                                                            Version
WebFldrs XP                                                     9.50.7523
Java(TM) 6 Update 20                                            6.0.200
TeamViewer 6 (MSI Wrapper)                                      6.0.11052
...

wmic:root\cli>product where name="WebFldrs XP"
Caption      Description  IdentifyingNumber                       InstallDate  InstallDate2               InstallLocation  InstallState  Name         PackageCache                    SKUNumber  Vendor                 Version
WebFldrs XP  WebFldrs XP  {350C97B3-3D7C-4EE8-BAA9-00BCB3D54227}  20110906     20110906000000.000000-000                   5             WebFldrs XP  C:\WINDOWS\Installer\2e182.msi             Microsoft Corporation  9.50.7523

wmic:root\cli>product where name="WebFldrs XP" call uninstall /nointeractive

Crash Handler

control the behaviour on bluescreens:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl]

Hardware Information

wmi / wmic

Prodcut Name (computer type)

# get computer system product information
wmic csproduct get

# get computer system product name, eg. Latitude D420
wmic csproduct get name /format:value

From OPSI:

[Actions]
DefStringList $ResultList$
DefVar $HardwareSystemType$
set $ResultList$ = getOutStreamFromSection('DosInAnIcon_get_hardware_system_type')
set $HardwareSystemType$ = trim( getValue( "Name", $ResultList$ ) )

[DosInAnIcon_get_hardware_system_type]
wmic csproduct get name /format:value

Computer Type (chassis type)

returns number of chassis type:

wmic systemenclosure get chassistypes

Values meaning:

;1 Other 
;2 Unknown 
;3 Desktop 
;4 Low Profile Desktop 
;5 Pizza Box  
;6 Mini Tower 
;7 Tower 
;8 Portable 
;9 Laptop 
;10 Notebook 
;11 Hand Held 
;12 Docking Station 
;13 All in One 
;14 Sub Notebook 
;15 Space-Saving 
;16 Lunch Box  
;17 Main System Chassis 
;18 Expansion Chassis 
;19 SubChassis 
;20 Bus Expansion Chassis 
;21 Peripheral Chassis 
;22 Storage Chassis 
;23 Rack Mount Chassis 
;24 Sealed-Case PC 

Laptop or Desktop?

If ChassisType==8 || ChassisType==9 || ChassisType==10 
	Message(ChassisType,"Is a Laptop")
Else
	Message(ChassisType,"Is not a Laptop")
EndIf

Another approach is to check if computer has a battery or not:

wmic path win32_battery  get
wmic path win32_battery  get Description

systeminfo

systeminfo /?

Windows Components

install/deinstall

sysocmgr

see http://sg.answers.yahoo.com/question/index?qid=20100227043015AAWP57Y

Windows >= 7

Screensaver

user specific

wmic desktop

Powersettings

Registry

Windows 7

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\

esp.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes

Windows XP

to change power settings, the user must have the write permission for the following registry subkeys:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg
    HKEY_ USERS\.DEFAULT\Control Panel\PowerCfg

see http://xpregistry.uw.hu/xpr0035.html

powercfg

powercfg
  • only user specifc
  • not all settings can be configured

see http://technet.microsoft.com/en-us/library/cc748940%28WS.10%29.aspx

Options differ between Windows XP and Windows 7.

executing program on remote system

wmic /node:"%1" /user:bob.carroll process call create "cmd.exe /c whatever.exe"

Standard components

Tools

rsync, ssh

includes a rsync and ssh for Windows (and the DeltaCopy frontend/server) . These tools are based on Cygwin. These tools doesn't need installation. fter settings the path variable to the DeltaCopy directory, these tools are usesable.

Registry

Structure

What are Control Sets? What is CurrentControlSet?

use CurrentControlSet, see http://support.microsoft.com/kb/100010

Tools

regdiff

# compare 2 registry files and generate a new file which only contains the differences
regdiff  file1.reg file2.reg -4 -d diff.reg

Attention: does diff.reg contain what is set in file2 or in file1? I expect file2, but had the content of file1 once. CHECK THIS.

see http://p-nand-q.com/download/regdiff.html

regmon

Infos

Detect Windows Version

  • Registry:
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
      • CurrentBuild
      • CurrentVersion
      • EditionID
      • ProductName
      • ...

Batch

Services

  • show all running services
    • net start

Service Control (sc)

# detailed information about all services
sc query

# start service
sc start <service_name>

# activate service permanently (set start type)
# space before start parameter is required!
sc config <service_name> start= auto

Cmd-Tools

siehe http://www.kellys-korner-xp.com/win_xp_logfiles.htm

  • openfiles: lists open files
    • openfiles /local on
    • openfiles /query /v
  • tasklist
  • taskkill
  • mountvol
    • add or remove drives/partitions

Detect 32-/64-bit

Process Monitor