Logo
Lose Weight
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows Server

Windows Server 2003 : Command-Line Utilities - SCWCMD & MBSACLI

4/16/2012 3:54:15 PM
In this section, I'll give an overview and some examples of various command-line utilities that pertain to Windows security that you can integrate into your scripts and programs.

1. SCWCMD

The Security Configuration Wizard (SCW) includes the Scwcmd.exe command-line tool . This tool is versatile and can perform many tasks that you might want to automate using scripts or batch files. Here, I'll briefly outline the most common tasks you will want to perform using SCWCMD.

1.1. Configuring servers with a policy

The most basic use of the command-line tool is to configure one or many servers with an SCW-generated policy. You can apply a policy to the local machine, to a remote machine using either its NetBIOS name or IP address, or to entire organizational unit's worth of machines. For example, to apply the machine.xml policy to the current computer, simply use this:

    scwcmd configure /p:machine.xml

To apply the policy to all of the machines in the FileServers OU within company.com, you need to use the full LDAP name within the arguments of the command. It should look something like this:

    Scwcmd configure /ou:OU=FileServers,DC=company,DC=com /p:machine.xml

1.2. Analyzing machines for policy compliance

You can also analyze a machine, a list of servers, or an entire organizational unit with an SCW-generated policy. For example, to analyze your SQL Server machine with the sqlserver.xml policy, use the following:

    scwcmd analyze /m:SQLservername /p:sqlserver.xml /u:administrator

Or, to analyze the SQL Servers organizational unit, use the following: (Note that the entire LDAP name needs to be used when specifying Active Directory-based containers with this command.)

    scwcmd analyze /ou:OU=SQLServers,DC=company,DC=com /p:sqlserver.xml /u:administrator


					  

The results of running this command are returned to an XML file generated by the wizard, which you can view using another option in SCWCMD. I'll demonstrate that in a bit.

1.3. Roll back SCW policies

If you make a mistake and need to "undo" a policy application on either a local or remote machine, you can use the command-line tool to get the machine back up quickly. You can also use the /u switch to perform the operation using another user's credentials, if yours aren't sufficient on a remote machine.

For example, to rollback a policy on the machine R2B2SRV1, use the following:

    scwcmd rollback /m:R2B2SRV1 /u:administrator

You can also use an IP address if you aren't sure of the friendly name of a machine:

    scwcmd rollback /m:192.168.2.2 /u:localadmin

1.4. Viewing analysis results

You can use the scwcmd view command to render the raw XML results file that the wizard generates with an XML transform file that makes the results easier to read. The directory %windir%\security\msscw\transformfiles contains .xsl transform files which are applied to the .xml policy file for the rendering process.

To view a policy file, use the following syntax:

    scwcmd view /x:policyfile.xml /s:policyview.xsl

2. MBSACLI

The Microsoft Baseline Security Analyzer has a command-line counterpart that will allow you to perform local and remote security scans and display reports from scans you conducted previously. You simply run MBSACLI from the directory in which the MBSA is installed.

It's fairly simple to perform a full scan of a single computer:

    Mbsacli /target computername

You can also scan the computer for updates only and create a report of the missing updates:

    Mbsacli /target CORP\lj-wnxp-dsk /wa

There's a great deal more syntax and options available, including the ability to create more customized reports that can be graphically displayed, sending reports in XML format for external parsing, scanning a list of computers, and using a custom update catalog file. Issue this command to learn more:

    Mbsacli /?
Other -----------------
- Sharepoint 2010 : FAST Search Server 2010 for SharePoint
- Sharepoint 2010 : Managing the Search Service Topology
- Microsoft Dynamics CRM 4.0 Accelerators : Notifications Accelerator
- Microsoft Dynamics CRM 4.0 Accelerators : Newsfeed Business Productivity Accelerator
- Recovering from a Disaster in an Exchange Server 2007 Environment : Recovering Exchange Application and Exchange Data
- Recovering from a Disaster in an Exchange Server 2007 Environment : Recovering from a Boot Failure & Recovering from a Complete Server Failure
- System Center Configuration Manager 2007 : Inside the ConfigMgr Database
- System Center Configuration Manager 2007 : Components and Communications
- Microsoft Content Management Server : Increasing Search Accuracy by Generating Search Engine Specific Pages
- Microsoft Content Management Server : Configuring Templates to Allow Postings to Return Accurate Last Modified Time
- Active Directory Domain Services 2008 : Modify a Computer Object’s Delegation Properties & Modify a Computer Object’s Location Properties
- Active Directory Domain Services 2008 : Modify a Computer Object’s General Properties & View a Computer Object’s Operating System Properties
- Windows Server 2008 Server Core : Working at the Command Prompt (part 2) - Tracking Command Line Actions with the DosKey Utility
- Windows Server 2008 Server Core : Working at the Command Prompt (part 1)
- Sharepoint 2007 : Customizing a SharePoint Site - Modify a Content Type
- Microsoft BizTalk 2010 : Consuming ASDK-based Adapters - ASDK tools and features
- Microsoft Dynamics AX 2009 : Working with Data in Forms - Creating custom filters
- Microsoft Dynamics AX 2009 : Working with Data in Forms - Handling number sequences
- BizTalk 2006 : Deploying and Managing BizTalk Applications - Administrative Tools (part 3) - ExplorerOM
- BizTalk 2006 : Deploying and Managing BizTalk Applications - Administrative Tools (part 2) - WMI
 
 
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
Top 10
- Windows Phone 8 Apps : Camera (part 4) - Adjusting Video Settings, Using the Video Light
- Windows Phone 8 Apps : Camera (part 3) - Using the Front Camera, Activating Video Mode
- Windows Phone 8 Apps : Camera (part 2) - Controlling the Camera’s Flash, Changing the Camera’s Behavior with Lenses
- Windows Phone 8 Apps : Camera (part 1) - Adjusting Photo Settings
- MDT's Client Wizard : Package Properties
- MDT's Client Wizard : Driver Properties
- MDT's Client Wizard : Application Properties
- MDT's Client Wizard : Operating System Properties
- MDT's Client Wizard : Customizing the Deployment Share
- Windows Server 2012 : Software and User Account Control Administration (part 5) - Maintaining application integrity - Configuring run levels
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro