Wednesday, March 30, 2011

How to configure event subscription to pull BMC SEL events into the event logs in Windows Server 2008

In Windows Server 2008, Hardware Management is built into the operating system. By default, Hardware Management event subscription is not configured to subscribe to BMC SEL events. Instead of using a third-party program to view SEL events, you can configure Hardware Management to subscribe to SEL events. You can then view BMC SEL events in Event Viewer. To subscribe to SEL events, follow these steps:
  1. Start Notepad.
  2. Copy the following XML code, and then paste it into Notepad.

    
     System Event Log event subscription
     SELSubscription
     http://schemas.microsoft.com/wbem/wsman/1/logrecord/sel
     
      
       
    localhost
    HardwareEvents
  3. In Notepad, click Save as.
  4. In the Save as type box, click All files in the File name box, type SELSubscription.xml, and then click Save.
  5. Exit Notepad.
  6. Use elevated user rights to open a command prompt.
  7. At the command prompt, type the following commands, and then press ENTER after each command:
    Wecutil qc
    Winrm qc
    Winrm set winrm/config/client @{TrustedHosts=”localhost”}
    Wecutil cs path\SELSubscription.xml
    Note path represents the directory path of the SELSubscription.xml file that you saved in step 4.
After you complete the subscription, events from the SEL logs should populate the event log in Windows. You can view the events in Event Viewer under the following node:
Applications and Services\Hardware events

How to determine whether a computer's BIOS supports BMC detection

For SEL events to be logged, the computer's BIOS must support using the Advanced Configuration and Power Interface (ACPI) for BMC detection. After you configure event subscription, you may see the following errors in the subscription status. These errors may occur if the computer does not have a BMC or if the BIOS does not support using ACPI for BMC detection.
[localhost] - Error - Last retry time: 5/22/2007 1:39:32 PM. Code (0x80041001):
 Next retry time: 5/22/2007 1:44:32 PM.
To view the subscription status, follow these steps:
  1. Use elevated user rights to open a command prompt.
  2. Type eventvwr, and then press ENTER.
  3. In the navigation pane, click Subscription. The details pane displays the SELSubscription entry.
  4. Right-click SELSubscription, and then click Runtime Status.
To verify that a computer's BIOS supports using ACPI for BMC detection, you can use the Windows Management Instrumentation (WMI) Tester tool. To do this, follow these steps:
  1. Use elevated user rights to open a command prompt.
  2. Type wbemtest.exe, and then press ENTER.
  3. Click Connect.
  4. To connect to the WMI namespace, type root\wmi in the uppermost box, and then click Connect.
  5. Under IWbemServices, click Enum Instances.
  6. In the Enter Superclass Name box, type Microsoft_IPMI, and then click OK.
  7. In the Query Result dialog box, you should see an instance of a device ID that begins with the ACPI entry.
If there is no entry that begins with "ACPI," the BIOS does not support using ACPI for BMC detection. BIOS support for using ACPI for BMC detection is required for Intelligent Platform Management Interface (IPMI) drivers in Windows Server 2008 and in later versions of Windows Server. You must upgrade the BIOS if you want IPMI support.

Monday, March 28, 2011

How do I configure the default keyboard layout during login?


You can change the keyboard layout using the keyboard control panel applet (start - settings - control panel - keyboard - Input Locales) however this does not affect the layout used during logon (which is by default English (United States)). To change this perform the following:
  1. Start the registry editor  (regedit.exe)
  2. Move to HKEY_USERS\.DEFAULT\Keyboard Layout\Preload
  3. Double click on 1 and change the number to your local layout (you could get this by looking at HKEY_CURRENT_USER\Keyboard Layout\Preload1). Click OK
  4. You may also change HKEY_USERS\.DEFAULT\Control Panel\International\Locale to this value however it is not mandatory to do so.
  5. Close the registry editor
  6. Logoff and then on again
