Tuesday, March 4, 2008

Manage Windows Server 2008 or Windows Vista remotely using WMI

WMI is a core Windows management technology that administrators can use to write scripts to perform administrative tasks on both local and remote computers. There are no specific enhancements to WMI in Windows Server 2008 beyond those included in Windows Vista, but it's important to know about the Windows Vista enhancements since these apply to Windows Server 2008 also. Here are a few of the more significant changes to WMI in Windows Vista and Windows Server 2008:

· Improved tracing and logging: The WMI service now uses Event Tracing for Windows (ETW) instead of the legacy WMI log files used on previous Windows platforms, and this makes WMI events available through Event Viewer or by using the Wevtutil.exe command-line tool.

· Enhanced WMI namespace security: The NamespaceSecuritySDDL qualifier can now be used to secure any namespace by setting WMI namespace security in the Managed Object Format (MOF) file.

· WMI namespace security auditing: WMI now uses the namespaces system access control lists (SACL) to audit namespace activity and report events to the Security event log.

· Get and Set security descriptor methods for securable objects: New scriptable methods to get and set security descriptors have been added to Win32_Printer, Win32_Service, StdRegProv, Win32_DCOMApplicationSetting, and _SystemSecurity.

· Manipulate security descriptors using scripts: The Win32_SecurityDescriptorHelper class now has methods that allow scripts to convert binary security descriptors on securable objects into Win32_SecurityDescriptor objects or Security Descriptor Definition Language (SDDL) strings.

· User Account Control: (UAC) affects what WMI data is returned, how WMI is remotely accessed, and how scripts must be run.

What all this basically means is that WMI is more secure and more consistent in how it works in Windows Server 2008, which is good news for administrators who like to write WMI scripts to manage various aspects of their Windows-based networks. Still writing WMI scripts isn't always easy, especially if you're trying to get them to run properly against remote machines. Windows Vista and Windows Server 2008 complicate things in this regard because of their numerous security improvements, including User Account Control (UAC). So it's instructive to listen to one of the experts at Microsoft, who will address this very issue in detail.

From the Experts: WMI Remote Connection

Before looking at the UAC aspects, let step back and look at the requirements to call WMI remotely. This applies to any Windows platform since Windows 2000. We will examine the Windows Vista and Windows Server 2008 aspects next.

To connect remotely, four conditions must be met:

1. Firewall Introduced with Windows XP, the Windows Firewall must be properly set up to enable connectivity for the WMI RPC traffic. Usually, you get an "RPC connection failure" if the Windows Firewall is enabled and RPC is disallowed. If you get an "access denied" message, the firewall is not the root cause of the issue. Keep in mind that the firewall is the key component to go through before anything else happens. Before Windows Vista and Windows Server 2008, RPC traffic must be enabled to allow the WMI traffic to go through. With Windows Vista and Windows Server 2008, a dedicated set of Firewall WMI rules is available to enable only WMI traffic. (This can be done with the FW.MSC MMC snap-in, Group Policies, Scripting, or NETSH.EXE.) Note that if you use WMIDiag (available on Microsoft Download Center), it will tell you which NETSH.EXE command to use to configure your firewall properly.

2. DCOM Once the firewall gate is passed, it is time to consider the DCOM security. The user issuing the remote call must have the right to "Launch and Activate" (which can be viewed and changed with DCOMCNFG.EXE) for both the My Computer and Windows Management and Instrumentation objects. By default, only users who are part of the Administrators group of the remote machine have the right to remotely "Launch and Activate" these DCOM objects.

3. WMI namespace Once the DCOM security is verified, WMI namespace security comes next. In this case, the user connecting to a remote WMI namespace must have at the minimum the Enable Remote and Enable Account rights granted for the given namespace. By default, only users who are part of the Administrators group of the remote machine have the Enable Remote right granted. (This can be updated with WMIMGMT.MSC.)

4. Manageable entity Last but not least, once WMI has accepted the remote request, it is actually executed against the manageable entity (which could be a Windows Service or a Terminal Server configuration setting, for instance). This last step must also succeed for the WMI operation to succeed. WMI does not add any privilege that the user does not have when issuing the WMI request. (By default, WMI impersonates the calls, which means it issues the call within the security context of the remote user.) So, depending on the WMI operation requested and the rights granted to the remote user, the call might succeed or fail at the level of the manageable entity. For instance, if you try to stop a Windows service remotely, the Service Control Manager requires the user to be an Administrator by default. If you are not, the WMI request performing this operation will fail.

This describes the behavior of WMI since Windows 2000. In the light of Windows Vista and Windows Server 2008, things can be slightly different because UAC is enabled by default on both platforms and everything depends on whether you use a local account or a domain account. If you use a local user of the remote machine who is a member of the Local Administrators group, the Administrators membership of the user is always filtered. In this context, DCOM, WMI, and the manageable entity are applying the security restrictions with respect to the filtered token presented. Therefore, with respect to the UAC behavior, the token is a user token, not an administrative token! As a consequence, the Local User is actually acting as a plain user on that remote machine even if it is part of the Local Administrators group. By default, a user does not have the rights to pass the security gates defined earlier (in step 2, 3, and 4).

