Skip navigation

Windows Tips & Tricks UPDATE--April 5, 2004

Windows Tips & Tricks UPDATE, April 5, 2004, — brought to you by the Windows & .NET Magazine Network and the Windows 2000 FAQ site
http://www.windows2000faq.com


This Issue Sponsored By

Events Central--a Comprehensive Resource for the Latest Events in Your Field
http://www.winnetmag.com/events

Windows Scripting Solutions
http://www.winscriptingsolutions.com/rd.cfm?code=fsep264xup


Sponsor: Events Central

Looking for one place to find the latest Web seminars, roadshows, and conferences? Events Central has every topic you're looking for. Stay current on the latest developments in your field. Visit Events Central and find answers now!
http://www.winnetmag.com/events


FAQs

  • Q. How can I automatically display computer information on my desktop?
  • Q. How can I check the Flexible Single-Master Operation (FSMO) roles for the local server from the command line?
  • Q. How can I display local Flexible Single-Master Operation (FSMO) role information on the desktop?
  • Q. How can I display on the desktop information about whether the local server is a Global Catalog (GC)?
  • Q. What's the Microsoft Windows Security Update CD?

Commentary
by John Savill, FAQ Editor, [email protected]

This week, I tell you how to automatically display computer information on the desktop and how to check the Flexible Single-Master Operation (FSMO) roles for the local computer from the command line. I also explain how to display on the desktop information about the local FSMO roles and whether the local server is a Global Catalog (GC), and I describe the Microsoft Windows Security Update CD.


Sponsor: Windows Scripting Solutions

Try a Sample Issue of Windows Scripting Solutions
Windows Scripting Solutions is the monthly newsletter from Windows & .NET Magazine that shows you how to automate time-consuming, administrative tasks by using our simple downloadable code and scripting techniques. Sign up for a sample issue right now, and find out how you can save both time and money. Click here!
http://www.winscriptingsolutions.com/rd.cfm?code=fsep264xup


FAQs

Q. How can I automatically display computer information on my desktop?

A. Sysinternals offers a free utility called BgInfo (short for "background information") that displays configurable system information on your desktop wallpaper. I find BgInfo very useful. I use Microsoft Virtual PC 2004 and VMWare Workstation sessions extensively and use BgInfo to display the machine information on the desktop, which helps me to remember exactly which environment I'm working on.

Because BgInfo runs as an application and not as a service, the utility can't automatically update configurable system information on the desktop. However, you can automate the update process by scheduling the application to run periodically, or you can run BgInfo at startup to update system information every time you log on. This figure shows the default information that appears on screen when you run BgInfo.

You can also add information to the BgInfo desktop image as output from a script, a registry subkey, file content, an environment variable, or a Windows Management Instrumentation (WMI) query. Be aware that if you use wallpaper that isn't the full size of your desktop and you typically use the desktop settings to stretch the wallpaper, BgInfo stretches the image, making it appear more jagged than usual. For best results, use a full-size background (e.g., use a paint package to resize the wallpaper if necessary).

Q. How can I check the Flexible Single-Master Operation (FSMO) roles for the local server from the command line?

A. I've written a short VBScript script called localsrvroles.vbs that displays on screen the FSMO roles that the current server holds. (My script is based on a script that Microsoft created to list all the roles of a forest; I've changed the Microsoft script to compare these roles to the local server's roles and display only the roles that match.) Localsrvroles.vbs, which is available at the Windows & .NET Magazine Web site, is listed below.

Option Explicit
Dim WSHNetwork, objArgs, ADOconnObj, bstrADOQueryString, RootDom, RSObj
Dim FSMOobj,CompNTDS, Computer, Path, HelpText, LocalDNSName, strComputerDN,

objSysInfo, objComputer

Set WSHNetwork = CreateObject("WScript.Network")
Path = WSHNetwork.ComputerName

Set objSysInfo = CreateObject("ADSystemInfo")
strComputerDN = objSysInfo.ComputerName

Set objComputer = GetObject("LDAP://" & strComputerDN)
LocalDNSName = objComputer.dNSHostName

Set ADOconnObj = CreateObject("ADODB.Connection")

ADOconnObj.Provider = "ADSDSOObject"
ADOconnObj.Open "ADs Provider"

