Friday, May 27, 2011

Run Application as a Windows Service

To allow an application to run as Windows Service under Windows 2008 you can use SrvAny.exe which is part of Windows 2003 Resource Kit.

1. Download Windows 2003 Resource Kit from
and extract it.
2. Copy SrvAny.exe into C:\Windows\System32
3. Create a service using SC command which start srvany.exe.
ex: create MyService binPath= C:\Windows\System32\srvany.exe DisplayName= "My Service"
4. Using the previous action MyService registy key has been created in Registry.
Open Registry using regedit and in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService create a Parameters key.
5. In Parameters create an String Value Application and enter the full path of the application.

Here is the example of making flcd4.exe to work as a service.
flcd4.exe is a daemon service from Floating License feature from 3D-Equalizer

Create  3D-Equalizer service using SC command:
SC create 3D-Equalizer binPath= C:\Windows\System32\srvany.exe DisplayName= "3D-Equalizer"

Go to services and change the Startup type to Automatic.

Open Registry using regedit and in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\3D-Equalizer create a Parameters key. Here create a String Value Application and enter the full path of the application: C:\3DEqualizer\3DE4_win32_r1b11\bin\flcd4.exe. Close the registry.

Go to services and start 3D-Equalizer.

and VoilĂ  it works!!

Wednesday, May 25, 2011

Desired Configuration Management: Software Distribution to Dynamic Computer Collection based on Compliant Status - Part 3

This article continues from Part 2 

Next Step to finish our Software distribution Scenario for Computers which are Non-Compliant based on DCM status is to apply SCCM ForeFront Client Software Package on previously created Dynamic Computer Collection:  System: DCM Dynamic Computer Collection.

Using this SCCM configuration ForeFront Client will be installed on those computers.

When next refresh interval for DCM Configuration Baseline will check the status of those computers it will show that the status now is Compliant.

That automatically means that these computers will automatically disappeared from Dynamic Computer Collection:  System: DCM Dynamic Computer Collection and no more any SCCM Software Package will be applied.

This is a good way using Desired Configuration Management feature from SCCM to keep up-to-date installed software on domain computers .  

Tuesday, May 24, 2011

Desired Configuration Management: Software Distribution to Dynamic Computer Collection based on Compliant Status - Part 2

This article continues from Part 1

To apply Configuration Baseline to Computer Collection right click on target collection and click on Assign Configuration Baseline:

Choose the Configuration Baseline, in this case FCS Installed Baseline, click OK, Next and Close.

When the Configuration Baseline is applied to the target computer, go on SCCM Configuration Manager client, click on Evaluation of selected FCS Installed Baseline configuration baseline and clicking on View Report you will get that the status is Non-Compliant:

Next step is to create Dynamic Computer collection based on the status of the DCM.

Right click on Collections and choose New Collection. Write the name, in this case is: System: DCM Dynamic Computer Collection

Click on query button, write the name of the query (in this case FCS Compliant Status), click on Radio buton Limit to collection to choose the collection (System: DCS tests was the Computer Collection where DCM Configuration baseline was applied) and click on Edit Query Statement.  

Click on Criteria tab, click on yellow star, choose Select on Criteria properties window, in Select Atribute window on Attribute class choose Configuration Item Compliance state and on Attribute choose Compliance State Name.

Click on Value button and choose Non-Compliant in Values window.

Click Ok to close Criterion Properties window and to save the criateria.

Click on the yellow start to create another criteria. Click Select on Criterion properties window, in Select Attribute window on Attribute class choose Configuration Item Compliance state and on Attribute choose Localized Display Name. Click OK to close Select Attribute window.

Choose FCS Installed Baseline from the list and click OK to close Values window.

Click OK to close the second Criteria.

To check the SQL statement click on Show Query Language button.

select *  from  SMS_R_System inner join SMS_G_System_CI_ComplianceState on SMS_G_System_CI_ComplianceState.ResourceId = SMS_R_System.ResourceId where SMS_G_System_CI_ComplianceState.ComplianceStateName = "Non-Compliant" and SMS_G_System_CI_ComplianceState.LocalizedDisplayName = "FCS Installed Baseline"

Click OK to close the Query and click Next and Close to save Dynamic Computer Collection.

After Updating and refreshing this Dynamic Computer Collection on right pane you will get the computers with Non-Compliant Status or the computers which do not have FCS ForeFront installed.