Now that the scene is set, how do you manage a remote Windows Vista machine or 2008 server while respecting the Firewall, UAC, DCOM, WMI, and manageable entity security enforcements?

This challenge must be looked at in two different ways:

1. The remote machine is part of a domain: If the remote machine is part of a domain, it is highly recommended that you use a Domain User part of the Local Administrators group of the remote machine (and not a Local User part of the Local Administrators group). By doing so, you will be a plain Administrator because UAC does not filter users out of the Local Administrators group when the user is a Domain User. UAC only filters Local Users out of the Local Administrators group.

2. Your machine is a workgroup machine: If your machine is in a workgroup environment, you are forced to use a Local User part of the Local Administrators group to connect remotely. Obviously, because of the UAC behavior, that user is filtered and acts as a plain user. The first approach if you are in a large enterprise infrastructure is to consider the possibility of making this machine part of a domain to use a Domain User. If this is not possible because you must keep the machine as part of a workgroup, from this point you have two choices:

o You decide to keep UAC active. In this case, you must adjust the security settings of DCOM and WMI to ensure that the Local User has the explicit rights to get remote access. Don't forget that a best practice is to use a dedicated Local Group and make this Local User a member of that group. In this context, the WMI requests against the manageable entity might work or not depending on the manageable entity security requirements (discussed in step 3). If the manageable entity does not allow a plain user to perform the task requested, you might be forced to change the security at the manageable entity level to explicitly grant permissions to your Local User or Group as well. Note that this is not always possible because it heavily depends on the manageable entity security requirements and security management capabilities of the manageable entity. For the Windows Services example, this can be done with the SC.EXE command via an SDDL string, the Win32_Service WMI class (with the Get/SetSecurityDescriptor methods implemented in Windows Vista and Windows Server 2008), or Group Policies (GPEDIT.MSC). By updating the security at these three levels, you will be able to gracefully pass the DCOM and WMI security gates and stop a Windows Service as a plain user. Note that this customization represents clearly the steps for a granular delegation of the management. Only the service you changed the security for can be stopped by that dedicated user (or group). In this case, you actually define a very granular security model for a specific task. (You can watch the "Running Scripts Securely While Handling Passwords and Security Contexts Properly" webcast at http://go.microsoft.com/fwlink/?LinkId=39643 to understand this scenario better.) Now it is possible that some manageable entities only require the user to be an Admin (typical for most devices) because there is no possibility to update the security descriptor. In such a case, for a workgroup scenario, only the second option (discussed next) becomes possible. Last but not least, keep in mind that these steps are also applicable in a domain environment to delegate some management capabilities to a group of domain users.

o You decide to disable the UAC filtering for remote access. This must be the last-resort solution. It is not an option you should consider right away if you want to maintain your workgroup system with a high level of security. So consider it only after investigating the possibility of making your system part of a domain or after reviewing the security wherever needed. If making your system part of a domain is not possible, you can consider this option. In this case, you must set the registry key in the reference shown below to ZERO on the remote system. Note that you must be an administrator to change that registry key. So you need to do this locally once, before any remote access is made. Note that this configuration setting disables the filtering on Local Accounts only; it does not disable UAC as a whole.

[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]"Local AccountTokenFilterPolicy"=dword:00000001




Once set, the registry key is created and set to ONE, and the Local User remotely accessing the machine will be an administrator (if the user is a member of the Local Administrators group).Therefore, by default, the user will pass the security gates defined in steps 2, 3, and 4. Note that it is required to reboot the machine to get this change activated.



-------------- End of Document -----------------



Tags: Windows Vista, Windows Server 2008



Published Date: 20080304

Friday, December 7, 2007

Auto lock the system after Autologon and send notification.

The steps outlined below would help you with three things:

  1. Autologon to a system with a particular account
  2. Send a notification mail when that account is logged in to the system after a reboot
  3. Lock the system automatically once the account has been logged on

Step 1 - Enable Autologon:

  1. Go to Start > Run and put "regedit.exe" and click "Ok"
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon in Registry Editor
  3. Change the REG_SZ "DefaultUserName" value to the username you want to autologon to the system
  4. Change the REG_SZ "DefaultPassword" value to the password of the user you want to autologon to the system. (If the key does not exist then do create it)
  5. Change the REG_SZ "DefaultdomainName" value to the domain name you wish to logon to (If the key does not exist then do create it)
  6. Add a new REG_SZ "AutoAdminLogon" and set the value to 1
  7. Close Registry editor

Step 2 - Prepare notification files:

  1. Create a directory C:\Autologon;
  2. Create the files chkLogtime.vbs, Locksystem.cmd and Delchklog.cmd with the contents mentioned in Annexure I below