Make sure you select a country code that has been installed via the control panel or your system will not boot.
A table of the codes to the countries is given below:
00000402Bulgarian
0000041aCroatian
00000405Czech
00000406Danish
00000413Dutch (Standard)
00000813Dutch (Belgian)
00000409English (United States)
00000809English (United Kingdom)
00001009English (Canadian)
00001409English (New Zealand)
00000c09English (Australian)
0000040bFinnish
0000040cFrench (Standard)
0000080cFrench (Belgian)
0000100cFrench (Swiss)
00000c0cFrench (Canadian)
00000407German (Standard)
00000807German (Swiss)
00000c07German (Austrian)
00000408Greek
0000040eHungarian
0000040fIcelandic
00001809English (Irish)
00000410Italian (Standard)
00000810Italian (Swiss)
00000414Norwegian (Bokmal)
00000814Norwegian (Nynorsk)
00000415Polish
00000816Portuguese (Standard)
00000416Portuguese (Brazilian)
00000418Romanian
00000419Russian
0000041bSlovak
00000424Slovenian
0000080aSpanish (Mexican)
0000040aSpanish (Traditional Sort)
00000c0aSpanish (Modern Sort)
0000041dSwedish
0000041fTurkish
These can also be seen in the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout\DosKeybCodes

Wednesday, March 23, 2011

Quick Reference for Server Core Installations (R2 edition)


Configuration and installation

 

Task Steps
Set the local administrative password At a command prompt, type:
net user administrator *
Join a computer to a domain
  1. At a command prompt, type on one line:

    netdom join %computername% /domain: /userd:\username> /passwordd:*

  2. Restart the computer.
Confirm that the domain has changed At a command prompt, type:
set
Remove a computer from a domain At a command prompt, type:
netdom remove
Add a user to the local Administrators group. At a command prompt, type:
net localgroup Administrators /add \
Remove a user from the local Administrators group At a command prompt, type:
net localgroup Administrators /delete
Add a user to the local computer At a command prompt, type:
net user /add *
Add a group to the local computer At a command prompt, type:
net localgroup /add
Change the name of a domain-joined computer At a command prompt, type:
netdom renamecomputer %computername% /NewName: /userd: /passwordd:*
Confirm the new computer name At a command prompt, type:
set
Change the name of a computer in a work group
  1. At a command prompt, type:

    netdom renamecomputer /NewName:

  2. Restart the computer.
Disable paging file management At a command prompt, type:
wmic computersystem where name="" set AutomaticManagedPagefile=False
Configure the paging file At a command prompt, type:
wmic pagefileset where name=”” set InitialSize=,MaximumSize=
Where:
path/filename is the path to and name of the paging file
initialsize is the starting size of the paging file in bytes.
maxsize is the maximum size of the page file in bytes.
Change to a static IP address.
  1. At a command prompt, type:

    ipconfig /all

  2. Record the relevant information or redirect it to a text file (ipconfig /all >ipconfig.txt).

  3. At a command prompt, type:

    netsh interface ipv4 show interfaces

  4. Verify that there is an interface list.

  5. At a command prompt, type:

    netsh interface ipv4 set address name source=static address= gateway=

  6. Verify by typing ipconfig /all at a command prompt and checking that DHCP enabled is set to No.
Set a static DNS address.
  1. At a command prompt, type:

    netsh interface ipv4 add dnsserver name= address= index=1

  2. At a command prompt, type:

    netsh interface ipv4 add dnsserver name= address= index=2

  3. Repeat as appropriate to add additional servers.

  4. Verify by typing ipconfig /all and checking that all the addresses are correct.
Change to a DHCP-provided IP address from a static IP address.
  1. At a command prompt, type:

    netsh interface ipv4 set address name= source=DHCP

  2. Verify by typing Ipconfig /all and checking that DCHP enabled is set to Yes.
Enter a product key At a command prompt, type:
slmgr.vbs –ipk
Activate the server locally. At a command prompt, type:
slmgr.vbs -ato
Activate the server remotely.
  1. At a command prompt, type:

    cscript slmgr.vbs –ipk

  2. At a command prompt, type:

    cscript slmgr.vbs -ato

  3. Retrieve the GUID of the computer by typing cscript slmgr.vbs -did

  4. Type cscript slmgr.vbs -dli

  5. Verify that License status is set to Licensed (activated).

Networking and firewall

 