'PDC FSMO
bstrADOQueryString =
"<LDAP://"&Path&">;(&(objectClass=domainDNS)(fSMORoleOwner=*));adspath;subtree"
Set RootDom = GetObject("LDAP://RootDSE")
Set RSObj = ADOconnObj.Execute(bstrADOQueryString)
Set FSMOobj = GetObject(RSObj.Fields(0).Value)
Set CompNTDS = GetObject("LDAP://" & FSMOobj.fSMORoleOwner)
Set Computer = GetObject(CompNTDS.Parent)
if StrComp(LocalDNSName, Computer.dnsHostName) = 0 then
WScript.Echo "PDC"
end if

'Rid FSMO
bstrADOQueryString = "<LDAP://"&Path&">;(&(objectClass=rIDManager)(FSMORoleOwner=*));adspath;subtree"

Set RSObj = ADOconnObj.Execute(bstrADOQueryString)
Set FSMOobj = GetObject(RSObj.Fields(0).Value)
Set CompNTDS = GetObject("LDAP://" & FSMOobj.fSMORoleOwner)
Set Computer = GetObject(CompNTDS.Parent)
if StrComp(LocalDNSName, Computer.dnsHostName) = 0 then
WScript.Echo "RIS"
end if

'Infrastructure FSMO
bstrADOQueryString = "<LDAP://"&Path&">;(&(objectClass=infrastructureUpdate)
(FSMORoleOwner=*));adspath;subtree"

Set RSObj = ADOconnObj.Execute(bstrADOQueryString)
Set FSMOobj = GetObject(RSObj.Fields(0).Value)
Set CompNTDS = GetObject("LDAP://" & FSMOobj.fSMORoleOwner)
Set Computer = GetObject(CompNTDS.Parent)
if StrComp(LocalDNSName, Computer.dnsHostName) = 0 then
WScript.Echo "Infrastructure"
end if

'Schema FSMO
bstrADOQueryString = "<LDAP://"&RootDom.Get("schemaNamingContext")&_
">;(&(objectClass=dMD)(fSMORoleOwner=*));adspath;subtree"

Set RSObj = ADOconnObj.Execute(bstrADOQueryString)
Set FSMOobj = GetObject(RSObj.Fields(0).Value)
Set CompNTDS = GetObject("LDAP://" & FSMOobj.fSMORoleOwner)
Set Computer = GetObject(CompNTDS.Parent)
if StrComp(LocalDNSName, Computer.dnsHostName) = 0 then
WScript.Echo "Schema"
end if

'Domain Naming FSMO
bstrADOQueryString = "<LDAP://"&RootDom.Get("configurationNamingContext")&_
">;(&(objectClass=crossRefContainer)(fSMORoleOwner=*));adspath;subtree"

Set RSObj = ADOconnObj.Execute(bstrADOQueryString)
Set FSMOobj = GetObject(RSObj.Fields(0).Value)
Set CompNTDS = GetObject("LDAP://" & FSMOobj.fSMORoleOwner)
Set Computer = GetObject(CompNTDS.Parent)
if StrComp(LocalDNSName, Computer.dnsHostName) = 0 then
WScript.Echo "Domain Naming"
end if

To execute the script, at the command prompt type

cscript //nologo localsrvroles.vbs

The script output will look similar to the following:

PDC
RIS
Infrastructure
Schema
Domain Naming

Notice that the script doesn't output anything except the roles that the machine holds (in this case, the server holds all five FSMO roles).

Q. How can I display local Flexible Single-Master Operation (FSMO) role information on the desktop?

A. As I discussed in the FAQ "Q. How can I automatically display computer information on my desktop?", Sysinternals offers a free utility called BgInfo that displays configurable system information on your desktop wallpaper. To add local FSMO information to the BgInfo system information, perform the following steps:

  1. Open the script localsrvroles.vbs, which is presented in the FAQ "Q. How can I check the Flexible Single-Master Operation (FSMO) roles for the local server from the command line?".
  2. For the script to work in BgInfo, replace all instances of WScript.Echo with Echo and save the script.
  3. Start BgInfo (bginfo.exe).
  4. Click the Custom button, then click New.
  5. In the Identifier field, enter the identifier "FSMO Roles". Then, under "Replace identifier with," select "VB Script file," as this figure shows.
  6. Click Browse, navigate to the location of the localsrvroles.vbs file, then click Open.
  7. Click OK to close the Define New Field dialog box.
  8. Click OK to close the User Defined Fields dialog box.
  9. Select FSMO Roles from the Fields list, then click Add.

Now when you click OK to run BgInfo, the local FSMO roles appear on the desktop with the other system information. In this figure, notice that the domain controller (DC) doesn't hold any Schema or Domain Naming forest roles. The localsrvroles.vbs file and the server.bgi configuration file that I used to create the sample output are available at the URL above.