Step 3 - Setup up notification and autolock:

  1. Go to Start > Run and put "regedit.exe" and click "Ok"
  2. Navigate to HKEY_USERS\<SID of particular user>\software\Microsoft\Windows\CurrentVersion\Run in Registry Editor
  3. Add a new REG_SZ "ChkLogtime" and set the value to C:\Autologon\ChkLogtime.vbs
  4. Add a new REG_SZ "LockSystem" and set the value to C:\Autologon\Locksystem.cmd

Step 4 - Enable notification:

  1. Open Group Policy Object Editor
  2. Navigate to Local Computer Policy\Computer Configuration\Windows Settings\Scripts\ (Startup/shutdown)
  3. Double click on Shutdown in the right hand pane
  4. Click Add and Browse to the file C:\Autologon\Delchklog.cmd
  5. Click OK twice and close Group Policy Object Editor

NOTES:

  1. The Autologon would not work if the LegalNotice warning window is enabled at the domain level. You might have to do additional configuration to disable this.
  2. Automatic reboots will not work unless you specify ‘/F’ switch in your reboot script.

Annexure I


ChkLogTime.vbs

Dim WShell,SrvName
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
Set WShell = WScript.CreateObject("WScript.Shell")
If objFSO.FileExists("C:\Autologon\ChkLogTimeskip.txt") Then
wscript.Quit
Else
Set objFile = objFSO.CreateTextFile("C:\Autologon\ChkLogTimeskip.txt")
SrvName = Trim(WShell.ExpandEnvironmentStrings("%COMPUTERNAME%"))
User=Trim(WShell.ExpandEnvironmentStrings("%USERNAME%"))
LogTime= User &" is successfully logged onto " & SrvName &" after scheduled reboot at "& Now
objFile.writeline LogTime
objfile.close
Call SendMailAlerts(LogTime, User, SrvName)
End IF
Wscript.Quit
#################### Send Email Alerts ########################
Function SendMailAlerts(LogTime, User, SrvName)
RecipientList ="mukulag@gmail.com"
smtpsrv = "smtp.mukulag.com"
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "MyServer@mukulag.com"
objEmail.To = RecipientList
objEmail.Subject = User & " has logged on succesfully to " & SrvName " at "  & Now
objEmail.TextBody = LogTime
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpsrv
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
End Function
'##################### End Send Email Alerts ###########################

Locksystem.cmd

rundll32.exe user32.dll, LockWorkStation

DelChkLog.cmd

Del C:\Autologon\ChkLogTimeskip.txt /F

-------------- End of Document -----------------

Tags: Windows Server 2003

Published Date: 20071207

Monday, November 19, 2007

Important and basic Windbg commands

!analyze –v :analyzes the dump file and provides a best possible diagnosis of the same

!sympath :shows path to your symbol files

lm :lists all loaded modules in memory

lmf :list loaded modules with full path

lmt :list loaded modules with last modified timestamp

!lmi <module name> :Shows header information about the module, including the date and time, which can often tell you whether you're running an older version of a program and need to upgrade

vertarget :Shows information about the system on which you are debugging

!peb :Shows the PEB (process environment block) including DLL information

.trap :Dump a trap frame

.chain :Lists all loaded debugger extensions

-------------- End of Document -----------------

Tags: Windows XP, Windows Server 2000, Windows Server 2003

Published Date: 20071109

Tuesday, November 13, 2007

i8042prt failed to load on boot

When you boot up your computer you get a message that atleast one service failed to start. On checking the eventlogs you figure out that i8042prt failed to load. You do not face this issue on all your computers but mostly on 'headless' servers.

You get the following error message in Windows event logs.

Event Type:                 Error
Event Source:              Service Control Manager
Event Category:           None
Event ID:                     7026
Date:                          11/13/2007
Time:                         9:51:01 AM
User:                          N/A
Description:
The following boot-start or system-start driver(s) failed to load: i8042prt

To view the complete article please click here

 

 

 


Latest ps2 games

Are you a party maniac?

Do you like to party?

Opportunity to earn and party as well

DONT LEAVE THIS PAGE NOW.

:::::CHECK THIS SITE before you move on::::::

Fly this holiday anywhere around the world & save on huge on cheapest airfare using an exclusive CheapOair coupon Code HOLIDAY10. Simply plug in this coupon code when buying your airline ticket at CheapOair.com and save $10 on all domestic & international flights. Coupon Code Valid till Dec 2008

Infuse new life in your OLD PC

Repair Your Windows XP

-------------- End of Document -----------------

Tags: Windows Server 2003

Published Date: 20071113

Monday, November 12, 2007

Finding NIC information remotely using WMIC commands

WMIC is a very useful and very under utilized interface for server / OS management provided in Windows. One very common example that generally requires logging in to the server is to check / set Network card properties. At a command prompt type WMIC and then /? to find the available interfaces that can be queried or set.

To check NIC Configuration tyep the following sequence of commands at the command prompt. For example:

WMIC
/NODE:<hostname>
NICCONFIG Get DNSHostName

NICCONFIG Get DNSDomainSuffixSearchOrder

-------------- End of Document -----------------

Tags: Windows XP, Windows Server 2000, Windows Server 2003

Published Date: 20071112