Task Steps
Configure your server to use a proxy server. At a command prompt, type:
netsh Winhttp set proxy :
noteNote
Server Core installations cannot access the Internet through a proxy that requires a password to allow connections.
Configure your server to bypass the proxy for internet addresses. At a command prompt, type:
netsh winttp set proxy :bypass-list=""
Display or modify IPSEC configuration. At a command prompt, type:
netsh ipsec
Display or modify NAP configuration. At a command prompt, type:
netsh nap
Display or modify IP to physical address translation. At a command prompt, type:
arp
Display or configure the local routing table. At a command prompt, type:
route
View or configure DNS server settings. At a command prompt, type:
nslookup
Display protocol statistics and current TCP/IP network connections. At a command prompt, type:
netstat
Display protocol statistics and current TCP/IP connections using NetBIOS over TCP/IP (NBT). At a command prompt, type:
nbtstat
Display hops for network connections. At a command prompt, type:
pathping
Trace hops for network connections. At a command prompt, type:
tracert
Display the configuration of the multicast router. At a command prompt, type:
mrinfo
Enable remote administration of the firewall. At a command prompt, type:
netsh advfirewall firewall set rule group=”Windows Firewall Remote Management” new enable=yes

Updates, error reporting, and feedback

 

Task Steps
Install an update. At a command prompt, type:
wusa .msu /quiet
List installed updates At a command prompt, type:
systeminfo
Remove an update.
  1. Type at a command prompt:

    expand /f:* .msu c:\test

  2. Navigate to c:\test\ and open .xml in a text editor.

  3. In .xml, replace Install with Remove and save the file.

  4. At a command prompt, type:

    pkgmgr /n:.xml
Configure automatic updates. At a command prompt:
  • To verify the current setting, type:

    cscript scregedit.wsf /AU /v

  • To enable automatic updates, type:

    cscript scregedit.wsf /AU 4

  • To disable automatic updates, type:

    cscript scregedit.wsf /AU 1
Enable error reporting. At a command prompt:
  • To verify the current setting, type: serverWerOptin /query

  • To automatically send detailed reports, type:

    serverWerOptin /detailed

  • To automatically send summary reports, type:

    serverWerOptin /summary

  • To disable error reporting, type: serverWerOptin /disable
Participate in the Customer Experience Improvement Program (CEIP). At a command prompt:
  • To verify the current setting, type:

    serverCEIPOptin /query

  • To enable CEIP, type:

    serverCEIPOptin /enable

  • To disable CEIP, type:

    serverCEIPOptin /disable

Services, processes, and performance

 

Task Steps
List the running services. At a command prompt, type either of the following:
  • sc query

  • net start
Start a service. At a command prompt, type either of the following:
  • sc start

  • net start
Stop a service. At a command prompt, type either of the following:
  • sc stop

  • net stop
Retrieve a list of running applications and associated processes. At a command prompt, type:
tasklist
Stop a process forcibly.
  1. Use the tasklist command to retrieve the process ID (PID).

  2. At a command prompt, type:

    taskkill /PID
Start Task Manager. At a command prompt, type:
taskmgr
Manage the performance counters and logging with commands such as typeperf, logman, relog, tracerprt. See http://go.microsoft.com/fwlink/?LinkId=84872.

Event logs

 

Task Steps
List event logs. At a command prompt, type:
wevtutil el
Query events in a specified log. At a command prompt, type:
wevtutil qe /f:text
Export an event log. At a command prompt, type:
wevtutil epl
Clear an event log. At a command prompt, type:
wevtutil cl

Disk and file system

 

Task Steps
Manage disk partitions. For a complete list of commands, at a command prompt, type:
diskpart /?
Manage software RAID. For a complete list of commands, at a command prompt, type:
diskraid /?
Manage volume mount points. For a complete list of commands, at a command prompt, type:
mountvol /?
Defragment a volume. For a complete list of commands, at a command prompt, type:
defrag /?
Convert a volume to the NTFS file system. At a command prompt, type:
convert /FS:NTFS
Compact a file. For a complete list of commands, at a command prompt, type:
compact /?
Administer open files. For a complete list of commands, at a command prompt, type:
openfiles /?
Administer VSS folders. For a complete list of commands, at a command prompt, type:
vssadmin /?
Administer the file system. For a complete list of commands, at a command prompt, type:
fsutil /?
Verify a file signature. At a command prompt, type:
sigverif /?
Take ownership of a file or folder. For a complete list of commands, at a command prompt, type:
icacls /?