Q. How can I display on the desktop information about whether the local server is a Global Catalog (GC)?

A. As I discussed in the FAQ "Q. How can I automatically display computer information on my desktop?", Sysinternals offers a free utility called BgInfo that displays configurable system information on your desktop wallpaper. To add information about the local server's GC status, perform the following steps:

  1. Save the following VBScript code into a file called localgc.vbs:
    On Error Resume Next
    
    Set WSHNetwork = CreateObject("WScript.Network")
    
    Set objRoot = GetObject("LDAP://"&WSHNetwork.ComputerName&"/RootDSE")
    objDSServiceDN = objRoot.Get("dsServiceName")
    Set objDSRoot = GetObject("LDAP://"&WSHNetwork.ComputerName&"/" & objDSServiceDN )
    blnCurrentOptions = objDSRoot.Get("options")
    If blnCurrentOptions Then
    Echo "Yes"
    Else
    Echo "No"
    End If 
  2. Start BgInfo (bginfo.exe).
  3. Click the Custom button, then click New.
  4. In the Identifier field, enter the identifier "Global Catalog". Then, under "Replace identifier with," select "VB Script file."
  5. Click Browse, navigate to the location of the localgc.vbs file, then click Open.
  6. Click OK to close the Define New Field dialog box.
  7. Click OK to close the User Defined Fields dialog box.
  8. Select "Global Catalog" from the Fields list, then click Add.

Now when you click OK to run BgInfo, the local server's GC status appears on the desktop with the other system information. You can also run the script locally (i.e., outside of BgInfo) by replacing the Echo commands in the script with WScript.Echo.

Q. What's the Microsoft Windows Security Update CD?

A. Microsoft has released a CD-ROM that includes all service packs and fixes for the following OSs:

  • Windows XP
  • Windows 2000
  • Windows Me
  • Windows 98 (and Win98 SE)

The CD-ROM is free (including the cost of postage for US-based customers), and you don't need to provide a credit card when you place your order. You'll actually receive two CD-ROMs in the mail--the first has all the fixes, and the second has trial antivirus and firewall products.

Announcements
(from Windows & .NET Magazine and its partners)

  • The Windows & .NET Magazine Network VIP Web Site/Super CD Has It All!

  • With a VIP Web Site/Super CD subscription, you'll get online access to all of our publications, a print subscription to Windows & .NET Magazine, and a subscription to our VIP Web site, a banner-free resource loaded with articles you can't find anywhere else. Click here to find out how you can get it all:
    http://www.winnetmag.com/rd.cfm?code=wvep274xup

  • Attend Microsoft Tech Ed 2004

  • Tech Ed 2004 -- May 23-28, 2004 in San Diego, CA -- the definitive Microsoft conference for building, deploying, securing and managing connected solutions. You'll find specific IT tracks on Architecture, Security, Operations and more. Plus, meet tech gurus, preview products, and network with experts and peers. Register Now.
    http://clk.atdmt.com/DDB/go/wndwiit400100055ddb/direct/01

    Events Central
    (A complete Web and live events directory brought to you by Windows & .NET Magazine: http://www.winnetmag.com/events )

  • New Web Seminar--The Spam Problem Solved: Hensel
    Phelps Construction Company Case Study

  • Find out how Hensel Phelps Construction, a multibillion-dollar national contractor, has implemented a multilayered antispam solution to increase user productivity and decrease the burden on IT staff resources, infrastructure, and budget. Sign up now for this free Web seminar!
    http://www.winnetmag.com/seminars/solvingspam/index.cfm?code=emailannc

    Sponsored Links

  • Argent -- Comparison Paper: The Argent Guardian Easily Beats Out MOM

  • http://ad.doubleclick.net/clk;6480843;8214395;q?http://www.argent.com/products/download_whitepaper.cgi?product=mom&&Source=WNTTextLink

    Contact Us
    Here's how to reach us with your comments and questions:

    This weekly email newsletter is brought to you by Windows & .NET Magazine, the leading publication for Windows professionals who want to learn more and perform better. Subscribe today.
    http://www.winnetmag.com/sub.cfm?code=wswi201x1z

    Receive the latest information about the Windows and .NET topics of your choice. Subscribe to our other FREE email newsletters.
    http://www.winnetmag.net/email

    TAGS: Security
    Hide comments

    Comments

    • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

    Plain text

    • No HTML tags allowed.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs break automatically.
    Publish