Desired Configuration Management: Software Distribution to Dynamic Computer Collection based on Compliant Status - Part 1

Implementing Desired Configuration Management (DCM) in SCCM 2007 R2, which is by default not enabled, can be very useful.
Checking if some software is installed or not, getting the compliant or not-compliant status, creating Dynamic Computer Collections based on this status and applying Software package can be ideal solution for your environment.
But let's start.
In this example I will check if FCS ForeFront client is installed or not.
First lets create Configuration Item:

In Path field write the path where FCS is installed by default C:\Program Files\Microsoft Forefront\Client Security\Client\SSA and put the FcsSas.exe in File or folder name field:

Click Next and Close.

Next Step is to create Configuration Baseline where the previous FCS Installed created Configuration Item will be included.

Write the name of Configuration baseline. In this case it is FCS Installed Baseline.

Choose Application and General and right from the list choose FCS Installed.

Click Next and after that Close. 

Next step is to assign this Configuration Baseline to Computer Collection  but to avoid applying the Configuration Baseline on All System computer collection you can create a Dynamic Computer Collection. I've published an article where I created a dynamic collection based on string included in computer name:

SCCM 2007 R2 - Create Dynamic collections based on string in computer name

Here is the query which you can use for creating Dynamic Computer Collection based on string inside the computer name.

Example: If your computers contain WKS string in computer name:

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SYSTEM on SMS_G_System_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SYSTEM.Name like "%WKS%" order by SMS_R_System.Name

Tuesday, May 3, 2011

Allowing Non-Admin Users To Install Fonts in Windows 7

Installing Fonts for Standard Users in Windows XP was very easy. Modifying NTFS folder permissions and giving users modify permissions allow they to copy fonts into C:\Windows\Fonts and after that use them.

Installing Fonts in Windows 7 for standard user is different story and it could be very complicated.

Modifying NTFS Permissions on C:\Windows\Fonts  is not possible because Fonts is a System folder and right click on Fonts folder doesn't give possibility for direct NTFS permissions changes.

To change System folder properties attrib command can be used:

attrib -r -s %systemroot%\fonts

-r  - clears Read-only file attribute
-s  - clears System File attribute

Next step is take ownership of Fonts Folder and all files into this folder.

Example: To give Administrators group Ownership to Fonts folder takeown command can be used:

takeown /F %systemroot%\fonts\ /A

/F - Specifies the filename or directory name pattern. Wildcard * can be used to specify the pattern.
/A - Gives ownership to the administrators group instead of current user

Next Step is to change NTFS permissions on Fonts Folder and give Modify or Full permissions to users or groups. To do that you should use cacls command: 


cacls %systemroot%\fonts /E /G Users:F

/E - Edit ACL instead of replacing it.
/G - Grant specific user rights (in this example it gives Full permissions to Users group)
Note: This command changes Fonts Folder permissions and doesn't inherit permissions to the files into the folder.

You can copy all these three lines in Notepad and save it as bat file.

attrib -r -s %systemroot%\fonts
takeown /F %systemroot%\fonts\ /A
cacls %systemroot%\fonts /E /G Users:F

Next Step is to modify permissions on
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
and to give Full Permissions to Users. This will allow standard users to register fonts in registry.

Next step is to copy your fonts in C:\WINDOWS\FONTS Folder. Here is the vbs script which can copy and in same time register your fonts. Fonts are located on network share and before to execute you should modify the script with fonts names.

' ****************************************************************************
' Copy Fonts From Network Share To C:\WINDOWS\FONTS Folder Of Workstation
' ****************************************************************************
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "xcopy.exe ""\\%SERVERNAME%\%SHARE \FONTS"" ""C:\windows\fonts"" /C /I /S /E /H /Y /Q", 1,True

' ****************************************************************************
' Imports The Registry Information For The New Fonts - Add A New Line For Each New Font
' Example : WshShell. RegWrite"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\%FONT REG KEY%", "%FONT REG KEY ENTRY%", "REG_SZ"
' ****************************************************************************

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell. RegWrite"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\Twiggy-Bold (TrueType)", "Twiggy-Bold.ttf", "REG_SZ"
WshShell. RegWrite"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\Twiggy-Light (TrueType)", "Twiggy-Light.ttf", "REG_SZ"
' ****************************************************************************