Hardware

 

Task Steps
Add a driver for a new hardware device.
  1. Copy the driver to a folder at %homedrive%\.

  2. At a command prompt, type:

    pnputil -i -a %homedrive%\\.inf
Remove a driver for a hardware device.
  1. For a list of loaded drivers, at a command prompt, type:

    sc query type= driver

  2. At the command prompt, type:

    sc delete

Tuesday, March 22, 2011

Show the Classic “All Programs” Menu in the Start Menu in Windows 7


There are a lot of new users to Windows 7 who are not happy with the new Start Menu and wish they could revert to the Classic menu. Here is how to at least get back the Classic “All Programs” Menu.
Remember the Classic Start Menu in XP where you could show the All Programs Menu? Let’s take a look at getting that back in Windows 7.
sshot-2010-07-12-[22-16-17]
Note: This trick uses a Registry hack so you’ll want to make sure you back up the Registrybefore making any changes.
Get All Programs Menu Back
First click on the Start Menu and type regedit into the Search box and hit Enter.
regedit_Start
Now we need to navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders. Double-click on Favorites on the right side…
sshot-2010-07-12-[20-57-40]
Now change the Value data to the following and click OK:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs
sshot-2010-07-12-[21-01-10]
Next scroll down a bit further to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders. Double-click on the Favorites entry.
sshot-2010-07-12-[21-02-25]
Again we need to edit the Value data to:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs
sshot-2010-07-12-[21-04-01]
After making the changes close out of the Registry Editor and right-click on the Start Menu and select Properties.
sshot-2010-07-12-[21-07-14]
In the Taskbar and Start Menu Properties Window click on the Start Menu tab then click on the Customize button.
sshot-2010-07-12-[21-08-42]
Scroll down and click the box next to Favorites menu, click OK, and reboot your system.
sshot-2010-07-12-[21-09-10]
When you come back from the Restart you will see Programs on the right side of the Start Menu and have a list of All Programs similar to that of XP.
sshot-2010-07-12-[23-15-17]
While it’s not quite the same as the good old XP days, if you’re looking to get the All Programs Menu back, this Registry hack will do the trick without installing 3rd party software.
If you’re not comfortable making changes to the Registry, check out some 3rd party solutions which we have covered…

Thursday, March 10, 2011

Sum/Count Cells By Fill Or Background Color in Excel


First open the Workbook in which you wish to count or sum cells by a fill color. Now go into the Visual Basic Editor via Tools>Macro>Visual Basic Editor (Alt+F11)and then, from within the Visual Basic Editor go  to Insert>Module to insert a standard module. Now, in this module, enter in the code as shown below;
Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)

 Dim rCell As Range

 Dim lCol As Long

 Dim vResult



''''''''''''''''''''''''''''''''''''''

'Written by Ozgrid Business Applications

'www.ozgrid.com



'Sums or counts cells based on a specified fill color.

'''''''''''''''''''''''''''''''''''''''

  

 lCol = rColor.Interior.ColorIndex



 If SUM = True Then

  For Each rCell In rRange

   If rCell.Interior.ColorIndex = lCol Then

    vResult = WorksheetFunction.SUM(rCell,vResult)

   End If

  Next rCell

 Else

  For Each rCell In rRange

   If rCell.Interior.ColorIndex = lCol Then

    vResult = 1 + vResult

   End If

  Next rCell

 End If



   ColorFunction = vResult

End Function

You can now use the custom function (ColorFunction) like;
=ColorFunction($C$1,$A$1:$A$12,TRUE) to SUM the values in range of cells $A$1:$A$12 that have the same fill color as cell $C$1. The reason it will SUM in this example is because we have used TRUE as the last argument for the custom function.
To COUNT these cells that have the same fill color as cell $C$1 you could use:
=ColorFunction($C$1,$A$1:$A$12,FALSE) or =ColorFunction($C$1,$A$1:$A$12) by omitting the last argument our function will automatically default to using FALSE.
Be aware that the changing of a cells fill color will not cause the Custom Function to recalculate, even if you press F9 (Recalculates the whole Workbook). You will need to either, select the cell and re-enter the formula, or go to Edit>Replace and replace = with =, or use Ctrl+Alt+F9