Saturday, August 9, 2008

ALL SQL Queries

SQL Query To Retrieve Advanced Clients Assigned Site Code And Client Version

 

This SQL Query will allow you to list the assigned site code and client version numbers for your advanced client resources.

 

SQL Query:

 

Select 

SD.Name0 'Machine Name',

SC.SMS_Assigned_Sites0 'Assigned Site',

SD.Client_Version0 Version

From v_R_System SD

 

Join v_RA_System_SmsAssignedSites SC on SD.ResourceID = SC.ResourceID

Join v_GS_Operating_System OS on SD.ResourceID = OS.ResourceID

 

Where SD.Client0 = 1

And SD.Client_Type0 = 1

 

Order By 'Machine Name'

 

SQL Query To Gather Video Card Memory Information

 

This SQL query will gather video card memory information in Megabytes (Mb) for the machines in your database.

 

SQL Query:

 

Select    

SD.Name0 'Machine Name',

VC.Name0 'Video Card',

Convert(VarChar, VC.AdapterRam0 / 1024) + ' MB'

 

From v_R_System SD

Join v_Gs_Video_Controller VC on SD.ResourceID = VC.ResourceID

 

Where VC.Name0 <> 'ConfigMgr Remote Control Driver'

Order By SD.Name0

SQL Query To See When Collections Were Last Updated

 

This SQL Query will list all of the collections on the site server from which the query is executed on and will write the collection ID, Collection Name and the time stamp for when the collection was last updated.

 

SQL Query:

 

Select

CC.CollectionID,

CN.CollectionName,

Convert(VarChar(10), CC.TimeUpdated, 101) 'Last Updated'

 

From Collection_MemberChg_Notif CC

Join Collections CN on CC.CollectionID = CN.SiteID

 

Order By CollectionName

SQL Query To Get Members Of A Specified Collection

 

This SQL Query will retrieve the machine names from a specified collection.

 

SQL Query:

 

Select

Members.Name

'Collection Members:'

 

From CollectionMembers Members

Join Collections Coll on Members.SiteID = Coll.SiteID

 

Where Coll.CollectionName = 'All Systems'

 

To see a list of all the available Collections use this query and then change the 'All Systems' collection name as needed:

 

Select CollectionName From Collections

SQL Query Get User Information From A Specified OU

 

This SQL query will return the following information from a specified Organizational Unit (OU): Machine name, User Name, Full name, Users OU and its Subnet.

 

SQL Query:

 

Select Distinct

CS.Name0 'Machine Name',

CS.UserName0 'User Name',

RU.Full_User_Name0 'Full Name',

UOU.User_OU_Name0 'Users OU',

RA.IP_Subnets0  'Subnet'

 

From v_Gs_Computer_System CS 

Join v_RA_System_IPSubnets RA on RA.ResourceID = CS.ResourceID

Join v_R_User RU on RU.Unique_User_Name0 = CS.UserName0

Join v_RA_User_UserOUName UOU on UOU.ResourceID = RU.ResourceID

 

Where UOU.User_OU_Name0 = 'DomainName.COM/OuName'

 

Order by  CS.Name0, CS.Username0, RU.Full_User_Name0, RA.IP_Subnets0

SQL Query For Windows Media Player Versions

 

This SQL query will allow you to retrieve Windows Media Player Version information for resources in your database.

 

SQL Query:

 

Select Distinct

v_R_System.Name0,

v_GS_SoftwareFile.FileName,

v_GS_SoftwareFile.FileDescription,

v_GS_SoftwareFile.FileVersion

 

From v_R_System

Join v_GS_SoftwareFile on v_R_System.ResourceID = v_GS_SoftwareFile.ResourceID

 

Where FileName = 'wmplayer.exe'

SQL Query To Enumerate ConfigMgr 2007 Boundaries

 

This SQL query will enumerate your ConfigMgr 2007 site boundaries and will use Case statements for the Boundary Type, Connection and if it is protected or not.

 

SQL Query:

 

Select 

Value,

SiteCode,

 

'Boundary Type' = Case

When BoundaryType = 0 Then 'IP Subnet'

When BoundaryType = 1 Then 'Active Directory Site'

When BoundaryType = 2 Then 'IPv6 Prefix'

When BoundaryType = 3 Then 'IP Address Range'

Else 'UnKnown'

End,

 

DisplayName,

 

'Connection' = Case

When BoundaryFlags = 0 Then 'Fast'

When BoundaryFlags = 1 Then 'Slow'

Else 'UnKnown'

End,

 

'Protected' = Case

When Action = 0 Then 'No'

When Action = 1 Then 'Yes'

Else 'UnKnown'

End

 

From Boundary

SQL Query Get Machine and User Information From A Specified Collection

 

This SQL query will return machine and user information from a specified collection.

 

Included will be the Machine name, Resource domain name, Login user ID, the account use domain, user's full name, serial number, manufacturer, model and the machines assigned site.

 

SQL Query:

 

Select

SD.Name0 'Machine Name',

SD.Resource_Domain_OR_Workgr0 'Resource Domain',

SD.User_Name0 'Login ID',

SD.User_Domain0 'Account Domain',

USR.Full_User_Name0 'Full Name',

PCB.SerialNumber0 'Serial Number',

CS.Manufacturer0 Manufacturer,

CS.Model0 Model,

SAS.SMS_Assigned_Sites0 'Assigned Site Code'

From v_R_System SD

 

Join v_FullCollectionMembership FCM on SD.ResourceID = FCM.ResourceID

Join v_Collection COL on FCM.CollectionID = COL.CollectionID

Join v_R_User USR on SD.User_Name0 = USR.User_Name0

Join v_GS_PC_BIOS PCB on SD.ResourceID = PCB.ResourceID

Join v_GS_COMPUTER_SYSTEM CS on SD.ResourceID = CS.ResourceID

Join v_RA_System_SMSAssignedSites SAS on SD.ResourceID = SAS.ResourceID

 

Where COL.Name = 'All Systems'

Creating A Web Report To Get Machine and User Information From A Specified Collection

 

This post is based on a previous post entitled: SQL Query Get Machine and User Information From Specified Collection which was a SQL query that would return machine and user information from a specified collection.

 

Included will be the Machine name, Resource domain name, Login user ID, the account use domain, user's full name, serial number, manufacturer, model and the machines assigned site.

 

I am writing this post as part of a By Request to convert the pervious post into a Web Report.

 

To create a new Web report specify the following after selecting "New" > "Report":

 

Name: Get Machine and User Information From Specified Collection

Category: Users

Comment: This SQL query will return machine and user information from a specified collection.

 

Select "Edit SQL Statement" and add the following:

 

Select

SD.Name0 'Machine Name',

SD.Resource_Domain_OR_Workgr0 'Resource Domain',

SD.User_Name0 'Login ID',

SD.User_Domain0 'Account Domain',

USR.Full_User_Name0 'Full Name',

PCB.SerialNumber0 'Serial Number',

CS.Manufacturer0 Manufacturer,

CS.Model0 Model,

SAS.SMS_Assigned_Sites0 'Assigned Site Code'

From v_R_System SD

Join v_FullCollectionMembership FCM on SD.ResourceID = FCM.ResourceID

Join v_Collection COL on FCM.CollectionID = COL.CollectionID

Join v_R_User USR on SD.User_Name0 = USR.User_Name0

Join v_GS_PC_BIOS PCB on SD.ResourceID = PCB.ResourceID

Join v_GS_COMPUTER_SYSTEM CS on SD.ResourceID = CS.ResourceID

Join v_RA_System_SMSAssignedSites SAS on SD.ResourceID = SAS.ResourceID

Where COL.Name =  @ID

 

Select "Prompts" and select New (The *) and add the following:

 

Name: ID

Prompt Text: Specify a collection Name

 

Select the checkbox to "Provide a SQL statement" and the select "Edit SQL Statement" and enter the following:

 

Begin

If (@__filterwildcard = '')

Select Distinct Name From v_Collection

Order by Name

Else Select Distinct Name From v_Collection

Where Name like @__filterwildcard

Order By  Name

End

 

Select "OK" to the dialog boxes until you return to the "New Report Wizard" task and then select "Next" until the report is created and then "Close" the wizard.

SQL Query To Retrieve Clients Last Boot up Date

 

This SQL Query will return machine names and their last boot up date timestamp.

 

Tip: To query an individual machine Change the line that reads Order By 'Machine Name' to Where SD.Name0 = 'MachineName'

 

Select 

SD.Name0 'Machine Name',

SD.User_Name0 'Last Logged on User Name',

Convert(VarChar(10), OS.LastBootUpTime0, 101)  'Last Boot Date'

 

From v_R_System SD

Join v_Gs_Operating_System OS on SD.ResourceID = OS.ResourceID

 

Order By 'Machine Name'

SQL Query To List Machines With IIS , FTP Or Telnet Installed

 

This SQL query will list all of the machines that have the World Wide Web Publishing Service, the FTP Publishing Service or the Telnet server services installed by their Service name.

 

SQL Query:

 

Select

SD.Name0 'Machine Name',

SD.Operating_System_Name_and0 NOS,

SS.Name0 'Service Name',

SS.DisplayName0 'Display Name',

SS.StartMode0 'Start Type',

SS.Started0 Started,

SS.State0 State,

SS.Status0 Status

 

From System_DISC SD

Join Services_DATA SS

on SS.MachineID = SD.ItemKey

 

Where SS.Name0 In ('W3SVC', 'MsFtpSvc', 'TlntSvr')

Order By 'Machine Name'

SQL Query To Count The Number Of Client Machines With McAfee Virus Scan Installed

 

This SQL query was written as a request from a reader wanting to know how to count the number of machines that have McAfee VirusScan Enterprise installed by using the Add And Remove Programs applet.

 

SQL Query:

 

Select

Count(SD.Name0) Counts,

PF.DisplayName0,

PF.Version0

 

From v_Add_Remove_Programs PF

Join v_R_System SD on PF.ResourceID = SD.ResourceID

Where PF.DisplayName0 = 'McAfee VirusScan Enterprise'

 

Group By PF.DisplayName0, PF.Version0

Order By Counts, PF.Version0

 

To see the machine names rather than the counts use this query:

 

Select

SD.Name0,

PF.DisplayName0,

PF.Version0

 

From v_Add_Remove_Programs PF

Join v_R_System SD on PF.ResourceID = SD.ResourceID

Where PF.DisplayName0 = 'McAfee VirusScan Enterprise'

 

Group By SD.Name0, PF.DisplayName0, PF.Version0

Order By SD.Name0

 

Advertisement Status For Multiple Advertisement IDs

 

This SQL query will allow you to retrieve Advertisement information for multiple advertisement ID's.

 

SQL Query:

 

Select

OfferName Name,

Recieved,

Failures,

ProgramsStarted Started,

ProgramsFailure Errors,

ProgramsSuccess Success,

OfferID 'Advertisement ID'

 

From vOfferStatusSummarizerRoot

Where ScheduleToken = '0001128000080008'

And OfferID In ('XXX12345', 'XXX67890')

 

Order by OfferName

SQL Query To List Roaming Boundary IP Subnets

 

This SQL query will return all of the Roaming IP subnet boundaries for a specified site code.

 

SQL Query:

 

Select IPSubnet

From RoamingBoundaryIPSubnet

 

Where SiteCode = 'XXX'

Order by SiteCode

SQL Query To Locate Full User Names From A Specified Collection

 

This SQL query will allow you to retrieve the full user name and login ID name for all machines in a specific collection.

 

SQL Query:

 

Select  

SD.Name0 'Machine Name',

SD.User_Name0 'Login ID',

USR.Full_User_Name0 'Full Name'

From v_R_System SD

 

Join v_FullCollectionMembership FCM on SD.ResourceID = FCM.ResourceID

Join v_Collection COL on FCM.CollectionID = COL.CollectionID

Join v_R_User USR on SD.User_Name0 = USR.User_Name0

 

Where COL.Name = 'All Systems'

 

SQL Query To Find Machines In A Specified Collection Having A Specified Application Installed

 

This SQL query will allow you to find machines in a specified collection that have a specified application installed.

 

SQL Query:

 

Select

SD.Name0 'Machine Name',

SD.Resource_Domain_OR_Workgr0 'Resource Domain',

SD.User_Name0 'Login ID',

SD.User_Domain0 'Account Domain',

USR.Full_User_Name0 'Full Name',

ARP.DisplayName0 'Display Name'

From v_R_System SD

 

Join v_FullCollectionMembership FCM on SD.ResourceID = FCM.ResourceID

Join v_Collection CN on FCM.CollectionID = CN.CollectionID

Join v_R_User USR on SD.User_Name0 = USR.User_Name0

Join v_Add_Remove_Programs ARP on SD.ResourceID = ARP.ResourceID

 

Where CN.Name = 'All Systems'

And ARP.DisplayName0 Like '%VPN%'

 

SQL Query To View Web Reports By Category

 

This SQL Query will allow you to view Web Reports by category for your reference.

 

SQL Query:

 

Select

Name,

Comment,

ReportId,

Category

From v_Report

 

Where Category = 'Asset Intelligence'

Order By Name

 

Use this SQL Query to locate all of the available Report Categories for use with the query above:

 

Select Distinct Category

From V_Report

Order By Category

SQL Query To Retrieve A Users Full Name

 

This SQL Query will allow you to find the Full Name for a specified users Logon name.

 

SQL Query:

 

Select

SD.Name0 'Machine Name',

SD.User_Name0 'Logon Name',

UD.Full_User_Name0 'Full Name'

 

From v_R_System SD

Join v_R_User UD on SD.User_Name0 = UD.User_Name0

Where SD.User_Name0 = 'LogonId'

 

SQL Queries To Locate Client Resources For A Specified Subnet

 

Provided here are SQL queries that will allow you to locate client resources from a specified subnet. The first example specifies (=) a subnet, the second one uses a wildcard (Like) and finally the third allows you to specify multiple subnets.

 

Specific Search:

 

Select Distinct

SD.Name0,

IP.Ip_Subnets0

From v_Ra_System_IpSubnets IP

Join v_R_System SD on IP.ResourceID = SD.ResourceID

Where IP.Ip_Subnets0 = '192.168.1.0'

 

Wildcard Search:

 

Select Distinct

SD.Name0,

IP.Ip_Subnets0

From v_Ra_System_IpSubnets IP

Join v_R_System SD on IP.ResourceID = SD.ResourceID

Where IP.Ip_Subnets0 Like '192.168.1.%'

 

Multiple Searches:

 

Select Distinct

SD.Name0,

IP.Ip_Subnets0

From v_Ra_System_IpSubnets IP

Join v_R_System SD on IP.ResourceID = SD.ResourceID

Where IP.Ip_Subnets0 In

('192.168.1.0',

'192.168.2.0')

Order by IP.Ip_Subnets0,SD.Name0

 

SQL Query To Count Microsoft Office Versions From Add And Remove Programs

 

This SQL Query will allow you to get a count of the Microsoft Office versions deployed.

 

SQL Query:

 

Select

Count(ResourceID) Counts,

DisplayName0,

Publisher0,

Version0

From v_Add_Remove_Programs

 

Where Publisher0 = 'Microsoft Corporation'

And DisplayName0 Like 'Microsoft Office%'

 

Group By DisplayName0, Publisher0, version0

Order By Counts Desc

SQL Query To Enumerate ConfigMgr 2007 Web Reports Information

 

This SQL Query will list all of the installed Web Reports information for the sever on which the script is executed on.

 

The following information will be displayed: ReportID, Name, Category, Comment and the appropriate SQL query.

 

SQL Query:

 

Select

VR.ReportID,

VR.Name,

VR.Category,

VR.Comment,

VR.SQLQuery

 

From v_Report VR

Join v_ReportParameter RP

on VR.ReportID = RP.ReportID

SQL Query To Count Assigned And Installed Resources By Site Code

 

This SQL Query will allow you to count the assigned and installed resources for a specified site code.

 

SQL Query:

 

Select

SC.SiteCode 'Site Code',

 

(Select Count(ResourceId) From v_RA_System_SMSAssignedSites

Where SMS_Assigned_Sites0 = 'XXX') 'Assigned',

 

(Select Count(ResourceID) From v_RA_System_SMSInstalledSites

Where SMS_Installed_Sites0 = 'XXX')'Installed'

 

From v_Site SC

Order by SC.SiteCode

 

SQL Quick Counting Script Examples

 

Provided here are some quick SQL counting scripts to get you started in creating your own count scripts.

 

The first script counts all of the records in the System Discovery table. The second script counts all of the records in the System Discovery table where the resources are clients. Finally the third counts records in the System Discovery table where the resources are not clients.

 

The last three scripts are in the same order as the first three scripts but  will show you how to specify a column name to count.

 

Select Count(*) 'Total Count' From System_Disc

 

Select Count(*) 'Client Count' From System_Disc

Where Client0 = 1

 

Select Count(*) 'Non-Client Count' From System_Disc

Where Client0 Is NULL

 

Specifies a column to count:

 

Select Count(Name0) 'Total Count' From System_Disc

 

Select Count(Name0) 'Client Count' From System_Disc

Where Client0 = 1

 

Select Count(Name0) 'Non-Client Count' From System_Disc

Where Client0 Is NULL

SQL Query To Count Computer Types For A Specified Collection Name

 

This SQL query will allow you to retrieve a count of the Computer types that reside in a specific collection. For example if you want to know how many Desktops and Laptops are in a collection such as the "All Systems" collection this query will allow you to see how many there are.

 

SQL Query:


Select

CN.Name 'Collection Name',

 

Case SE.ChassisTypes0

When 1 Then 'Other'

When 2 Then 'Unknown'

When 3 Then 'Desktop'

When 4 Then 'Low Profile Desktop'

When 5 Then 'PizzaBox'

When 6 Then 'Mini-Tower'

When 7 Then 'Tower'

When 8 Then 'Portable'

When 9 Then 'Laptop'

When 10 Then 'Notebook'

When 11 Then 'Handheld Device'

When 12 Then 'Docking Station'

When 13 Then 'All-In-One'

When 14 Then 'Sub-Notebook'

When 15 Then 'Space Saving'

When 16 Then 'Lunch Box'

When 17 Then 'Main System Chassis'

When 18 Then 'Expansion Chassis'

When 19 Then 'Sub-Chassis'

When 20 Then 'Bus Expansion Chassis'

When 21 Then 'Peripheral Chassis'

When 22 Then 'Storage Chassis'

When 23 Then 'Rack-Mount Chassis'

When 24 Then 'Sealed PC'

Else 'Unknown'

End 'Chassis Type',

Count(*) 'Chassis Count'

 

From v_Collection CN

Join v_FullCollectionMembership CM on CN.CollectionID = CM.CollectionID

Join v_R_System SD on CM.ResourceID = SD.ResourceID

Join v_Gs_System_Enclosure SE on SD.ResourceID = SE.ResourceID

 

Where CN.Name = 'All Systems'

 

Group By CN.Name, SE.ChassisTypes0

Order By CN.Name

SQL Query Add And Removed Programs For A Collection

 

This SQL Query will allow you to retrieve Add And Removed Programs for all resources in a specified collection.

 

SQL Query:

 

Select

SD.Name0 'Machine Name',

PF.DisplayName0 'Display Name',

PF.ProdID0 'Product ID',

PF.Publisher0 Publisher,

PF.Version0 Version

 

From v_R_System SD

Join v_FullCollectionMembership FCM on SD.ResourceID = FCM.ResourceID

Join v_Collection COL on FCM.CollectionID = COL.CollectionID

Join v_Add_Remove_Programs PF on SD.ResourceID = PF.ResourceID

 

Where COL.Name = 'All Systems'

Group By SD.Name0, COL.CollectionID, COL.Name, PF.DisplayName0,

PF.ProdID0, PF.Publisher0, PF.Version0

Order By SD.Name0

 

SQL Query To Find Machines With Torrent Downloading Clients Installed

 

This SQL query will find machines with Peer-To-Peer (P2P) Torrent File Sharing downloading Client's installed.

 

The script below actually began as a By Request script that I was asked to create for a reader who wanted to know how to find machines with any versions of either UTorrent or BitTorrent installed. Since I know next to nothing about P2P clients I went to the web to find out more information. Then I added some of the more seemingly popular ones to the list. I chose to use "Like" rather than UTorrent.Exe to capture both the actual client applications and install downloads.

 

Note: I am sure that there are more P2P client applications out there specifically for downloading Torrent files so if you find any please comment on this post for the benefit of others.

 

Torrent SQL Query:

 

Select

SD.Name0,

SF.FileName

From v_Gs_SoftwareFile SF

Join v_R_System SD on SD.ResourceId = SF.ResourceId

 

Where SF.FileName Like '%Azureus%'

Or SF.FileName Like '%BitComet%'

Or SF.FileName Like '%BitLord%'

Or SF.FileName Like '%BitPump%'

Or SF.FileName Like '%BitTornado%'

Or SF.FileName Like '%BitTorrent%'

Or SF.FileName Like '%Shareaza%'

Or SF.FileName Like '%Utorrent%'

Order By SD.Name0, SF.FileName

 

Below is a SQL query to find applications that are not only used to download Torrent files but other files as well using P2P technology.

 

Other File Sharing Applications SQL Query:

 

Select

SD.Name0,

SF.FileName

From v_Gs_SoftwareFile SF

Join v_R_System SD on SD.ResourceId = SF.ResourceId

 

Where SF.FileName Like '%BearShare%'

Or SF.FileName Like '%eDonkey%'

Or SF.FileName Like '%Emule%'

Or SF.FileName Like '%Kazaa%'

Or SF.FileName Like '%LimeWire%'

Or SF.FileName Like '%Morpheus%'

Order By SD.Name0, SF.FileName

 

 

The following SMS WQL query will locate users within your SMS sites that have prohibited or unnecessary software installed on their machines.

 

##### Begin Copy And Paste #####

Select Distinct
SMS_R_System.Name,
SMS_R_System.LastLogonUserName,
SMS_G_System_USER.FullName,
SMS_G_System_SoftwareFile.FileName,
SMS_G_System_SoftwareFile.FileDescription
From SMS_R_System
Inner join SMS_G_System_SoftwareFile
On SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId
Inner join SMS_G_System_USER
On SMS_G_System_USER.Name = SMS_R_System.LastLogonUserName
Where SMS_G_System_SoftwareFile.FileName like "%Crack%"
Or SMS_G_System_SoftwareFile.FileName like "%Diablo%"
Or SMS_G_System_SoftwareFile.FileName like "%Getadmin%"
Or SMS_G_System_SoftwareFile.FileName like "%Napster%"
Or SMS_G_System_SoftwareFile.FileName like "%Doom%"
Or SMS_G_System_SoftwareFile.FileName like "%Hack%"
Or SMS_G_System_SoftwareFile.FileName like "%Morpheus%"
Or SMS_G_System_SoftwareFile.FileName like "%Napster%"
Or SMS_G_System_SoftwareFile.FileName like "%Nuke%"
Or SMS_G_System_SoftwareFile.FileName like "%Quake%"
Or SMS_G_System_SoftwareFile.FileName like "%Kazaa%"
Or SMS_G_System_SoftwareFile.FileName like "%Lopht%"

##### End Copy And Paste #####

 

SQL Query To Retrieve Machines In A Specified Collections Last Logged On User Information

 

This SQL query will allow you to specify a collection name such as the All Systems collection and will retrieve the Machine name, Last logged on users Login ID and their Full user name.

 

SQL Query:

 

Select

C.CollectionName,

M.Name,

S.User_Name0,

U.Full_User_Name0

From Collections C

 

Join CollectionMembers M on C.SiteID = M.SiteID

Join System_Disc S on M.Name = S.Name0

Join User_DISC U on S.User_Name0 = U.User_Name0

 

Where CollectionName = 'All Systems'

SQL Query To Retrieve The Machine Name And Asset Tag For A Specified Serial Number

 

This SQL Query will allow you to search for a machine and its asset tag from a known serial number.

 

Note: Change MUR0FTIYM to the serial number you want to search for.

 

SQL Query:

 

Select    

SD.Name0 'Machine Name',

SE.SerialNumber00 'Serial Number',

SE.SMBIOSAssetTag00 'Asset Tag'

 

From System_Disc SD

Join System_Enclosure_Data SE on SE.MachineID = SD.ItemKey

 

Where SE.SerialNumber00 = 'MUR0FTIYM'

SQL Query Get Users OU Name

 

SQL Query to retrieve users Organizational Unit (OU) name as well as their last logged on machine name, logon ID and full name. 

 

SQL Query:

 

Select Distinct

S.Name0 'Machine Name',

S.User_Name0 'Logon ID',

U.Full_User_Name0 'Full Name',

O.User_Ou_Name0 'Organizational Unit'

 

From v_R_System S

Join v_R_User U on S.User_Name0 = U.User_Name0

Full Join v_Ra_User_UserOuName O on U.Unique_User_Name0 = O.User_Ou_Name0

 

Where O.User_Ou_Name0 Is Not Null

 

Retrieve All Queries Information

 

Use the SQL script below to retrieves All Queries Information from your SMS SQL server.

 

SQL Query:

 

Select

QueryKey 'Query ID',

Name 'Query Name',

Comments 'Query Comments',

Architecture 'Query Object Type',

CollectionID 'Limit To Collection ID'

From Queries

 

SQL Query To Find And Count Software File And Product Information For A Specified Executable

 

This SQL query will allow you to find and count software file and product information for a specified executable.

 

SQL Query:

 

Select

SF.FileId 'File ID',

SF.ProductId 'Product ID',

SF.FileName 'File Name',

SF.FileDescription 'File Description',

SF.FileSize 'File Size',

SF.FileVersion 'File Version',

SP.ProductName 'Product Name',

SP.ProductVersion 'Product Version',

SP.CompanyName 'Company Name',

Count(SF.FileName) 'Installed Count'

 

From System_DISC SD

Join vSMS_G_System_SoftwareFile SF on SF.ClientId = SD.ItemKey 

Join vSMS_G_System_SoftwareProduct SP on SP.ClientId = SD.ItemKey  

Where SF.ProductId = SP.ProductId

And SF.FileName = 'FileName.Exe'

 

Group by SF.FileId,SF.ProductId,SF.FileName,SF.FileDescription,

SF.FileSize,SF.FileVersion,SP.ProductName,SP.ProductVersion,SP.CompanyName

Order By SF.FileId ASC

List Total Number Of Records In The Software File Table

 

This query will return the number of software file records in the current database. Just for fun execute it to see just how many unique file executables you have in your database and be prepared for a shock

 

SQL Query:

 

Select Count(*) as 'Total Number Of Records'

From SoftwareFile

 

SQL Queries To Retrieve Serial Number Information

 

Here you will find SQL queries to allow you to retrieve All Systems Serial Numbers, The Serial Number For A Specified Machine and The Machine Name For A Specified Serial Number.

 

All Systems Serial Numbers

 

Select

SD.Name0 'Machine Name',

SB.SerialNumber0 'Serial Number'

From v_R_System SD

Join v_Gs_Pc_BIOS SB on SD.ResourceID = SB.ResourceID

Order By SD.Name0

 

The Serial Number For A Specified Machine

 

Select

SD.Name0 'Machine Name',

SB.SerialNumber0 'Serial Number'

From v_R_System SD

Join v_Gs_Pc_BIOS SB on SD.ResourceID = SB.ResourceID

Where SD.Name0 = 'Machine_Name'

Order By SD.Name0

 

The Machine Name For A Specified Serial Number

 

Select

SD.Name0 'Machine Name',

SB.SerialNumber0 'Serial Number'

From v_R_System SD

Join v_Gs_Pc_BIOS SB on SD.ResourceID = SB.ResourceID

Where SB.SerialNumber0 = 'Serial_Number'

Order By SD.Name0

 

SQL Query To Return Add OR Remove Programs Installed On A Specified Machine

 

This SQL Query will return the Add and Remove applications listed on an SMS client machine.

 

SQL Query:

 

Select

P.DisplayName0,

P.ProdId0,

P.Publisher0,

P.Version0

From v_Add_Remove_Programs P

Join v_R_System S on P.ResourceId = S.ResourceId

Where Name0 = 'MachineName'

SQL Query To Find What Users Are Using What SQL Application

 

This SQL Query will allow you to see which users are accessing or using SQL based applications on your SQL server except for the sa or System (NT Authority\System) accounts.

 

SQL Query:

 

Use Master

 

Select 

SP.SpId 'Session ID',

SP.Nt_UserName UserName,

SD.Name DatbaseName,

SP.LogiName LoginId,

SP.Program_Name App

 

From Sys.SysProcesses SP

Join Sys.SysDatabases SD on SP.DbId = SD.DbId

 

Where SP.Nt_UserName Not In ('sa', 'System')

And (SP.loginame <> 'sa')

 

Order By SpId

SQL Query To Retrieve The Distribution Points For A Site Server

 

This SQL query will list or write all of the Distribution Points for the server on which the script is executed on.

 

Other Available Roles:

 

SMS Distribution Point

SMS Management Point

SMS Site Server

SMS Site System

SMS SQL Server

SMS Component Server

SMS Reporting Point

SMS Server Locator Point

 

SQL Query:

 

Select

ServerName 'Site Server Name',

SiteCode 'Site Code',

RoleName 'Role'

From v_SystemResourceList

Where RoleName = 'SMS Reporting Point'

SQL Query Example To Show Row Numbers When Executing A Query

 

Here you will find a SQL query example of how to add row numbers to the results set window for your SQL queries.

 

SQL Query:

 

Select Row_Number()

Over (Order by Name0) as 'Row Count',

Name0

From v_R_System

Order by Name0

 

 

 

SQL Query To Locate SMS Clients That Have Generated New SMSID's

 

Here you will find a SQL query to list SMS client resources that have generated new SMS ID's along with their Resource ID and the timestamp that the change was generated.

 

In SMS a new SMSID (SMS Unique ID) or GUID (Globally Unique Identifier) is created when any of the following are changed on your client resources:

 

SmBIOS Serial Number

The Machine's System Identifier (SID) 

Any one of 10 different Hardware ID Properties

 

Additional Microsoft Information:

 

"The Hardware ID mechanism examines 10 computer properties and generates an ID of the Properties by combining hashes of the properties into a single ID. If a certain number of these properties change, the computer is considered, and a new SMSID is created. The number of properties is 3 out of 10 for a desktop computer and 2 of 7 for a laptop computer."

 

SQL Query:

 

Select Distinct

 

SYS.Netbios_Name0 'Machine Name',

Convert(VarChar(10),

SYS.SMS_UUID_Change_Date0, 101)  'Change Generated',

SYS.ResourceID ID

 

From v_R_System SYS

JOIN v_R_System NEW on SYS.SMS_Unique_Identifier0 = NEW.Previous_SMS_UUID0

 

Order By 'Machine Name'

List All Tables In A Specified Database

 

This SQL server script will display all of the SQL user type tables in a given database using DatabaseName and SqlQuery variables.

 

SQL Query:

 

Declare @DatabaseName SysName

Declare @SqlQuery VarChar(200)

 

-- Change SMS_XXX To The Database you wish to query

Set @DatabaseName='SMS_XXX'

Set @SqlQuery='Select Table_Name as Tables From ' + @DatabaseName + '.Information_Schema.Tables

 

Where Table_Type = ''Base Table'''

Exec (@SqlQuery)

 

 

Using A Select Case Statement To Substitute Existing Null Values

 

This SQL query will provide you with an example of how to change a query results NULL value to something more readable or understandable.

 

Replaces Null with Unknown:

 

Select

Name0,

Case

When User_Name0 is Null

Then 'Unknown'

Else User_Name0

End User_Name0

From V_R_System

 

Replaces Null With An Empty Field:

 

Select

Name0,

Case

When User_Name0 is Null

Then ''

Else User_Name0

End User_Name0

From V_R_System

SQL Query To Retrieve ConFigMgr Client Registration And Heartbeat Discovery Times

 

This SQL query will return the Client Registration and Heartbeat time stamps for your ConFigMgr 2007 resources.

 

SQL Query:

 

Select

CS.Name0 'Machine Name', 

Convert(VarChar(10), AD.AgentTime, 101)  'Last Update',

AD.AgentName

From v_Gs_Computer_System CS

Join v_AgentDiscoveries AD on CS.ResourceID = AD.ResourceId

Where AD.AgentName In

('MP_ClientRegistration', 'Heartbeat Discovery')

 

SQL Query Get Server Name And Date Stamp

 

This SQL script is part of a By Request script that I was asked to help a reader with that would allow them to get the current date as well as the SQL server name for one of their SQL 2005 Reporting Services scripts.

 

SQL Query:

 

Select

@@ServerName 'Server Name',

'Date Stamp:' = Convert(VarChar(10), GetDate(),101)

SQL Query To Count Operating Systems In A Specified Collection

 

This SQL Query will count the total number of client machine resources by their Network Operating System (NOS) name that are in a specified collection.

 

Note: If you would rather not type in the SMS consoles collection name you can change the line that reads: Where Col.Name = 'All Windows NT Systems' to: Where COL.CollectionId = 'SMS000CS'.

 

SQL Query:

 

Select

SD.Operating_System_Name_and0 NOS,

Count (SD.Operating_System_Name_and0) 'Total',

COL.CollectionId,

COL.Name

From v_R_System SD

 

Join v_FullCollectionMembership FCM on SD.ResourceID = FCM.ResourceID

Join v_Collection COL on FCM.CollectionID = COL.CollectionID

 

Where Col.Name = 'All Windows NT Systems'

Group By SD.Operating_System_Name_and0, COL.CollectionId, COL.Name

Order By SD.Operating_System_Name_and0, COL.CollectionId, COL.Name

 

List Tables With Primary Keys

 

Use the SQL script below to list all of your tables with Primary Keys present.

 

SQL Query:

 

Select Object_Name(Id) 'Tables With Primary Keys:'

From SysIndexes

 

Where (Status&2048)<>0

Order by Object_Name(id)

 

SQL Query To List SMS Resources From A Specified Subnet

 

Use the SQL script below to list all the SMS resources found on a specified subnet.

 

SQL Query:

 

Select

Netbios_Name0 'Machine Name',

IP_Addresses0 'Last IP Address'

 

From System_IP_Address_ARR

Join System_Disc MachineName

on System_IP_Address_ARR.ItemKey = MachineName.ItemKey

 

Where IP_Addresses0 Like '192.168.1.%'

And Netbios_Name0 is not Null

 

Order by Name0 Asc

SQL Query To Gather ConfigMgr Or SMS Site Server Information

 

This SQL query will list all of the Site servers (In the current database) as well as their Type (Primary or Secondary) , Site code, Site name and their Parent (ReportingSiteCode) site code to the active window

 

SQL Query:

 

Select 

ServerName,

'Site Type' = Case

When Type = 1 then 'Secondary'

Else 'Primary'

End,

SiteCode,

SiteName,

ReportingSiteCode,

InstallDir

From v_Site

Order By ReportingSiteCode

 

SQL Query To Find All SQL 2000 And SQL 2005 Servers From The SMS Database

 

This SQL query will return all of the Microsoft SQL 2000 and 2005 servers in the SMS database.

 

SQL Query:

 

Select Distinct

SD.Name0,

SP.ProductName

From System_Disc SD

Join vSMS_G_System_SoftwareProduct SP

On SP.ClientId = SD.ItemKey  

Where SP.ProductName = 'Microsoft SQL Server'

Or SP.ProductName

like 'Microsoft SQL 2005 Server%'

 

Count Number Of Machines With Specified Application Installed

 

This SQL server script will count the number of machines with a specified executable installed. Replace WinWord.Exe with the executable you want to get a machine count for and specify the file version: And SoftwareFile.FileVersion = 'X.X'

 

SQL Query:

 

Select Distinct

Count(SoftwareFile.FileName) as 'Total Count:'

From System_Disc

 

Join vSms_G_System_SoftwareFile as SoftwareFile

On SoftwareFile.ClientId = System_Disc.ItemKey

 

Where SoftwareFile.FileName = 'WinWord.Exe'

And SoftwareFile.FileVersion = 'X.X'

 

Using A SQL Query To See What Your Current SQL Logon Name Is

 

This simple little SQL query will allow you to see what user name you are currently logged on as on the SQL server from which the script is executed on.

 

SQL Query:

 

Select Original_Login() 'Logon Name'

 

--or

SELECT USER as [User],

      SESSION_USER as [Session_User],

      CURRENT_USER as [Current_User],

      SYSTEM_USER as [System_User],

      ORIGINAL_LOGIN() as [Original_Login()]

SQL Query To Find Table Dependencies

 

Use this SQL script to return the table dependencies such as stored procedures for your database objects.

 

You need to change the XType value referenced in the query below to find any of the objects in the following chart:

 

C = Check Vonstraint

D = Default or Default Constraint

F = Foreign Key Constraint

L = Log

Fn = Scalar Function

If = Inlined Table Function

P = Stored Procedure

Pk = Primary Key Constraint

Rf = Replication Filter Stored Procedure

S = System Table

Tf = Table Function

Tr = Trigger

U = User Table

Uq = Unique Constraint

V = View

 

SQL Query:

 

Select Distinct

SysObjects.Name 'Table Name',

Procedures.Name 'Stored Procedure'

 

From SysObjects

Join (SysObjects Procedures

Join SysDepends

on Procedures.Id = SysDepends.Id)

On SysDepends.DepId = SysObjects.Id

 

Where SysObjects.XType = 'U'

 

-- Change XType Values here using chart above

And Procedures.XType = 'P'

 

Group by SysObjects.Name,

SysObjects.Id,

Procedures.Name

 

Order by SysObjects.Name Asc

SQL Query To List Excluded Servers With RegRead

 

This SQL query will allow you to retrieve or list the machines in the excluded Servers list for your SMS server exclusions using the extended procedure RegRead.

 

SQL Query:

 

Exec Master..Xp_RegRead

'HKEY_LOCAL_MACHINE',

'Software\Microsoft\Sms\Components\Sms_Discovery_Data_Manager',

'ExcludeServers'

SQL Query To Find Specified Table Column Names

 

This script will allow you look for any specified column name from all of the user tables from within the current database object. This can be of particular interest to those wanting for example to find which SQL table holds the LastHWScan column.

 

SQL Query:

 

Set NoCount On

Declare @ColVar VarChar(25)

Set @ColVar = '%last%' -- String To Find

 

Select

SysObjects.Name 'Table Names:',

SysColumns.Name 'Column Names:'

 

From SysObjects, SysColumns, SysTypes

 

Where SysObjects.ID = SysColumns.ID

And SysColumns.xType = SysTypes.xType

And SysColumns.Name like @ColVar

 

Order by SysObjects.Name Asc

Set NoCount Off

 

Usage Examples:

 

Pattern Match

Set @ColVar = '%Last%'

Set @ColVar = '%last%time%'

 

Exact Match

Set @ColumnNames = 'Last'

 

 

Adding Machines To The ConfigMgr 2007 Exclusions List Using A SQL Script

 

This SQL query script will use the undocumented Extended Stored Procedure (Xp) RegAddMultiString to add a machine name to the ConfigMgr 2007 SMS Discovery Data Managers ExcludeServers list value. It will then use the Extended Stored Procedure RegRead to read the list of excluded machines and send the results to the active window.

 

Tip: This SQL Query will also work with SMS 2003 as long as Microsoft SQL Server 2000 or greater is installed as the backend database.

 

Note: This must be executed on the server that holds the exclusions list. To use the script change the line that reads MachineOne to the machine name you want to add.

 

SQL Query:

 

Exec Master..Xp_RegAddMultiString

'HKEY_LOCAL_MACHINE',

'Software\Microsoft\Sms\Components\Sms_Discovery_Data_Manager',

'ExcludeServers',

'MachineOne'

 

Exec Master..Xp_RegRead

'HKEY_LOCAL_MACHINE',

'Software\Microsoft\Sms\Components\Sms_Discovery_Data_Manager',

'ExcludeServers'

 

RegAddMultiString Syntax

 

The RegAddMultiString syntax is shown below:

 

Exec Master..Xp_RegAddMultiString

'Root Key',   

'Key',

'Value Name',

'New String Value'

Retrieving All SMS Server Components

 

Use the SQL script below to List all of your SMS server components.

 

To use the script you must replace 'XXX' with your three letter site code.

 

Declare @SiteCode NVarChar(128)

Set @SiteCode = 'XXX'

 

Select

RoleName,

Servername

 

From SysResList

Where SiteCode = @SiteCode

And ResourceType = 'Windows NT Server'

 

Order by RoleName

SQL Query To Gather Linked Servers Information

 

Use the SQL script below to gather OLE DB data source Linked Server Information.

 

SQL Query:

 

Use Master

 

Select

SrvName 'Servers Name',

SrvProduct 'Product Name',

DataSource 'OLE Data Source Value'

From SysServers

Where ProviderName = 'Sqloledb'

And IsRemote = 1

 

Order by SrvName Desc

 

Find Last Database Backup Time Stamp

 

Use the SQL script below to find your last database backup time.

 

SQL Query:

 

Use Master

Select (SubString(Database_Name,1,32)) 'Database Name',

Backup_Finish_Date 'Last Backup Time Stamp'

From Msdb.Dbo.Backupset

 

Retrieve SQL Server Days On Line Uptime

 

Use the SQL script below to return the number of days the specified SQL server has been online or when the Tempdb has been up since it is recreated when the server is Rebooted or restarted.

 

SQL Query:

 

Select

Filename,

DateDiff(D, CrDate, GetDate()) 'Days On Line'

From SysDatabases

Where Name = 'TempDb'

SMS Client Machines With Less Than 300 MB Free Disk Space On Their Primary Partition

 

This SQL script will return all of the SMS client machine names and their last logged on user name where their primary C: partition has less than 300 MB of remaining free disk space.

 

SQL Script:

 

Select

SD.Name0 'Machine Name',

SD.User_Name0 'User Name',

LD.FreeSpace0 'Free Space'

From v_R_System SD

Join v_Gs_Logical_Disk LD on SD.ResourceId = LD.ResourceId

Where LD.DeviceId0 = 'C:'

And LD.FreeSpace0 < 300

And SD.Client0 = 1

Query To Report Table Owners

 

Use the SQL script below to get a list of all of the tables and the associated table owners from your SQL Database.

 

SQL Script:

 

Select

Table_Name as 'Table Name',

Table_Schema as 'Database Owner'

 

From Information_Schema.Tables

Where Table_Type = 'Base Table'

 

order by Table_Name Asc

 

Query Client Status And GUID Information

 

This SQL server script will display all of the machines within the 'All Systems' Collection and return the client status results along with the GUID assignment for each machine.

 

SQL Query:

 

Select

Name 'Machine Name',

Domain 'Domain Name',

Sitecode 'Site Code',

 

'Client' = Case

When IsClient = 1 Then 'YES'

Else '<N0>'

End,

 

'Assigned' = Case

When IsAssigned = 1 Then 'YES'

Else '<NO> '

End,

 

SmsId

From _Res_Coll_Sms00001 -- All Systems Collection

 

Where IsClient = 1

SQL Query To Find Views To Use In SMS Web Reports

 

Use the SQL script below to list all of the Views in your SMS Database for SMS Web Reports.

 

SQL Query:

 

Select

Name 'Procedure Name',

Id 'Procedure ID',

CrDate 'Creation Date'

From SysObjects

Where Name like '%v%'

And XType = 'V'

 

Find And Add To Query Template

 

This script can be used to find column data to add to your SQL queries. This simple script can be used to find or locate column names from your SQL server that matches your search criteria.

 

Once the query has been executed simply drag and drop or otherwise copy the result set information that you want into the SQL query window without having to type the table and column names in. The script is written to take the work out of syntax formatting.

 

SQL Query:

 

Select Table_Name + '.'+Column_Name + ',' Result_Set

From Information_Schema.Columns

Where Column_Name like '%Advertisement%'

SQL Query To Find Machines Within Specified IP Subnet Range

 

This SQL query will allow you to find machines in a specified Subnet range using a Like statement for the subnets.

 

The script will use a series of And statements to ensure that only those resources that are client machines and are not decommissioned or obsolete are retrieved. The script will also show you how to combine the User Domain name and the last logged on user name as one string.

 

The script will then go on to show you how to retrieve the machines active local network adapters IP address using additional And statements to ensure that empty (Null) IP addresses or loopback IP addresses are not retrieved.

 

SQL Query:

 

Select   

SD.Name0 'Machine Name',

SD.User_Domain0 +  '\'  +  SD.User_Name0 'Last Logged On User',

NIC.IpAddress0 'IP Address'

 

From v_R_System SD

Join v_Gs_Network_Adapter_Configur NIC on SD.ResourceId = NIC.ResourceId

 

Where SD.Client0 = 1

And SD.Decommissioned0 = 0

And SD.Obsolete0 = 0

 

And NIC.IPAddress0 Is Not NULL

And NIC.IPAddress0  <> '0.0.0.0'

And NIC.IPAddress0 Like '192.168.1.%'

Or NIC.IPAddress0 Like '192.168.2.%'

Or NIC.IPAddress0 Like '192.168.3.%'

Or NIC.IPAddress0 Like '192.168.4.%'

Or NIC.IPAddress0 Like '192.168.5.%'

 

Order By SD.Name0 , NIC.IPAddress0

 

Display Machines With A Specified Percentage Of Free Local Disk Space

 

This SQL server script will display machines with a specified percentage of free local disk free space available.

 

Select

SD.Name0 'Machine Name',

LD.DeviceID0 Drive,

LD.FileSystem0 'File System',

LD.Size0 'Total Drive Size',

LD.FreeSpace0 'Total Free Space',

LD.FreeSpace0 *100/ LD.Size0 'Percent Free'

 

From System_Disc SD, Logical_Disk_Data LD

Where SD.ItemKey = LD.MachineId

 

And LD.Description0 = 'Local Fixed Disk'

 

/* Change <xx Below To The Percentage Of Free Disk Space You Wish To Find.

Examples: <05 Will Return 5% Free And <10 Will Display 10% Free. */

 

And LD.FreeSpace0 *100/ LD.Size0 <20

Order By SD.Name0 Asc

SMS Web Report To Get Current Site System Status

 

This SQL query was developed to be used as a Web Report to provide site admins with a quick overview of the site status for the following SMS roles: Client Access Point, Component Server, Distribution Point, Management Point, Reporting Point, Server Locator Point, Site Server and SMS SQL Server.

 

Note: To use the SQL script as a web report copy and paste the Name, Category, Description and of course the SQL statement shown below to the appropriate new web report boxes or modify to your liking as needed.

 

Name: Get Current Site System Status

 

Category: SMS Site – General

 

Description: Displays current site system status information for: Client Access Point, Component Server, Distribution Point, Management Point, Reporting Point, Server Locator Point, Site Server and SMS SQL Server.

 

SQL Statement:

 

Select Distinct

SiteCode,

Role,

'Status' = Case

When Status = 0 Then 'OK'

When Status = 1 Then 'Warning'

When Status = 2 Then 'Critical'

Else ' '

End

From v_SiteSystemSummarizer

SQL Query To Return Microsoft Licensed Product Information For A Specified Machine

 

This SQL query can be easily adapted to be used as an SMS web report to allow you to see Microsoft Licensed Product information for a specified machine.

 

It will include the following information: Microsoft Family Name, Licensed Product Name, Version, License Type and the Last Update timestamp as in the example below:

 

Microsoft Family Name: Office Professional     

Licensed Product Name: Office Professional 2003       

Version: 2003  

License Type: Microsoft Volume License         

Last Update: 2007-04-20 12:35:31.007

 

SQL Query:

 

Select Distinct

LIC.MlsFamilyName 'Microsoft  Family Name',

LIC.MlsProductName 'Licensed Product Name',

LIC.VersionCode Version,

LIC.LicenseTypeName 'License Type',

LIC.LastUpdated 'Last Update'

 

From  v_R_System SD

Join v_Gs_Installed_Software_Ms SW On SD.ResourceID = SW.ResourceID

Join v_Lu_MsProd LIC On SW.MPC0 = LIC.MPC

Where SD.Name0 = 'Machine_Name'

 

Group By LIC.MlsFamilyName, LIC.MlsProductName,

LIC.VersionCode, LIC.LicenseTypeName, LIC.LastUpdated

Order By LIC.MlsFamilyName

SQL Query To Retrieve Free Disk Space For SMS Distribution Point Servers

 

This SQL query will allow you to quickly view the percentage of free disk space for your SMS Distribution Point (DP) servers.

 

SQL Query:

 

Select Distinct

SD.Name0,

SR.RoleName,

LD.DeviceID0,

LD.FreeSpace0 * 100 /  LD.Size0 'Free Disk Space'

 

From v_R_System SD

Join v_Gs_Logical_Disk LD on SD.ResourceId = LD.ResourceId

Join v_SystemResourceList SR on SD.Netbios_Name0 = SR.ServerName

 

Where LD.DriveType0 = 3

and SR.RoleName = 'SMS Distribution Point'

SQL Query To Find Machines With A Specified Application Installed Using A Variable

 

This SQL query uses a column variable @ColVar much like my VBS scripts use an input dialog box where you can specify a file name to search for.

 

The script will use a series of And statements to ensure that only those resources that are client machines and are not decommissioned or obsolete are retrieved. The script will also show you how to combine the User Domain name and the last logged on user name as one string.

 

The script will then go on to show you how to retrieve the machines active local network adapters IP address using additional And statements to ensure that empty (Null) IP addresses or loopback IP addresses are not retrieved.

 

Note: Be sure to change File_Name.Exe with the file name you want to search for.

 

Tip: To enumerate machines that are installed to a specific site code add the additional And statement below at the end of the existing And statements where XXX is the three letter Site Code you want to enumerate:

 

And SC.SMS_Installed_Sites0 = 'XXX'

 

SQL Query:

 

Declare @ColVar VarChar(255)

Set @ColVar = 'File_Name.Exe'

 

Select Distinct

SD.Name0 'Machine Name',

SD.User_Domain0 +  '\'  +  SD.User_Name0 'Last Logged On User',

AC.IpAddress0 'IP Address',  

SC.SMS_Installed_Sites0 'Installed Site',

SF.FileName 'File Name',

SF.FileDescription Description,

SF.FileVersion Version,

SF.FilePath Location

 

From v_Gs_SoftwareFile SF

Join  v_R_System SD on SF.ResourceId = SD.ResourceId

Join  v_Ra_System_SmsInstalledSites SC on SD.ResourceId = SC.ResourceId

Join v_Gs_Network_Adapter_Configur AC on SD.ResourceId = AC.ResourceId

 

Where SF.FileName = @ColVar

And SD.Client0 = 1

And SD.Decommissioned0 = 0

And SD.Obsolete0 = 0

And AC.IPAddress0 Is Not NULL

And AC.IPAddress0  <> '0.0.0.0'

 

Order By SD.Name0

SMS SQL Queries To Use As Web Reports To Find Machines With A Static IP Address

 

Locating machines in your SMS database with a static assigned IP address is actually quite easily accomplished. The key is to find machines that are not using DHCP to retrieve their IP address. Once this has been specified you need to further specify that you want machines where the IP address is not empty or blank. If the Where DhcpEnabled0 = 0 and the And IpAddress0 Is Not NULL were not specified then you could potentially get results such as the one shown below:

 

Name0 = Machine1970 IPAddress0 = NULL

Name0 = Machine1970 IPAddress0 = 0.0.0.0

Name0 = Machine1970 IPAddress0 = 192.168.1.111

 

Basic SQL Query:

 

Select Distinct

Sys.Name0,

Nic.IPAddress0

From v_R_System Sys

Join v_Gs_Network_Adapter_Configur  Nic

On Sys.ResourceID = Nic.ResourceId

Where DhcpEnabled0 = 0

And IpAddress0 Is Not NULL

Order By Name0

 

Server SQL Query:

 

Select Distinct

Sys.Name0,

Nic.IPAddress0,

Nos.Caption0

From v_R_System Sys

Join v_Gs_Network_Adapter_Configur  Nic

On Sys.ResourceID = Nic.ResourceId

Join v_Gs_Operating_System Nos

On Sys.ResourceID = Nos.ResourceId

Where DhcpEnabled0 = 0

And IpAddress0 Is Not NULL

And Caption0 Like '%Server%'

 

Note: To find machines that are not servers yet have static IP addresses change the line that reads: And Caption0 Like '%Server%' To: And Caption0 Not Like '%Server%'

Retrieving Parent Child SMS Site Information

 

This query will return to you a brief overview of your SMS site hierarchy including child and parent relations as well as your current site status.

 

SQL Query:

 

Select

SiteServer 'Server Name',

SiteName 'Site Name',

SiteCode 'Site Code',

 

'Parent Site Code' = Case

When ReportToSite = '' Then '<None>'

Else ReportToSite

End,

Version 'Site Version',

 

'Site Type' = Case

When sitetype = 1 then 'Secondary'

Else 'Primary'

End,

 

'Current Status' = Case

When status = 1 then 'Active'

When status = 2 then 'Pending'

When status = 3 then 'Failed'

When status = 4 then 'Deleted'

Else 'Upgrade'

 

End

From Sites

SQL Query To Retrieve Basic Computer Hardware Information For A Specified Assigned Site Code

 

This SQL query will allow you to specify a site code (Assigned Site) and will return the following information for the resources that are assigned to the specified site as client resources:

 

Machine Name, User Name, Computer Manufacturer, Computer Type (i.e. Desktop or Laptop, etc), Asset Tag and Serial Number. If the asset tag or serial number is empty (Null) or contains the text 'No Asset Information' or 'Not Available' the results set will be blank.

 

SQL Query:

 

Select

SD.Name0 'Machine Name',

SD.User_Name0 'User Name',

SE.Manufacturer0 'Computer Manufacturer',

 

Case SE.ChassisTypes0

When 1 Then 'Other'

When 2 Then 'Unknown'

When 3 Then 'Desktop'

When 4 Then 'Low Profile Desktop'

When 5 Then 'PizzaBox'

When 6 Then 'Mini-Tower'

When 7 Then 'Tower'

When 8 Then 'Portable'

When 9 Then 'Laptop'

When 10 Then 'Notebook'

When 11 Then 'Handheld Device'

When 12 Then 'Docking Station'

When 13 Then 'All-In-One'

When 14 Then 'Sub-Notebook'

When 15 Then 'Space Saving'

When 16 Then 'Lunch Box'

When 17 Then 'Main System Chassis'

When 18 Then 'Expansion Chassis'

When 19 Then 'Sub-Chassis'

When 20 Then 'Bus Expansion Chassis'

When 21 Then 'Peripheral Chassis'

When 22 Then 'Storage Chassis'

When 23 Then 'Rack-Mount Chassis'

When 24 Then 'Sealed PC'

Else 'Unknown'

End 'Computer Type',

 

'Asset Tag' = Case

When SE.SmBiosAssetTag0 IS NULL Then ''

When SE.SmBiosAssetTag0 = 'No Asset Information' Then ''

Else SE.SmBiosAssetTag0

End,

 

'Serial Number' = Case

When SE.SerialNumber0 IS NULL Then ''

When SE.SerialNumber0 = 'Not Available'  Then ''

Else SE.SerialNumber0

End

 

From v_Gs_System_Enclosure SE

Join v_R_System SD on  SE.ResourceId = SD.ResourceId

Join v_RA_System_SMSAssignedSites SC on SD.ResourceID = SC.ResourceID

 

Where SD.Client0 = 1

And SC.SMS_Assigned_Sites0 = 'XXX'

 

Order By SD.Name0

SMS SQL Query To Use As A Web Report To Retrieve Machines Operating System Information

 

This SQL query can be used as a web report to allow you to view all the machines in the SMS database and their operating system information in a readable format where the Operating system (Caption) and Service Pack (SP) level (Csd Version)  are shown as one string as shown below:

 

Machine Name

Operating System

Machine1

Microsoft Windows XP Professional Service Pack 1

Machine2

Microsoft Windows XP Professional Service Pack 2

Machine3

Microsoft(R) Windows(R) Server 2003, Standard Edition Service Pack 2

Machine4

Microsoft(R) Windows(R) Server 2003, Enterprise Edition Service Pack 2

 

SQL Query:

 

Select Distinct

Sys.Name0 'Machine Name',

Nos.Caption0 + Space(1) + Nos.CsdVersion0 'Operating System'

From v_R_System Sys

Join v_Gs_Operating_System Nos

On Sys.ResourceId = Nos.ResourceId

Order By 'Machine Name'

Component Status Information For A Specified Site

 

This SQL query much like its counterpart in the SMS console will provide you with the component status for you site.

 

SQL Query:

 

Select

Summarizer_Components.SiteCode Site,

Summarizer_Components.MachineName  'Server Name',

Summarizer_Components.ComponentName Component,

 

Case Summarizer_Components.Status

When 0 Then 'OK'

When 1 Then 'Stopped'

When 2 Then 'Critical'

When 3 Then 'Unknown'

Else 'Unknown'

End As 'Current Status',

 

Case Summarizer_Components.State

When 0 Then 'Stopped'

When 1 Then 'Started'

When 2 Then 'Paused'

When 3 Then 'Installing'

When 4 Then 'Re-Installing'

When 5 Then 'De-Installing'

Else 'Unknown'

End As 'Current State',

 

Case Summarizer_Components.Type

When 0 Then 'AutoStarting'

When 1 Then 'Scheduled'

When 2 Then 'Manual'

Else 'Unknown'

End As 'StartUp Type'

 

From summarizer_components

 

-- Change xxx to the Three letter site code you wish to query.

Where Summarizer_Components.SiteCode = 'XXX'

Inserting Excel Spreadsheet Data Into An Existing SQL Database Table

 

This SQL script will provide you with an example of how to copy data from an Excel spreadsheet to an existing database table that you have specified. It is important to note here that the script needs to be executed from within the database where the Table_Name exists.

 

Notes: Change the C:\File_Name.xls to the local drive letter on your SQL server or specify the Server\Share UNC path to the spreadsheet. If the data is not on sheet 1 change Sheet1$ to the worksheet name you wish to use.

 

SQL Script:

 

Insert into Table_Name

Select *

From OpenRowSet

('MSDASQL', 'Driver=Microsoft Excel Driver (*.xls);

DBQ=C:\File_Name.xls',

'Select * From [Sheet1$]')

 

Published Sunday, July 15, 2007 8:14 AM by dhite

Filed under: SQL Queries

Retrieving SMS Site Boundaries Or Roaming Boundaries IP Subnet Information

 

The SQL scripts that follow will allow you to read your SMS site(s) boundaries defined IP subnets or the roaming site boundaries defined IP subnets for the server from which they are executed on.

 

Note: If you execute these scripts from an SMS Primary Parent site sever there is no need to execute them on child sites as the Parent sites database holds the information for the entire site.

 

Site Boundaries SQL Script:

 

Select

SiteCode,

IpSubnet

From SiteBoundaryIpSubnet

Order by SiteCode

 

Roaming Boundaries SQL Script:

 

Select

SiteCode,

IpSubnet

From RoamingBoundaryIpSubnet

Order by SiteCode

Reading An Excel Spreadsheet In A SQL Query Window

 

This SQL script will provide you with an example of how to read data from an Excel spreadsheet from with the SQL query window.

 

Notes: Change the C:\File_Name.xls to the local drive letter on your SQL server or specify the Server\Share UNC path to the spreadsheet. If the data that yu want to read is not on sheet 1 change Sheet1$ to the worksheet name you wish to use.

 

SQL Script:

 

Select *

From OpenRowSet

('MSDASQL', 'Driver=Microsoft Excel Driver (*.xls);

DBQ=C:\File_Name.xls',

'Select * From [Sheet1$]')

 

SQL Query To Retrieve A Machines Site Code

 

This SQL query will return the site code of a specified machine name from the all systems collection.

 

SQL Query:

 

Select 

SYS.Name0 'Machine Name',

COL.SiteCode 'Site Code'

From v_R_System SYS

Join v_FullCollectionMembership COL on SYS.ResourceId = COL.ResourceId

Where COL.CollectionID = 'SMS00001'

And SYS.Name0 = 'Machine_Name'

SQL Query To Count Computer System Manufacturer And Models

 

This SQL script will count the Manufacturer and Models for the resources in your SMS database for reporting purposes.

 

SQL Query:

 

Select 

Manufacturer00 Manufacturer,

Model0 Model,

Count (Model0) Counts

From Computer_System_Data

Group By Model0, Manufacturer00

Order By Manufacturer00

SMS Site Boundary Subnet Queries

 

Here you will find queries that will list all of the resources that are currently listed on your SMS server's specified subnet. There are two ways in which you can retrieve this information. One is using the "Like" statement for the IP addresses first 3 octets from the IP addresses view. The other uses the IP subnet from the IP subnets view.

 

IP Addresses View:

 

Select

SYS.Name0 'Machine Name',

IP.Ip_Addresses0 'IP Address'

From v_R_System SYS

Inner Join v_Ra_System_IpAddresses IP

On SYS.ResourceId = IP.ResourceId

Where  IP.Ip_Addresses0  Like '192.168.1.%'

 

IP Subnets View:

 

Select

SYS.Name0 'Machine Name',

SN.Ip_Subnets0

From v_R_System SYS

Inner Join v_Ra_System_IpSubnets SN

On SYS.ResourceId = SN.ResourceId

Where SN.Ip_Subnets0 = '192.168.1.0'

SQL Query To Locate The Machine Name For A Specified IP Address

 

This SQL query will allow you to enter an IP address and return the Machine name, last logged on user name and the machines IP address for the IP address specified.

 

Note: Change xxx.xxx.xxx.xxx To the IP address you wish to return the information from.

 

SQL Script:

 

Select

SD.Name0 'Machine Name',

SD.User_Name0 'User Name',

IP.IP_Addresses0 'IP Address'

 

From System_Disc SD

Join System_Ip_Address_Arr IP on SD.ItemKey = IP.ItemKey  

Where IP.IP_Addresses0 = 'xxx.xxx.xxx.xxx'

SQL Query To Locate The IP Address For A Specified Machine Name

 

This SQL query will allow you to enter a machine name and return the IP address, last logged on user name and the machines name for the machine specified.

 

Note: Change xxx to the machine name you wish to return the information from.

 

SQL Script:

 

Select

IP.IP_Addresses0 'IP Address',

SD.User_Name0 'User Name',

SD.Name0 'Machine Name'

 

From System_Disc SD

Join System_Ip_Address_Arr IP on SD.ItemKey = IP.ItemKey  

Where SD.Name0 = 'xxx'

SQL Query To Retrieve The Most Active SQL Tables

 

Use the SQL script below to find the most active SQL Tables by retrieving table changes.

 

SQL Query:

 

DBCC UpdateUsage(0)

With No_Infomsgs

 

Select SObject.Name as TableName,

SIndex.RowModCtr as TableUpdates

From SysIndexes SIndex

 

Join SysObjects SObject on SIndex.Id = SObject.Id

Where SObject.Type='U'

And RowModCtr Not Like '0'

And SIndex.IndId In (0,1)

 

Order by SIndex.RowModCtr Desc

 

Display Advertisement Package Status

 

This SQL server script will display the advertisement status for a particular advertisement for each machine contained within the advertised collection.

 

SQL Query:

 

Select Distinct

StatusMessages.MachineName 'Machine Name',

 

'Advertisement Status' = Case

When ID&0x0000FFFF = 3900 Then '<Distribution Server>'

When ID&0x0000FFFF = 30006 Then '<Console Advertised From>'

When ID&0x0000FFFF = 10000 Then 'Check OFR'

When ID&0x0000FFFF = 10001 Then 'Check PKG'

When ID&0x0000FFFF = 10002 Then 'Received'

When ID&0x0000FFFF = 10003 Then 'CmdLine Not Found'

When ID&0x0000FFFF = 10004 Then 'Invalid Exe Platform'

When ID&0x0000FFFF = 10005 Then 'Started'

When ID&0x0000FFFF = 10006 Then 'Failed'

When ID&0x0000FFFF = 10007 Then 'Failed'

When ID&0x0000FFFF = 10008 Then 'Complete'

When ID&0x0000FFFF = 10009 Then 'Successful'

When ID&0x0000FFFF = 10010 Then 'No Uninstall Found'

When ID&0x0000FFFF = 10011 Then 'Uninstall Exe Not Found'

When ID&0x0000FFFF = 10012 Then 'Uninstall Started'

When ID&0x0000FFFF = 10013 Then 'Uninstall Failed'

When ID&0x0000FFFF = 10014 Then 'Uninstall Failed'

When ID&0x0000FFFF = 10015 Then 'Uninstall Failed'

When ID&0x0000FFFF = 10016 Then 'Uninstall Success'

When ID&0x0000FFFF = 10017 Then 'Removal Key Not Found'

When ID&0x0000FFFF = 10018 Then 'Rejected By OS'

When ID&0x0000FFFF = 10019 Then 'Advertisement Expired'

When ID&0x0000FFFF = 10020 Then 'Slow Network'

When ID&0x0000FFFF = 10021 Then 'Machine Was Restarted'

Else '<No Status !>'

End

 

From StatusMessages

Join StatusMessageInsStrs on StatusMessages.RecordID = StatusMessageInsStrs.RecordID

Join StatusMessageAttributes on StatusMessages.RecordID = StatusMessageAttributes.RecordID

 

Where StatusMessageAttributes.AttributeID = 401

And StatusMessageAttributes.AttributeValue = 'XXX' -- Your Advertisement ID

And StatusMessages.SiteCode = 'XXX' -- Your Three Letter Site Code

 

Order by StatusMessages.MachineName Desc

Retrieving SMS Schema Information View Particulars

 

This query will show you all of the attributes for your SMS inventory groups.

 

Select ResourceType, GroupID, AttributeName, ColumnName, MaxColWidth, ValueType From v_GroupAttributeMap

 

This query will show you all of the Inventory groups by their architecture.

 

Select ResourceType, GroupID, DisplayName, InvClassName, InvHistoryClassName, MIFClass From v_GroupMap

 

This query will show you all of the classes and properties for the SMS report View

 

Select ViewName, ViewColumnName, IsStringType From v_ReportViewSchema

 

This query will show you all of the Attributes for each resource type.

 

Select ResourceType, PropertyDisplayName, ColumnName, ArrayTableName, MaxColWidth From v_ResourceAttributeMap

 

This query will show you all of the Resource Types available to the SMS database.

 

Select ResourceType, DisplayName, ResourceClassName From v_ResourceMap

 

This query will show you all of the Views contained in the SMS Schema.

 

Select Type, ViewName From v_SchemaViews

Machine ID To Machine Name

 

This query will return to you the NetBIOS name for each MachineID in your SMS site. This can be helpful when using the resource explorer to quickly and easily find the machines host name.

 

SQL Query:

 

Select

MachineID, Name as 'Machine Name'

From _Res_Coll_SMS00001

 

Where _Res_Coll_Sms00001.ArchitectureKey = 5

Order by Name ASC

 

Retrieve SQL Logins Information

 

Use the SQL script below to Return SQL Server SysLogins information from the Master table in a readable format for quick review.

 

SQL Query:

 

Select

LoginName 'Login ID Name',

DbName 'Default Database',

language 'Default Language',

 

'Account Type' = Case

When IsntName = 1 Then 'NT Account'

Else 'SQL Login'

End,

 

'Group Account' = Case

When IsntGroup = 1 Then 'Yes'

Else ' '

End,

 

'User Account' = Case

When IsntUser = 1 Then 'Yes'

Else ' '

End,

 

'SysAdmin Member' = Case

When SysAdmin = 1 Then 'X'

Else ' '

End,

 

'SecurityAdmin Member' = Case

When SecurityAdmin = 1 Then 'X'

Else ' '

End,

 

'ServerAdmin Member' = Case

When ServerAdmin = 1 Then 'X'

Else ' '

End,

 

'SetupAdmin Member' = Case

When SetupAdmin = 1 Then 'X'

Else ' '

End,

 

'ProcessAdmin Member' = Case

When ProcessAdmin = 1 Then 'X'

Else ' '

End,

 

'DiskAdmin Member' = Case

When DiskAdmin = 1 Then 'X'

Else ' '

End,

 

'DbCreator Member' = Case

When DbCreator = 1 Then 'X'

Else ' '

End

 

From Master..SysLogins

Query Name By Query ID View

 

This SQL server script will create a SQL view that lists all of the SMS administrator console queries that you have created. The view can serve as a quick reference for you when troubleshooting your SMS advertisements. The result set can also be saved to disk or printed to quickly and easily locate all of your console queries.

 

SQL Query:

 

If Exists (Select Table_Name From Information_Schema.Views

Where table_name = 'SMS_Query_Information')

Drop View SMS_Query_Information

Go

 

Create View SMS_Query_Information As

Select

Convert(char(10),QueryKey) as 'Query ID',

Convert(char(75),Name) as 'Query Name',

Comments As Comments

From Queries

Where QueryType = 3

Go

 

---Once you have the View created you can quickly view all of your created SMS ------------Administrator console queries by running the following from within the SQL query -----------------analyzer:

 

Select * From SMS_Query_Information

Converting SQL Table SMS Timestamps To Readable Formats For SQL Queries

 

This post will provide you with an example of how to convert SMS Coordinated Universal Time (UTC) time stamps to a readable format as opposed to the default UTC time output of yyyy-mm-dd hh:mm:ss.nnn.

 

The queries below will return the machine name, last hardware and last software inventory times for all of the resources in the System Discovery table. The Date SQL query will return just the Date stamp information and the Date-Time SQL query will return the Date and Time stamps in a 12 hour format to return AM or PM.

 

Note: For more information on the available Universal Time Conversion Codes for your SQL queries see the Universal Time Conversion Codes Chart at the end of this post.

 

Date SQL Query:

 

Select  

SD.Name0 'Machine Name',

Convert(VarChar(10), WD.LastHwScan, 105)  'Last Hardware Scan Date',

Convert(VarChar(10), SIS.LastUpdateDate, 101)  'Last Software Scan Date'

 

From System_Disc SD

Join WorkstationStatus_Data WD on SD.ItemKey = WD.MachineID

Join SoftwareInventoryStatus SIS on SD.ItemKey = SIS.ClientId

 

Date-Time SQL Query:

 

Select  

SD.Name0 'Machine Name',

Convert(VarChar(30), WD.LastHwScan, 109)  'Last Hardware Scan Date',

Convert(VarChar(30), SIS.LastUpdateDate, 131)  'Last Software Scan Date'

 

From System_Disc SD

Join WorkstationStatus_Data WD on SD.ItemKey = WD.MachineID

Join SoftwareInventoryStatus SIS on SD.ItemKey = SIS.ClientId

 

 

Universal Time Conversion Codes Chart

 

Code

Output

100

mon dd yyyy hh:mmAM (PM)

101

mm/dd/yy

102

yy.mm.dd

103

dd/mm/yy

104

dd.mm.yy

105

dd-mm-yy

106

dd mon yy

107

mon dd, yy

108

hh:mm:ss

109

mon dd yyyy hh:mm:ss.nnnAM ( PM)

110

mm-dd-yy

111

yy/mm/dd

112

yymmdd

113

dd mon yyyy hh:mm:ss:nnn (24 hour)

114

hh:mm:ss:nnn (24 hour)

120

Yyyy-mm-dd hh:mm:ss (24 hour)

121

Yyyy-mm-dd hh:mm:ss.nnn (24 hour)

126

Yyyy-mm-ddThh:mm:ss.nnn (24 hour)

130

dd mon yyyy hh:mm:ss:mmmAM (PM)

131

dd/mm/yy hh:mm:ss:mmmAM (PM)

Tracking Advertisements That Have Been Received But Not Started

 

This SQL query will provide you with an example that uses a SubSelect method to let you monitor all of the machines that have received a specified advertisement but have not yet stated the installation. The value added by this query is that it is good for advertisement tracking purposes.

 

To use this query you must Replace xxx With The Advertisement that You Wish To Track From Advertisements > Advertisement ID in the SMS console.

 

SQL Query:

 

Declare @ProgId NVarChar(128)

Set @ProgId = 'XXX'

 

Select

MachineName 'Received, Not Started'

 

From vStatusMessages Astat

Join StatusMessageAttributes att1

on Astat.RecordID = att1.RecordID

 

Where AttributeValue = @ProgId

And MessageID = 10002 -- Received Status Code

And MessageID <> 10003 -- Failures Status Code

And MessageID <> 10004 -- Failures Status Code

And MessageID <> 10021 -- Failures Status Code

And ModuleName = 'Sms Client'

 

And MachineName not in

(Select all MachineName

From vStatusMessages Astat

Join StatusMessageAttributes As att1

On Astat.RecordID = att1.RecordID

Where AttributeValue = @ProgId

And MessageID = 10005 -- Started Status Code

And ModuleName = 'SMS Client')

List Excluded Servers From The Discovery Data Manager Registry Key

 

The SQL server script below will retrieve the machine names contained in the Hkey_Local_Machine\Software\Microsoft\SMS\Components\Sms_Discovery_Data_Manager\ExcludeServers registry key

 

SQL Query:

 

Use Master

Go

 

-- ### Delete Temporary Table If It Already Exist ###

If Exists (Select * From dbo.SysObjects where id = Object_Id(N'[#ExcludedDevices]')

And ObjectProperty(Id, N'IsUserTable') = 1)

Drop Table [#ExcludedDevices]

Go

 

-- ### Create Temporary Table ###

Create Table #ExcludedDevices

(Value Nvarchar(255),

Data Nvarchar(255))

 

-- ### Insert registry information into the Temporary Table ###

Insert #ExcludedDevices

 

-- ### Execute Xp_RegRead to read the registry ###

Exec Master.dbo.Xp_RegRead

 

-- ### Registry key to enumerate ###

'HKEY_LOCAL_MACHINE', -- Root Key

'SOFTWARE\Microsoft\SMS\Components\SMS_DISCOVERY_DATA_MANAGER\', -- Key Path

'ExcludeServers', -- Key Value

'Values'

 

-- ### Counts the number of Excluded Devices in the registry key ###

Select Count(Data) As 'Total Excluded Devices : ' From #ExcludedDevices

Print ''

Go

 

-- ### Presents the regisrty key values (Machines)###

Select

Convert(Char(25), Data) As 'Excluded Device Names'

From #ExcludedDevices

Order By Data Asc

Set NoCount Off

 

-- ### Delete the Temporary Table ###

Drop Table #ExcludedDevices

Go

Finding Machines Last Hardware Inventory Scan With Additional Machine Info

 

The SQL query below will return the Machine Name, Model, Serial Number, Number Of Processors, Operating System Name, OS Version and the Last Hardware Scan timestamp.

 

SQL Query:

 

Select

SD.Name0,

CS.Model0,

SE.SerialNumber00,

CS.NumberOfProcessors00,

SD.Operating_System_Name_and0,

OS.Version0,

WD.LastHwScan

From System_Disc SD

Join Operating_System_Data OS on OS.MachineID = SD.ItemKey 

Join Computer_System_Data CS on CS.MachineID = SD.ItemKey 

Join System_Enclosure_Data SE on SE.MachineID = SD.ItemKey 

Join WorkstationStatus_Data WD on WD.MachineID = SD.ItemKey 

Query SMS 2.0 And SMS 2003 Sites Current Service Pack Level

 

Use the SQL script below to find your SMS sites service pack version level for SMS 2.0 or SMS 2003 sites.

 

SQL Query:

 

Select

SiteCode,

SiteServer,

SiteName,

 

'Version' = Case

When Version between '2.00.1239.0000' And '2.00.1239.0999'

Then 'SMS Version 2.0 RTM'

When Version between '2.00.1380.1000' And '2.00.1380.1999'

Then 'SMS Version 2.0 Service Pack 1'

When Version between '2.00.1493.2000' And '2.00.1493.2999'

Then 'SMS Version 2.0 Service Pack 2'

When Version between '2.00.1493.3000' And '2.00.1493.3999'

Then 'SMS Version 2.0 Service Pack 3'

When Version between '2.00.1493.4000' And '2.00.1493.4999'

Then 'SMS Version 2.0 Service Pack 4'

When Version between '2.00.1493.5000' And '2.00.1493.5999'

Then 'SMS Version 2.0 Service Pack 5'

When Version = '2.50.2726.0018'

Then 'SMS 2003 RTM'

When Version = '2.50.3174.1018'

Then 'SMS 2003 SP 1'

When Version = '2.50.4160.2000'

Then 'SMS 2003 SP 2'

Else 'Unable To Determine Service Pack!'

End

 

From Sites

Using SQL To Generate Random Passwords

 

Here you will find two queries that will allow you to make or create passwords that can be used either for temporary assignment or even to create permanent passwords.

 

SQL Query #1

 

Select

lower(char(65 + Right(Convert(varchar,rand()),1) +

Right(Convert(varchar,rand()),1)) +

char(65 + Right(Convert(varchar,rand()),1) +

Right(Convert(varchar,rand()),1)) +

char(65 + Right(Convert(varchar,rand()),1) +

Right(Convert(varchar,rand()),1) +

Right(Convert(varchar,rand()),1) +

Right(Convert(varchar,rand()),1)) +

Right(Convert(varchar,rand()),2) +

char(65 + Right(Convert(varchar,rand()),1)+

Right(Convert(varchar,rand()),1) +

Right(Convert(varchar,rand()),1) +

Right(Convert(varchar,rand()),1)) +

char(65 + Right(Convert(varchar,rand()),1)+

Right(Convert(varchar,rand()),1) +

Right(Convert(varchar,rand()),1) +

Right(Convert(varchar,rand()),1)) +

char(65 + Right(Convert(varchar,rand()),1)+

Right(Convert(varchar,rand()),1) +

Right(Convert(varchar,rand()),1) +

Right(Convert(varchar,rand()),1))) as 'New Password'

 

SQL Query #2

 

Select

Case Floor(Rand()*3)

When 0 Then Char(48 + Floor(Rand()*10))

When 1 Then Char(65 + Floor(Rand()*26))

Else Char(97 + Floor(Rand()*26))

End

+

Case Floor(Rand()*3)

When 0 Then Char(48 + Floor(Rand()*10))

When 1 Then Char(65 + Floor(Rand()*26))

Else Char(97 + Floor(Rand()*26))

End

+

 

Case Floor(Rand()*3)

When 0 Then Char(48 + Floor(Rand()*10))

When 1 Then Char(65 + Floor(Rand()*26))

Else Char(97 + Floor(Rand()*26))

End

+

 

Case Floor(Rand()*3)

When 0 Then Char(48 + Floor(Rand()*10))

When 1 Then Char(65 + Floor(Rand()*26))

Else Char(97 + Floor(Rand()*26))

End

+

 

Case Floor(Rand()*3)

When 0 Then Char(48 + Floor(Rand()*10))

When 1 Then Char(65 + Floor(Rand()*26))

Else Char(97 + Floor(Rand()*26))

End

+

 

Case Floor(Rand()*3)

When 0 Then Char(48 + Floor(Rand()*10))

When 1 Then Char(65 + Floor(Rand()*26))

Else Char(97 + Floor(Rand()*26))

End

As 'New Password'

Query SMS Client Machines and Return Their Client Type And Client Version

 

This SQL query will enumerate all of your SMS client machines and return their client type and client version.

 

To see all of the resources remark the following line out Where Client0 = 1 as:

 

--Where Client0 = 1

 

This will return all of the SMS discovered resources to allow you to address those machines marked as Device Client(s) or do not have the client installed or even have a version that is not recognized.

 

SQL Query:

 

Select

Name0 'Machine Name',

 

'Client Type' = Case

When Client_Type0 = 0 Then 'Legacy'

When Client_Type0 = 1 Then 'Advanced'

Else 'Device Client'

End,

 

'Client Version' = Case

 

-- SMS 2.0 Client Versions

When Client_Version0 between '2.00.1239.0000' And '2.00.1239.0999'

Then 'SMS 2.0 RTM'

When Client_Version0 between '2.00.1380.1000' And '2.00.1380.1999'

Then 'SMS 2.0 Service Pack 1'

When Client_Version0 between '2.00.1493.2000' And '2.00.1493.2999'

Then 'SMS 2.0 Service Pack 2'

When Client_Version0 between '2.00.1493.3000' And '2.00.1493.3999'

Then 'SMS 2.0 Service Pack 3'

When Client_Version0 between '2.00.1493.4000' And '2.00.1493.4999'

Then 'SMS 2.0 Service Pack 4'

When Client_Version0 between '2.00.1493.5000' And '2.00.1493.5999'

Then 'SMS 2.0 Service Pack 5'

 

-- SMS 2003 Client Versions

When Client_Version0 = '2.50.2726.0018'

Then 'SMS 2003 RTM'

When Client_Version0 = '2.50.3174.1018'

Then 'SMS 2003 Service Pack 1'

When Client_Version0 = '2.50.4160.2000'

Then 'SMS 2003 Service Pack 2'

Else 'Unable To Determine Service Pack!'

End

 

From System_Disc

Where Client0 = 1

Order by Client_Version0, Name0 Asc

Count SMS Installed Resources

 

This SQL query will return the count of SMS resources installed to your site server(s). It will also provide you with the Site server name, its site code, parent site and SMS site version.

 

SQL Query:

 

Select 

SS.ServerName 'Site Server',

SS.SiteCode 'Site Code',

SS.ReportingSiteCode Parent,

SS.Version Version,

Count(SC.SMS_Installed_Sites0) Assigned

From v_Site SS

Join v_RA_System_SMSInstalledSites SC

on SS.SiteCode = SC.SMS_Installed_Sites0

Group by SS.SiteCode, SS.ServerName, SS.ReportingSiteCode, SS.Version, SC.SMS_Installed_Sites0

Order by SS.SiteCode

SQL Query To Get A Specified Machines Manufacturer, Model And Processor Count

 

This rather simple SQL query will allow you to gather the manufacturer, model and Processor Count for a specified machine.

 

SQL Query:

 

Select

Name0 'Machine Name',

Manufacturer00 Manufacturer,

Model0 Model,

NumberOfProcessors00 Processors

From Computer_System_Data

Where Name0 = 'MachineName'

 

SQL Query To Get Client Machines Hardware Scan Age In Days

 

This SQL query will return the last hardware scan in days for all machines in the SMS database.

 

SQL Query:

 

Select  

SYS.Name0 'Machine Name',

DateDiff(D, WKS.LastHwScan, GetDate()) 'Last Hardware Scan Age'

From v_Gs_Workstation_Status WKS

Join v_R_System SYS on WKS.ResourceId = SYS.ResourceId

 

SQL Query To Retrieve Machines With A Specified Application Version

 

This SQL query will search Add and Remove Programs and return the machines and last logged on user name that has a specified application (Display Name) and Version installed.

 

SQL Query:

 

Select Distinct

v_R_System.Name0 'Machine Name',

v_R_System.User_Name0 'User Name',

v_Gs_Add_Remove_Programs.DisplayName0 'Display Name',

v_Gs_Add_Remove_Programs.Version0 Version

 

From v_R_System

Join v_Gs_Add_Remove_Programs on v_R_System.ResourceID = v_GS_Add_Remove_Programs.ResourceID

 

Where v_Gs_Add_Remove_Programs.DisplayName0 Like 'Microsoft .NET Framework 2.0'

Order By Name0

 

 

Note: You can also change the Where statement to use a variable that will allow you to use the query as a web report. This can be accomplished by changing the line to:

 

Where v_Gs_Add_Remove_Programs.DisplayName0 Like @DisplayName

 

SQL Query To Find Machines With USB Disk Drives

 

This SQL query will return all of the machines that have USB Disk Drives along with the last logged on user name.

 

SQL Query:

 

Select  

CS.Name0,

CS.UserName0,

HD.DeviceID0,

HD.InterfaceType0

From v_Gs_Computer_System CS

Join v_Gs_Disk HD on CS.ResourceID = HD.ResourceID

Where HD.InterfaceType0 = 'USB'

Order By HD.DeviceID0

 

If you have no need for the last logged on user name you can use this slightly simplified version:

 

Select

SystemName0,

DeviceID0,

InterfaceType0

From v_Gs_Disk HD

Where InterfaceType0 = 'USB'

Order By DeviceID0

Locating A Machine Name And Logon User Name For A Specified Serial Number

 

The query below will return the machine name and the last logged on user name for a specified hardware serial number.

 

Note: Replace XYZ123ABC with the serial number that you wish to search for.

 

SQL Query:

 

Select 

SD.Name0,

SD.User_Name0,

PB.SerialNumber00

From System_DISC SD

Join Pc_Bios_Data PB on PB.MachineId = SD.ItemKey

Where PB.SerialNumber00 = 'XYZ1234ABC'

 

Advertisement Status SQL Query

 

When you select "Advertisement Status" from the "System Status" leaf of the SMS console you are presented with an overview of all the current advertisements for your site(s). This SQL query will provide you with the same results as shown in the advertisement status leaf.

 

Note: The ScheduleToken is set to "Since Advertised".

 

SQL Query:

 

Select

OfferName Name,

Recieved,

Failures,

ProgramsStarted 'Programs Started',

ProgramsFailure 'Program Errors',

ProgramsSuccess 'Program Success',

ProgramsFailureMIF 'Program Errors',

ProgramsSuccessMIF 'Program Success (MIF)',

PkgName Package,

PkgProgram Program,

CollectionName 'Target Collection',

PresentTime 'Available After',

ExpirationTime 'Expires After',

OfferID 'Advertisement ID'

 

From vOfferStatusSummarizerRoot

Where ScheduleToken = '0001128000080008'

Order by OfferName

Locating Machines That Performed A Hardware Scan Within The Last Week

 

This SQL query will locate machines in your SMS inventory that have reported a hardware scan in the last week or 7 days.

 

Sql Query:

 

Select    

CS.Name0 'Machine Name',

WS.LastHwScan 'Inventory TimeStamp',

DateDiff(D, WS.LastHwScan,

GetDate()) 'Inventory Age In Days:)'

From WorkstationStatus_Data WS

Join System_Disc CS on WS.MachineId = CS.ItemKey

Where (DateDiff(D, WS.LastHwScan, GetDate()) >= 7)

Decommissioned DDR Processing Query

 

SMS 2003 SP2 adds the ability to send notification of client record deletion to the parent site and then propagate that notification up the hierarchy.

 

You can use the SQL query below to locate or find machines in your SMS database that have their Decomissioned DDR set.

 

SQL Script:

 

Select

 

SD.Netbios_Name0 Name,

SD.User_Name0 'Last Logon User Name',

 

'Decommissioned DDR Set' = Case

When SD.Decommissioned0 = 1 Then 'YES'

Else 'NO'

End

 

From System_Disc SD

 

Where SD.Decommissioned0 = 1

 

Return Machine Information Where A Particular Application Is Installed

This SQL query will return the following information Machine Name, Model, Last Hardware Scan, Operating System Name, OS Version, Number of Installed Processors, Software File Name and File Version where a specified application is installed.

 

SQL Query:

 

Select

SD.Name0,

CS.Model0,

WD.LastHwScan,

SD.Operating_System_Name_and0,

OS.Version0,

CS.NumberOfProcessors00,

SF.FileName,

SF.FileVersion

From SoftwareInventory

 

Join SoftwareFile SF on SoftwareInventory.ProductId = SF.ProductId

Join Computer_System_Data CS

Join System_Disc SD on CS.MachineID = SD.ItemKey

Join WorkstationStatus_Data WD on SD.ItemKey = WD.MachineID

Join Operating_System_Data OS on CS.MachineID = OS.MachineID

On SoftwareInventory.ClientId = SD.ItemKey

 

Where SF.FileName = 'FileName.Exe'

 

Group by

SD.Name0, CS.Model0, WD.LastHwScan, SD.Operating_System_Name_and0,

OS.Version0, CS.NumberOfProcessors00, SF.FileName, SF.FileVersion

Locating Machines Not Reporting Heartbeat Discovery In The Last Week

 

This SQL query will allow you to find or locate machines in your SMS database that have not reported a Heartbeat discovery record in the last week or seven days.

 

SQL Query:

 

Select

SD.Netbios_Name0,

A.AgentName,

DI.AgentTime

 

From System_Disc SD

 

Inner Join DiscItemAgents DI on SD.DiscArchKey = DI.DiscArchKey

Cross Join Agents A

 

Where A.AgentName = 'Heartbeat Discovery'

And DatePart (D,DI.AgentTime) >= 7

SQL Query To Find Obsolete Machines

Use this SQL query to find machines in your SMS database that are Obsolete along with information about the obsolete client machine(s)

 

SQL Query:

 

Select

SD.Netbios_Name0 Name,

 

'Obsolete' = Case

When SD.Obsolete0 = 1 Then 'YES'

Else 'NO'

End,

 

'Active' = Case

When SD.Active0 = 1 Then 'YES'

Else 'NO'

End,

 

'Client' = Case

When SD.Client0 = 1 Then 'YES'

Else 'NO'

End,

 

'Client Type' = Case

When SD.Client_Type0 = 0 Then 'Legacy Client'

When SD.Client_Type0 = 1 Then 'Advanced Client'

Else 'Device Client'

End,

 

SD.Client_Version0 'Client Version',

'Decommissioned DDR Set' = Case

When SD.Decommissioned0 = 1 Then 'YES'

Else 'NO'

End,

 

SD.Hardware_ID0 'Hardware ID',

SD.User_Domain0 'Account Domain',

SD.User_Name0 'Last Logon User Name',

SD.Operating_System_Name_and0 NOS,

SD.Resource_Domain_Or_Workgr0 'Resource Domain',

SD.Sms_Unique_Identifier0 'SMAS Unique Identifier',

Convert(Char(101), WD.LastHwScan) 'Last Hardware Scan Date',

Convert(Char(101), CS.TimeKey)  'Last Computer Time Stamp'

 

From System_Disc SD

Join WorkstationStatus_Data WD On WD.MachineID = SD.ItemKey 

Join Computer_System_Data CS On CS.MachineID = SD.ItemKey  

 

Where (SD.Obsolete0 = 1 AND SD.Active0 = 0)

SMS Infrastructure Server Information Query

 

This SQL query will allow you to find information about your Windows 2000 and Windows 2003 SMS infrastructure servers and return the specified information about each.

 

SQL Query:

 

Select Distinct  

SD.Netbios_Name0 'Machine Name',

 

'SMS Client' = Case

When SD.Client0 = 1 Then 'YES'

Else 'NO'

End,

 

'Client Type' = Case

When SD.Client_Type0 = 0 Then 'Legacy'

When SD.Client_Type0 = 1 Then 'Advanced'

Else 'Device Client'

End,

 

SD.Client_Version0 'Client Version',

SD.Resource_Domain_OR_Workgr0 'Domain',

 

'Operating System Version' = Case

When SD.Operating_System_Name_and0 Like '%5.2%' Then 'Microsoft Windows 2003'

When SD.Operating_System_Name_and0 Like '%5.1%' Then 'Microsoft Windows 2000'

Else 'Microsoft Windows NT'

End,

 

OS.BuildNumber0 'Build Number',

OS.CSDVersion0 'Service Pack',

IP.IP_Addresses0 'IP Address',

MA.MAC_Addresses0 'MAC Address',

CS.Manufacturer00 Manufacturer,

CS.Model0 Model,

SE.SerialNumber00 'Serial Number',

SE.SMBIOSAssetTag00 'Asset Tag'

 

From System_Disc SD

Join Operating_System_Data OS on SD.ItemKey = OS.MachineID

Join System_Ip_Address_Arr IP on SD.ItemKey = IP.ItemKey

Join System_Mac_Addres_Arr MA on SD.ItemKey = MA.ItemKey

Join System_System_Rol_Arr SR on SD.ItemKey = SR.ItemKey

Join Computer_System_Data CS on OS.MachineID = CS.MachineID

Join System_Enclosure_Data SE on OS.MachineID = SE.MachineID

 

Where SR.System_Roles0 Like 'SMS%'

Inactive And Obsolete Machines Query

 

Active

This data type is initially set to 1 (Yes) and is set to 0 (No) when the client health tools determines that the client failed its checks and finds that the client is either not in a healthy state or is no longer on the network.

 

Obsolete

This data type is initially set to 0 (No) and is set to 1 (Yes) when the site server determines that the client hardware ID has been updated or superseded by another record for the machine. If multiple records are in place having the same hardware ID value for the machine then the older records are then marked as obsolete.

 

PreviousSMSUUID

When the computer determines that the machines hardware has changed dramatically a new GUID is created for the computer and it marks the old record and the old GUID as obsolete.

 

SQL Query:

 

Select 

SD.Netbios_Name0,

SD.User_Name0,

SD.User_Domain0,

 

'Obsolete' = Case

When SD.Obsolete0 = 0 Then 'NO'

When SD.Obsolete0 = 1 Then 'YES'

Else ' '

End,

 

'Active' = Case

When SD.Active0 = 0 Then 'NO'

When SD.Active0 = 1 Then 'YES'

Else ' '

End,

 

SD.Client0,

SD.Client_Type0,

SD.Client_Version0,

SD.Hardware_ID0,

SD.Creation_Date0,

SD.SMS_Unique_Identifier0,

SD.Previous_SMS_UUID0,

SD.SMS_UUID_Change_Date0,

AN.AgentName,

DI.AgentSite

 

From System_DISC SD

Join DiscItemAgents DI On SD.ItemKey = DI.ItemKey

Join Agents AN On DI.AgentID = AN.AgentID

 

Where SD.Obsolete0 = 1

And SD.Active0 = 0

Finding Machines Without A Specific Application And Version Installed

 

By request script to find machines that do not have McAfee VirusScan Enterprise version 8 installed.

 

To find machines that do not have a specified application and a specific version installed you need to use the sub-select query with the "Not In" Keywords.

 

For example if you want to find all of the machines in your SMS site that do not have your latest antivirus application installed you might use the following query that is intended to find the machines that do not have McAfee VirusScan Enterprise version 8 installed.

 

Select

SD.Name0,

SD.User_Name0

From System_Disc SD

 

Where SD.Name0 Not In

 

(Select SD.Name0

From Add_Remove_Programs_Data

Where DisplayName00 = 'McAfee VirusScan Enterprise'

And Version00 = '8.0.0')

Deleting Machines Directly From The SMS Database

 

To delete an individual machine from the SMS database using the SMS console it is necessary to create a collection using the direct membership rule wizard or base your new collection on a newly created Query. The first method is slow and can be time consuming, the second option just doubles your work and it the least desired method for most people.

 

The other automatic means in which you can remove or otherwise delete the machine(s) from the SMS database is to let the SMS_SQL_MONITOR service automatically remove the machine after it has reached its predefined Site maintenance task 'Delete Aged Discovery Data' and 'Delete Aged Inventory History ' specifications if you have left it enabled. It is enabled by default and is set to 90 days. You can however change this to a more reasonable time period appropriate for your sites hierarchy if needed.

 

Below you will find a SQL query that will allow you to delete machines from the SMS database as the task "Delete Special" performs the removal process. It is important to note here that when you delete machines from a collection within the SMS console the machine is deleted from the database however the History table is not purged or removed. When you use the task Delete Special the machine is not only removed from the SMS database but the history for the machine is also deleted.

 

NOTE: You must uninstall the SMS client software to ensure that it does not report back in. If you are simply removing the machine name(s) from the SMS database because your site support staff has informed you that the machines were retired or re-imaged then this is not necessary. It is important to also note here that this is not a Microsoft supported means for deleting machines from the SMS database and should be used in a non production environment.

 

When you are done use the query in my earlier post entitled: 'Searching Your SQL Database For A Specified Column String' and search for the machine(s) that you just deleted to ensure that they have in fact been purged.

 

To delete multiple machines using the query that follows you can simply change the line that reads: Where Name0 = 'Machine_Name'  To the following: Where Name0 in ('Machine_One', 'Machine_Two') as in the Deleting Multiple Machines SQL Query found at the end of this post.

 

 

  • Deleting An Individual Machine SQL Query:

 

 

Insert DeletedMachines (SmsId)

 

Select IsNull(Sms_Unique_Identifier0,'')

From System_Disc

 

Where Name0 = 'Machine_Name'

And Sms_Unique_Identifier0 is not null

 

Delete System_Disc from System_Disc

Where Name0 = 'Machine_Name'

 

Delete System_Data from System_Data

Where Name0 = 'Machine_Name'

 

 

  • Deleting Multiple Machines SQL Query:

 

 

Insert DeletedMachines (SmsId)

 

Select IsNull(Sms_Unique_Identifier0,'')

From System_Disc

 

Where Name0 in ('Machine_One', 'Machine_Two')

And Sms_Unique_Identifier0 is not null

 

Delete System_Disc from System_Disc

Where Name0 in ('Machine_One', 'Machine_Two')

 

 

Delete System_Data from System_Data

Where Name0 in ('Machine_One', 'Machine_Two')

Searching Your SQL Database For A Specified Column String

 

In response to my post "Searching Your SQL Database for A Specified Column Name" many people have asked me if it is possible to go further into the SQL database to find not just a specified column header but actual SMS captured data such as an individual user or computer name.

 

To answer that question yes it is possible but it can become very complicated. We have to make use of Cursors to loop through tables and create temporary SQL tables to place all of the results into an array of sorts and then in turn enumerate that array to get the desired result set back from the query parser.

 

Note: In SQL server a Cursor, whether it is cursed or blessed by SQL DBA's, is simply a result set that allows you to recursively loop through elements in a row by row operation on a returned result set. Cursors must adhere to specific rules and must include the following flow: First you must declare or set the Cursor, then open the cursor to gather information, then fetch or grab information from it and then finally close or deallocate the cursor to terminate it.

 

To use the SQL query below change the line Set @Locator = '%Don Hite%' from %Don Hite% to the string that you want to search for. As was mentioned in my original post the percent symbols are set to function as wildcard placeholders. You can either retain the percent symbols or remove one or both of them as you wish.

 

To run or execute the SQL query below simply copy and paste the SQL query below into the SQL query analyzer (Isqlw.Exe from the start > run line) use the database dropdown arrow to select your SMS database change the Set @Locator =  to the keyword that you wish to locate and press the F5 keyboard shortcut to start the query parser.

 

SQL Query:

 

Declare @Locator VarChar(50)

Declare @Object Int

Declare @Column VarChar(50)

Declare @Qry NVarChar(500)

 

Set @Locator = '%Don Hite%'

Create Table #TableColumns

("Table Name" VarChar(50), "Column Name" VarChar(50))

 

Declare Table_Cursor Cursor For

Select Id From SysObjects

Where XType = 'U'

 

Open Table_Cursor

Fetch Next From Table_Cursor

Into @Object

 

While @@Fetch_Status = 0

Begin

 

Declare Column_Cursor Cursor For

Select SysColumns.Name

From SysColumns,SysTypes

Where SysColumns.Id = @Object

And SysColumns.XType = Systypes.XType

And Systypes.Name In ('char', 'nchar', 'nvarchar', 'varchar')

 

Open Column_Cursor

Fetch Next From Column_Cursor Into @Column

 

While @@Fetch_Status = 0

Begin

Set @Qry = 'Insert Into #TableColumns '

+ 'Select Distinct ''' + Object_Name(@Object) + ''', '

+ '''' + @Column + ''' '

+ 'From [' + Object_Name(@Object) + '] '

+ 'Where Exists (Select 1 From [' + Object_Name(@Object) + '] '

+ 'Where [' + @column + '] Like ''%' + @Locator + '%'') '

Exec Sp_ExecuteSql @Qry

Fetch Next From Column_Cursor Into @Column

End

 

Close Column_Cursor

DeAllocate Column_Cursor

Fetch Next From Table_Cursor Into @Object

End

 

Close Table_Cursor

DeAllocate Table_Cursor

 

Select "Table Name", "Column Name" From #TableColumns

Drop Table #TableColumns

 

Quick SMS Component Status Check

For those people that have only one SMS primary site server to manage opening the SMS administrations console and looking at the System Status leaf is usually not much of a time consuming chore. However if you have a parent site with several sites below it that task can start to become a taxing operation very rapidly.

 

The following SQL query will allow you to quickly look at your SMS sites component status messages and will allow you to see when a site has reached the Warning or Critical stage. This in turn will allow you to save some time performing your daily management tasks.

 

The Summarizer_Components Status SQL table has the Status column name set as a 4 byte integer where 0 is OK, 1 is Warning and 2 represents Critical. The tally interval is currently set to 0001128000100008 which is Since 12:00 AM. Below you will find the currently available Tally Intervals for the Summarizer_ComponentTallys.TallyInterval.

 

 

Since 12:00 AM

0001128000100008

 

Since 04:00 AM                                                      

0081128000100008

 

Since 08:00 AM                                                      

 0101128000100008

 

Since 12:00 PM                                                      

0181128000100008

 

Since 04:00 PM                                                      

0201128000100008

 

Since 08:00 PM                                                      

0281128000100008

 

Since Sunday                                                          

0001128000192000

 

Since Monday                                                          

00011280001A2000

 

Since Tuesday                                                          

00011280001B2000

 

Since Wednesday                                                    

00011280001C2000

 

Since Thursday                                                        

00011280001D2000

 

Since Friday                                                             

00011280001E2000

 

Since Saturday                                                         

00011280001F2000

 

Since 1st of month                                                    

000A470000284400

 

Since 15th of month                                                  

000A4700002BC400

 

Since site installation                                                

0001128000080008

 

 

You can also modify the SQL query below to flag only those sites where the Summarizer_Components Status is either OK, in a Warning or in a Critical state by changing the line  And SC.Status >= 1 to And SC.Status = 0, 1 or 2. The SQL query can also be modified further to see only those sites that have a specified state by changing the line And SC.Status to And SC.State and adding the State numeric value that you want to query for.

 

 

SQL Query:

 

Select   

SC.SiteCode,

SC.MachineName,

SC.ComponentName,

 

'SC.Status' = Case

When SC.Status = 0 Then 'OK'

When SC.Status = 1 Then 'Warning'

When SC.Status = 2 Then 'Critical'

Else ' '

End,

 

'SC.State' = Case

When SC.State = 0 Then 'Stopped'

When SC.State = 1 Then 'Started'

When SC.State = 2 Then 'Paused'

When SC.State = 3 Then 'Installing'

When SC.State = 4 Then 'Re-Installing'

When SC.State = 5 Then 'De-Installing'

Else ' '

End,

 

ST.Errors,

ST.Infos,

ST.Warnings

 

From Summarizer_Components SC

Join Summarizer_ComponentTallys ST

On SC.ComponentDataID = ST.ComponentDataID

 

Where ST.TallyInterval = '0001128000100008'

And SC.Status >= 1

 

Order by ST.Errors

 
I took the sourse of these SQL Qury's from the next link and Just kept in one Page....These SQL Querys are taken from the following link.... thanks to  author
 
Enjoy,
Paddy
 

 

 

Retrieve Machines IP Address, Default Gateway And MAC Address

SQL Query To Retrieve Machines IP Address, Default Gateway And MAC Address





To retrieve the IP address; Default Gateway and the Mac address for your SMS discovered resources.
This query has added logic that will enable you to filter out those machines that do not have a specified Default Gateway set as well as those machines that do not have a specified IP address set or have an IP address that is 0.0.0.0 which is typically the case for machines with multiple Network Interface Card's (NIC's) installed where the NIC is not in use.

SQL Query:

Select Distinct

SD.Name0,

IP.IpAddress0,

IP.DefaultIpGateway0,

IP.MacAddress0

From v_Gs_System SD

Join v_Gs_Network_Adapter_Configur IP

On SD.ResourceId = IP.ResourceId

Where IP.DefaultIPGateway0 Is Not NULL

And IP.IPAddress0 Is Not NULL

And IP.IPAddress0 <> '0.0.0.0'

Order By SD.Name0


Enjoy,
Paddy


SCCM 2007 Intelligently about the product

Welcome to an era of technology where a single application can manage your entire organizations infrastructure. Whether your organization is based on a single campus or distributed throughout the world, System Center Configuration Manager (SCCM) 2007 has the mechanics to provide your company with the tools needed to distribute software, operating systems, security updates, collect hardware and software inventory, has reporting and an array of other tools to effectively manage your organizations assets. Based on the current version of Systems Management Server (SMS) 2003, SCCM 2007 is an upgraded version which leverages newer technologies such as Windows Vista and Windows Longhorn Server to provide greater security throughout the organization. While SCCM 2007 is currently in its Beta 1 release, code named SMS V4, understanding the new features now will provide the foundation needed to either acquire or upgrade to SCCM 2007 when it is scheduled for release in mid 2007.


Windows Vista will soon become the industry standard for corporate workstation operating Systems. SCCM 2007 is designed to deploy Windows Vista from its built-in Operating System Deployment (OSD) feature. SMS 2003 currently does not support the deployment of Windows Vista because of differences in the WMI file format. Furthermore, the SCCM OSD is based on the Business Desktop Deployment 2007 (BDD) technology not found in SMS 2003. The BDD technology will allow for easier deployments based on wizards which will help streamline the process. The OSD will allow an organization to create an operating system image and deploy such image across the environment without the need for local support staff. Imagine a remote building with 500 windows XP workstations and being able to upgrade every system to Vista in a few hours. The potential for SCCM 2007 is staggering when one considers the possibilities. The OSD allows the administrator to create custom task sequences during the upgrade process and leverages on the User State Migration Tool (USMT) 3.0 to save current user files and profiles. Some of the changes in the USMT include new ScanState changes, LoadState command line options and the migration behavior is controlled by .xml files rather than .ini files. Deploying operation system images in SCCM 2007 will not only become an industry standard, but will allow for greater protection from security threats.


Many organizations deploy images with a baseline of security updates to thwart common threats. One task for administrators is to devise a patch strategy to update systems on a monthly basis. Once the baseline is deployed, a systematic approach of validating and testing new updates is required on a monthly basis. SCCM 2007 has been completely redesigned from the ground up. For those who have utilized the Inventory Tool for Microsoft Updates (ITMU) in SMS 2003, you are aware that patching operating systems is a time consuming project every month. The newly designed Software Updates section of the SCCM administrator console is a welcomed improvement. Software updates are now divided by operating system and applications such as Exchange and ISA server. Software updates are also easier to read and one can simply drill down on each update to find the information related to the update. SMS 2003 software updates had a few columns in the administrator console that told the number of compliant and requesting systems for each patch. SCCM 2007 not only tells the administrator the number of systems that are installed and required, but also how many systems that are not required. Further improvements to the console are columns for percentage of compliance, EULA, NAP Evaluation, date released and a revision date if applicable. With the constant threat of operating system viruses and bugs, it becomes increasingly important to patch computer systems. Network Access Protection (NAP) will also become an industry standard by which administrators will be able to deny access to organizational resources if not patched to a baseline deemed by a network administrator.


NAP gives an IT administrator the ability to create a policy(s) for security updates. Once a policy is created and enabled, systems will be required to apply such patch(s) before being able to access the corporate network resources. NAP is a new feature embedded into SCCM 2007 and leverages the NAP technology provided by Windows Server "Longhorn" which is also currently in the Beta stage of development. The integration of Longhorn and SCCM 2007 will provide the security administrators have long been waiting for. Network restriction and remediation is dependent on how the NAP policies are configured on the Windows Network Policy Server (WNPS). Once a NAP policy has been created, a simple view in the SCCM 2007 administrator console shows the number of systems that meet the policy. The introduction of WNPS is also considered a role in SCCM 2007. Roles are responsibilities of specific servers to provide a specific function in the SCCM hierarchy.


SCCM 2007 has two new roles which were not available in SMS 2003 called System Health Validator Points and State Migration Points. The System Health Validator point is the SMS site system role that runs on a Windows Network Policy Server (NPS). When using Network Access Protection in SCCM, it is needed to validate the statement of health from NAP-capable SCCM clients to produce a client health state of healthy or unhealthy, or an error condition that prevented the health state from being determined. This server role is tightly integrated with NAP and is required for policies to be received by clients. The state migration point (SMP) is used by Operating System Deployment when migrating user state and settings from one computer to another as part of the operating system image deployment. Just as one would capacity plan for traditional server roles, one must also plan when using SMP as a role and can be calculated in the same fashion a distribution point. New features are abundant with SCCM 2007 and roles are just the beginning.


The introduction of Wake on LAN (WOL) technology will reduce the need for third party WOL solutions. However, the WOL technology included with SCCM 2007 will only support direct broadcast. Direct broadcast will use the "magic packet" technology used by other vendors. Organizations that do not allow direct broadcast over routers will not be able to use the new technology. However, there are several third party vendors such as 1E that provide proxy solutions which will solve the problems associated with organizations that do not support direct broadcast. Network security is always a concern for any organization. SCCM 2007's new security model will be another welcomed feature.


SCCM will provide two types of security modes. The first mode will be an SMS 2003 compatibility security mode and the second will be a SCCM 2007 security mode which will enable functionality to manage clients over the Internet. In order to use the "internet facing" functionality of SCCM security mode, certificates will be required on all SMS server infrastructure and all SMS managed clients. To utilize SCCM security mode, you will need trusted certificates to be available on all server and managed nodes. You will need a PKI to do this. The "auto enrollment" capabilities provided by Active Directory and Certificate Services are a great way to do this. Despite the fact that there is not a true VPN solution developed into SCCM, Internet facing clients will still need to be able to validate themselves. Servers in the perimeter will need a method to validate "trust" of certificates from clients requesting access, and should be implemented in concert with a firewall like ISA server. Management Point and Distribution Point roles will need to be available to external clients. A great way to do this would be to have ISA server in the front end as an SSL termination point with the MP and DP server roles behind ISA server. As for internal support and functionality for the SCCM security mode, the certificate based security will work in a cross forest or workgroup scenario, but a PKI will be required and the certificate issuer will need to be trusted by the client. Microsoft has spent a great deal of time working on the security enhancements in SCCM and shows that trusts are beginning to become a standard in network security.


Desired Configuration Management (DCM) is the ability to define a configuration model and be notified of any drift or deviation from that desired configuration. DCM is intended to be an all-up settings compliance solution for the IT environment. DCM will utilize the Systems Definition Model to allow administrators to define "as desired" policy views of their environment from an Operating System, Application, or Business Policy perspective. It is designed to scale its focus from single settings on single nodes to broad policies across the entire IT organization.


The improvements to the SCCM 2007 administrator console are seen in every part of the tree. SCCM 2007 is required to run in the new MMC console, version 3.0. The introduction of the Action pane allows an administrator to execute functions quicker. The ability to drag and drop objects in packages, advertisements, reports and queries will make administration simpler. The update collection membership option has also been moved to a more appropriate location rather than having to traverse the menu. One frustration when working with collections in SMS 2003 is that only one resource can be selected at a time. In SCCM, multiple resources can be selected to quickly mange those resources. Despite the new features in the console, there are some upgrades to your current software that will have to be acknowledged if you use SMS 2003.


The Beta 1 refresh release of SCCM 2007 will co-exist in your current SMS hierarchy. Microsoft currently supports the use of SQL 2000 with both SMS 2003 and SCCM 2007; however, the Beta 2 release of SCCM 2007 will not support SQL 2000. Organizations will have to upgrade to SQL 2005 or create a new hierarchy using SQL 2005. For organizations that currently use SMS 2003, Microsoft recommends that SCCM 2007 sites that are a part of an existing SMS 2003 hierarchy be disjoined to start a new hierarchy independent of SMS 2003. When SCCM 2007 Beta 2 is released we expect more information on this subject.


Based on my initial experiences with SCCM, I believe this technology will become a standard in almost any organization. I do feel some of the console items could have been better developed and there should have been more development with the WOL technology, but based on what we have today in SMS 2003, I welcome the changes and improvements. Documentation on SCCM is lacking in the Beta version, but I would expect a lot more when the final release is shipped in 2007. Whether you are a seasoned SMS 2003 administrator or an early adopter of SCCM 2007, there is much to learn with the emerging technology. Deploying security updates and restricting access to network resources with NAP will surely become an industry standard. Deploying Windows Vista to sites will standardize your environment which will lead to more successful deployments of applications and security updates. We must continue to research SCCM 2007 as new betas are released and strive to understand how to best deploy this application in each unique environment.
 
Enjoy,
Paddy
 
Source of this Artical

 

Windows Server 2008 as a branch office server

Windows Server 2008 as a branch office server: Source of this Artical

Well, with Windows Server 2008 actually being released today I thought I’d put down in writing how I configured a server for one of our branch offices here. I decided that for a small office we’d need DHCP, DNS and a domain controller. However, this being a branch office with no IT function within it, this gave me the perfect opportunity to play with the Windows Server 2008 Read-Only Domain Controller (RODC) role within a Windows Server 2008 Core installation.
First of all, two things to note. Firstly, you must have a Windows 2008 Domain Controller within your environment. Secondly, if you have the Exchange 2003 tools installed on your DC (as we did!) these will no longer work with Windows 2008 - Exchange 2003 isn’t (and will never be) supported. However, Exchange 2007 SP1 is fully supported.


So first of all we need to get Windows 2008 in our current environment. This was really straightforward. Stick the Windows 2008 DVD in your current DC, browse to the Sources\Adprep folder and run:
adprep /forestprepadprep /domainprepadprep /rodc

After preparing your domain for Windows Server 2008, you can then either install a new domain controller or upgrade one of your current DCs. I chose to upgrade one of my DCs because I wanted to check out how well the upgrade process works (and because I’m a bit lazy too). It went without a hitch, apart from the aforementioned problem with the Exchange 2003 System Manager application. To be fair though this was totally my fault thanks to not reading the supported list of applications or even realising that it was installed on this server.
Another caveat to upgrading from Windows 2003 to 2008 is the Windows PowerShell. Windows 2008 will not upgrade a server with this installed; however it isn’t immediately clear how to remove this. PowerShell is actually listed as a Windows Update - so in Control Panel, Add/Remove Programs dialog box you will need to check the box at the top that says “Show Updates” and it’ll be displayed as a Windows Update towards the end of the list.
Anyway, there you go - you now have a Windows 2008 Domain Controller and you can start installing your Read-Only DC for your branch office. Again, the Windows 2008 installation is pretty straightforward - once you’ve done this, you’ll be presented with a nice command prompt when you log on. I’ve used this Technet page to help me through configuring my server.


So first off, you’ll probably want to set a new hostname.

This is pretty simple:
netdom RenameComputer %hostname% /NewName:%newname%
Next up, let’s get our DHCP server installed:
start /w ocsetup DHCPServerCore
The ‘/w’ command tells your command prompt to wait for the operation to finish. It’s not necessary, but I quite like to know when my installation has finished. Next, it’s important to realise that the DHCP service isn’t set to start automatically by default - so let’s change that:


sc config dhcpserver start= auto
Next up, we’ll need some kind of DNS service too:
start /w ocsetup DNS-Server-Core-Role
And finally, we’ll kick off the Domain Controller installation:
dcpromo /unattend:c:\unattend.txt


Now, notice that you need to provide an unattend.txt for the DCPROMO application. This is because Windows Core doesn’t have the DCPROMO GUI. Here’s what I used for my unattend.txt:
[DCInstall]AutoConfigDNS=YesConfirmGC=YesCriticalReplicationOnly=NoDisableCancelForDnsInstall=NoRebootOnCompletion=YesReplicaDomainInDNSName=your domain hereReplicaOrNewDomain=ReadOnlyReplicaReplicationSourceDC=your dc hereSafeModeAdminPassword=pick a restore mode passwordSiteName=site to install inUserName=user who has priveleges to add DCs to the domainUserDomain=user’s domainPassword=user’s password
Hopefully this will work as smoothly for you as it did for me. Finally, you’ll probably want to change the IP address settings on this machine ready for shipping to your branch office. You’ll firstly need to get a list of your interfaces:
netsh interface ipv4 show interfaces
Grab the IDx number of the card you want to configure, then whack in the following command:
netsh interface ipv4 set address name="%ID%" source=static address=%StaticIP% mask=%SubnetMask% gateway=%DefaultGateway%
Finally, you’ll need to add some DNS servers too:
netsh interface ipv4 add dnsserver name="%ID%" address=%DNSIP%index=1
Well, this is all I did to get a branch office up and running. However, for my next branch office I am probably going to look at enabling Hyper-V too and installing a Windows Server 2003 member server to run ISA Server 2006 in order to provide caching and internet access filtering. However, with this server being at a remote location and Hyper-V still in beta I didn’t feel this a prudent move right now.

Windows Deployment Services / RIS / OSD



The Windows Automated Installation Kit (WAIK) contains an update for Windows Server 2003 Service Pack 1 (SP1) Remote Installation Services (RIS) servers that enables the new Windows Deployment Services technology that will be part of Longhorn server for the deployment of WIM images over the network. The update contains components similar to those of RIS, including a Preboot Execution Environment (PXE) boot service and a Trivial FTP (TFTP) service.


When you install Windows Deployment Services, you'll choose one of the following three modes of operation:


Legacy. Provides only the RIS-style functionality of RISETUP and RIPREP images; uses the old OSChooser-style boot menu and old RIS management tools


Mixed. Supports RIS-style images and WIM image formats using both the old OSChooser-style boot menu and Windows Preinstallation Environment (WinPE). It uses both the RIS-style tools and new Windows Deployment Services management tools. During PXE boot, the client can select to use the OSChooser or PE option, depending on the OS required


Native. Supports WIM images only via PE boot OS. This is the only option for Windows Deployment Services running on Longhorn Server


In all scenarios for Windows 2003 SP1 deployment, you must install RIS prior to applying the Windows Deployment Services "hotfix" (it's only 2MB in size and forms part of Windows 2003 SP2).


The Windows Deployment Services hotfix can be found in the WDS folder of the WAIK download image. To install it, execute the Windows Deployment Services update for the server architecture (e.g., x86 or AMD64). After accepting the license agreement, the update will install with no input required but will require a server reboot. You can also run the installation from the command line, passing the /quiet argument so that no progress is displayed to screen and no input is needed. After rebooting to enable the new functionality around WIM files, run the command by using this syntax: wdsutil /initialize-server /reminst: as the following example shows: C:\Documents and Settings\Administrator>wdsutil /initialize-Server /reminst:"E:\RemoteInstall"


For RIS installations with RIS-style images, the server will be put in mixed mode; for servers with no RIS-style images, the server will be placed in native mode. Until you run the initialize-server command, you can't run the Microsoft Management Console (MMC) Windows Deployment Services snap-in.


The next steps include adding a PE boot image (which is supplied as part of the WAIK) and adding VISTA or Longhorn system images. Windows Deployment Services also has the ability to create a "discover" image, which is for computers that don't have PXE boot capabilities. It works in a similar fashion to the old floppy disk you used to use for RIS clients. This WIM image (which is then converted to an ISO file and burned to CD-ROM) contains the WinPE environment used by Windows Deployment Services, which, once booted, proceeds in the same manner as if you had obtained the WinPE over the network. You can also create a capture image that contains the Windows Deployment Services capture utility and can be used instead of the Imagex procedure.

-Paddy

Friday, August 8, 2008

Automatic Creation of SMS or SCCM 2007 Visio drawings

you can Simply Create Visio drawings of any combination of ConfigMgr 2007 and SMS 2003 Site Servers...

Click here to get the tool from source Web Site

Enjoy,
Paddy

SCCM 2007 utilities / Tools Software’s

Here you can find most of the updated tools / utilities Software’s for SCCM 2007

http://myitforum.com/cs2/files/folders/configmgr/default.aspx?PageIndex=1



Enjoy,
Paddy

SCCM Right Click Tools

This tools wll help you to work on Server and Client remote Agent action initiate.. some think like SMS 2003 Advance Client Action Tool

http://myitforum.com/cs2/blogs/rhouchins/0613ConfigMgrTools.zip


Enjoy,
Paddy

SCCM 2007 / ConfigMgr Client Troubleshooter Tool Download

Introducing - the ConfigMgr Client Troubleshooter!


If you attended Angie Stahl's presentation at MMS, you caught a sneak peak of the ConfigMgr Client Troubleshooter. The troubleshooter is an html application, which makes it fairly portable, and all the code can be viewed using your favorite text editor. Use the troubleshooter to help you diagnose ConfigMgr client issues. This tool has become priceless at my company, where it is used by the Service Desk and OnSite teams (as well as my team on a daily basis). There are two modes currently avaible for the troubleshooter, Single System mode and Batch Mode.

Take a look at the following figure for single system mode:

When you launch the troubleshooter, the local computer name appears in the first textbox - to query a remote computer, simply enter the desired computer name, and then click Analyze. When you click Analyze, the troubleshooter will perform several remote WMI queries to the desired system (so if you're Analyzing a system over the WAN, please be patient). ** Keep in mind that this is running in your user context, so you will only be able to query the information that you have the proper rights to query. (for example, a "standard user" does not have the rights to see the value for "Last Scan Pkg Version (WSUS)".
The following table describes the colors used in the troubleshooter:
Color
Description
Black
Not Checked - Verify information manually
Green
Good - passed checks. No issue found.
Yellow
Good, but non-standard. (e.g., Automatic updates set to "automatic" - everything will still work, but the setting is non standard.)
Red
Bad - Check Failed - Something is wrong and needs to be addressed.

BEFORE YOU BEGIN: Be sure to customize the troubleshooter (info below), and install the latest SysInternals Tools to your %windir% directory (the troubleshooter requires psservice and pskill.) Make sure you run the tools manually one time - you need to review and accept the license agreements.
To Customize the troubleshooter, edit the .hta file with your favorite text editor, and locate and modify the following lines near the beginning of the file:
Const intMaxDays =60 'display 60 days of advert historyConst intMinDiskSpace = 2 '2 gb is used as the minimum disk space requirementConst strCCMSetupSource = "\\MYSCCMServer\sccmclient" 'path to ccmsetup.exe - ccmsetup.exe will be copied to the local system for install.Const strCCMSetupArgs = "SMSSLP=mySLP FSP=myFSP" 'add proper command-line argument info for client installationConst strClientVersion = "4.00.5931.0001" ' use your "corporate standard" version number hereConst strDefaultAdvertID = "LAB20083" ' this is just a default advertisement ID, used for re-running mandatory advertisements
Additional information for some of the buttons you see on troubleshooter:
Button Name
Comments
Fix
The Fix button for each service listed in the troubleshooter will ensure that the service startup type is configured properly to run. It will also
AutoDiscover Site
Modifies WMI for the SMS Agent Host to autodiscover its assigned site, then restarts SMS Agent Host Service.
Force Site Assignment
Used to force a site assignment on a client.
Show Current Adverts
Shows advertisements currently assigned to the computer - You can see both mandatory installations, and Run Advertised Programs installations. You cannot see user-targeted advertisements.
ReRun Advertisement
Use this to re-run an existing mandatory advertisement on a client - you must specify the ADVERTISEMENTID.
Show Client Logs
Allows you to view client logs - **Note, this feature does not work properly when you' have launched the troubleshooter under alternate credentials, as this feature uses Windows Explorer.
Display Advert History
Displays advert history according to registry on target system.
Install Client
Uses the command-lines and source you specified in the .hta file to install the SCCM client.
Applicable Patches
Displays applicable patches according to most recent sw update scan.

And now, we move on to my personal favorite, Batch Mode. When you launch the troubleshooter, you'll notice a scroll bar on the right-hand side of the window. Scroll down to view the following Batch Mode options:

You probably feel by now that you're being buttoned-to-death. :) I agree - and that's one of the features that will be improved in the next version. Fortunately, depending on your role in your company, you may find that you use a lot of these buttons on a regular basis. Batch Mode is simple - add computer names to the text box - one per line, and then click the action that you would like to perform on each of those systems.
**Remember, you're actively querying each system in your list, which may take some time, and also required additional administrative privileges.
The following table provides a brief description of most of the actions currently available in batch mode scan:
Button
Action
Batch Mode Scan
Performs a scan very similar to the single-mode scan, but for each system in the batch mode textbox.
Batch Policy Refresh
Performs a Machine Policy and Evaluation cycle on each system.
Batch Force DDR
Forces each system to initiate a discovery data record.
Batch Re-Discover Site
Forces the client to initiate a rediscover (requires psservice.exe, and pskill.exe).
Batch Query for Advert
Allows you to enter an AdvertisementID, then searches each system to see if that advert exists.
Rem Uninstasll Files
Deletes setup files in the %windir%\system32 directory that that's over 180 days old.

For most of the actions in Batch Mode, the information will be available to be copy/pasted into Excel. The file c:\temp\clip.txt will also be created (if c:\temp\ exists), containing the same information copied to the clipboard - this is very helpful when you're in a terminal services session (I frequently have issues with copy/paste in Terminal Services), or when the system you run the troubleshooter from does not have Excel installed.

Download 2003 Troubleshooter and the SCCM 2007 Troubleshooter now.
I hope to get a more permanent place for the .html application, so that you can help improve it!
Hot Tips!
I often use Batch Scan Mode and paste the info into Excel, and use Auto Filters to divide and conquer based on trends.
Notice that some of the SMS/SCCM properties are different for SCCM - For example, the last security patch scan date/time is a different WMI class than the one used for SMS 2003. So if you use the SMS troubleshooter on a client that has been upgraded from SMS to SCCM, you will see incorrect data for "Last Scan Package Version", as the SMS version of the tool queries a different space in WMI than the SCCM version.
Please submit bugs and feature requests to ramseyg@hotmail.com.

Click her to go to the Source of this Artical

Remote Activation of SMS Agent on Client

Remote Activation of SMS Agent on Client


In an SMS enviroment you must have the SMS Agent running on the client or you can't do anything. In a strickly user enviroment this doesn't matter since the user can't turn it off, but if you have a user that has admin rights to his/her machine then they have the power to turn you off. Finding them is simple enough, look at the computers that haven't sent in an inventory in quite a while, heart beat or other options. The problem is getting that service restarted. Here is a vbscript that will turn the service back on for a number of computers.-------------------------Const SW_NORMAL = 1'change comps to match the number of computers in your arrayDim Comps(1) Comps(0)="computer1"Comps(1)="Computer2"for each strComputer in Comps strCommand = "net start ccmexec"Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2")Set objStartup = objWMIService.Get("Win32_ProcessStartup") Set objConfig = objStartup.SpawnInstance_objConfig.ShowWindow = SW_NORMALSet objProcess = objWMIService.Get("Win32_Process")intReturn = objProcess.Create (strCommand, Null, objConfig, intProcessID)'remark lines if you don't want to see the success or failure of the programIf intReturn <> 0 ThenWscript.Echo "Process could not be created." & _vbNewLine & "Command line: " & strCommand & _vbNewLine & "Return value: " & intReturnElseWscript.Echo "Process created." & _vbNewLine & "Command line: " & strCommand & _vbNewLine & "Process ID: " & intProcessID End IfNext

Source for this Post

----------------------------This is simple but effective. You can run it manually or set it as a Scheduled Task on the server.Remember you must have admin rights on the computer to run this, so we are talking about an local admin account or domain admin.

Tuesday, August 5, 2008

SCCM 2007 SP1/R2 & Asset Intelligence feature

Après l’annonce de Microsoft effectuée au MMS, concernant la sortie de Configuration Manager 2007 Service Pack 1 au mois de Mai (et non Juin comme annoncé à l’origine) et de la disponibilité de SCCM 2007 R2 au mois de juillet (plus d’information ici), Dan Boldo (Program Manager, System Center Asset & License Management Team) vient d’annoncer les nouveautés apportés par SCCM SP1 concernant AI. May, 2008: AI 1.5 will ship with Configuration Manager 2007 SP1
New UI to enable product catalog customizations as well as software license entry.
On-demand or scheduled asset catalog updates for SA customers.
Ability to import license information (both MS and 3rd party) that shows licenses utilized vs. licenses purchased.
New catalog with enhanced schema
Ci-dessous un historique de l’évolution de Asset Intelligence depuis l’achat de la société Asset Metrix, en 2006, à l’origine de cette fonctionnalité. May, 2006: AssetMetrix acquired
Offered comprehensive asset inventory and reporting services.
Comprehensive IP around Asset Intelligence (e.g. Taxonomy, Classification)
Significant Knowledge Base that had 70,000,000 software instances and over 350,000 software titles.
April , 2007: AI 1.0 ships with SMS 2003 SP3
Extends SMS inventory agent to collect additional artifact data.
New SMS reports that simplify asset & license reporting.
Semi-annual targeted updates planned with first already released.
November, 2007: AI 1.1 Ships with Configuration Manager 2007
Improved performance and reporting accuracy.
New reports on CAL utilization (user & device) for Windows Server (2000+) and Exchange (2003+).
Enhanced asset mgmt capabilities including hardware change reports and application usage reporting.
Message d'origine : http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=3275994&SiteID=17

SMS 2003 & SCCM 2007 Schema Extention

Prepare your environment for running SMS 2003 - Schema
Warning

It is advised to follow the procedure below, before any schema modifications are made, not just sms 2003 schema extentions. There are no known issues in making the SMS 2003 schema extensions.
This being said, keep in mind that
1) Every forest only has 1 Schema partition.
2) There is no such thing as an AUTHORITATIVE RESTORE for the schema partition.
These 2 things combined spell disaster if something did go wrong. If something does go wrong with the schema extension process and the schema gets replicated to all dc's.
If this happens you have two options
1) Hire a Microsoft PSS consoltant to help clean up your Active Directory Schema mess
2) Restore a backup of the Active Directory on All domain controllers in the Forest. All domain controllers have to be disconnected from the network during this recovery.
Neither of these seem to really appealing to me.

Proper Procedure
1. Locate the server that is the schema master
1. In a command prompt type regsvr32 schmmgmt.dll (You should get a message that the dll was registered succesfully)
2. Type mmc, and add the Active Directory Schema snap-in
3. Right Click Active Directory Schema and select Operations Masters
4. Take note of the current Schema master
2. Back up the schema master.
3. Disconnect the schema master from the network and do not reestablish the connection until the end of this procedure. (This means fysically removing the cable, do not just disable the network interface since some of the tools used later in the procedure require a functional tcp/ip stack.
4. On the schema master, insert the SMS 2003 SP2 Setup CD in the CD-ROM drive.
5. Open a command prompt, change to the CD-ROM drive, and change to the \SMSSETUP\BIN\I386 folder on the CD.
6. On the schema master, at the command prompt, type Extadsch.exe
7. After the preceding command has finished on the schema master, confirm that the preparation of the forest was successful. Review %SystemDrive%\ExtAdSch.log
8. Evaluate the information you gathered in the previous step and choose accordingly:
1. If extadsch.exe ran without errors, reconnect the schema master to the network and continue with the next step of this procedure.
2. If extadsch.exe ran but error messages provided instructions for additional steps to take, follow the instructions and then return to the confirmation process described in the previous step.
3. If extadsch.exe did not run successfully, restore the schema master from backup and investigate the corrective steps necessary so that extadsch.exe can be run successfully.
Important Note: Extending the Schema will trigger a FULL Global Catalog Synchronization between Windows 2000 Global catalog servers. Windows 2003 Global Catalog servers will use delta replication.
Happy Schema Extention,
Paddy

Sccm 2007 client agent deployment using Software updates

Sccm 2007 has a new client deployment method called Software update point based client installation. The idea behind Software update point based client installation is to publish the Sccm 2007 client as a critical update, and hence its name is installed from the Software update point. Most of you will probably now that Software Update management in Sccm 2007 integrates with Wsus 3.0 Sccm 2007 relies on Wsus to synchronize the catalog and to scan clients, but that's food for another post.
Why?

Why does sccm 2007 require a new installation method? What was wrong with the previous installation methods we had in sms 2003? To be honest, not much, but they all had their drawbacks. Let's just have a look at each of the installation methods and their drawbacks before we continue and see what Software update point based installation has in store for us.

Manual installation: This installation method lacks automation and requires the end-user to be a local administrator on the machine which is obviously a big NONO security wise.

Login script installation: Lacks from the same security issue as manual installation and is by consequence a NOGO.

Software Distribution based installation: Good installation method but this is often a chicken or egg kinda problem, you already need to have a software distribution mechanism out there for this to work.

Client Push Installation (Wizard): Great installation method but it has some requirements that could prove to be problematic in a real secure environment. It requires remote local admin privileges which is usually fine. But it also requires remote registry and access to the admin$ share. A secure environment should have file and print sharing disabled on desktops or laptops, or at the very least have them blocked by a personal firewall.

GPO based installation: Nice installation method with very modest requirements on the machine to be installed, but it suffers from its own drawbacks. The main problem with GPO based installation is that it is end-user driven. GPO's software installation only happens at logon or after a restart. Both events normally only happen after the end-user gave their user name and password or powered on the machine. If you have pesky users that just close their laptop lid in the evening and open it back up the next morning then your out of luck with gpo's. With todays more stable os's like Windows XP and Windows Vista It could take a pretty long time before the machine actually needs to be rebooted on the lan.

Software update based client installation: Superb installation method that mixes the benefits of GPO based installation with those of software distribution based installation. In other words it has pretty low requirements on the target machine, even lower as software distribution based installation as it does not require a software distribution solution in place and doesn't require the target machine to be in active directory. (You'll need a different way than adm templates to set the registry keys though). On top of that it offers a Schedule based installation which eliminates the end-user initiated drawback of gpo's. By the way if you install a newer version of the SCCM 2007 beta or install a Service pack after RTM you will be able to update your publication so that you can use this method to easily upgrade your existed install base to the new version.


How?

How do you get this to work? Remarkably easy actually.

STEP 1 Configure the Windows Update agent GPO:

Open a GPO
Go to Computer configuration\Windows Components\Windows Update
Configure the Configure automatic updates option, Set it to auto download and shedule the install
Choose your own schedule
Configure the Specify intranet microsoft update service location
Configure both options with the value http://Wsusserver

STEP 2 Import the SCCM-2007 adm template:

Download the adm template to configure SCCM 2007 client installation command line parameters http://www.blogcastrepository.com/files/folders/documents/entry15469.aspx
Open a GPO
In Computer Configuration Right-click on Administrative templates
Browse to the SCCM-2007 and add the template.
Go to Computer configuration\Windows Components\SCCM 2007\Software Update point client installation
Configure the command line with the parameters you want.

STEP 3 Publish the SCCM 2007 client (As documented in the SCCM 2007 help file)


To publish the Configuration Manager 2007 client to the WSUS server:


1. In the Configuration Manager console, navigate to System Center Configuration Manager / Site Database / Site Management / – / Site Settings / Client Installation Methods.
2. Right-click Software Update Point Client Installation, and click Properties.
3. To enable client installation, select the Enable Software Update Point Client Installation check box.
4. If the client software on the Configuration Manager 2007 site server is newer than that stored on the software update point, the Upgrade Client Package Version dialog box will open. You should click Yes in this dialog box to publish the most recent version of the client software to he software update point.
5. To finish configuring the software update point client installation, click OK.

Happy Client Deployement
Paddy,

SCCM 2007 Fallback Status Point (FSP)

Function

The Fallback Status Point is a new Site System role in Configmgr 2007 that serves 2 purposes.
The initial goal of the Fallback Status Point is to serve as a contact point for Configmgr 2007 clients in native security mode that cannot contact their Management Point because of certificate problems. As we will see in Chapter X “Security and Network Access Protection” native mode requires https and client certificates for communication with the Management Point, Distribution Point, Software Update Point and the State Migration Point. This certificate requirement opens up a potential issue where a client’s certificate gets damaged, deleted or corrupted in one way or another essentially orphaning the client from the Configmgr 2007 infrastructure. The Fallback Status Point can be the lifeline for those clients as it will accept S.O.S. state messages from clients that need administrative assistance to get back in working order.
The second purpose of the Fallback Status Point is to allow for monitoring the state of a client rollout from a central location, based on a bunch of Configmgr 2007 reports. Historically the previous versions of SMS used to have a blind spot during the client rollout. System administrators could analyze some individual logs at the client side but didn’t have a full view of the entire installation process from a central location. This made follow-up during the client rollout stage of an SMS project fairly labor intensive for these sysadmins. This lack of central view made it difficult to detect clients that for instance started, and potentially completed the installation but that did not get assigned to an SMS Site. The Fallback Status Point helps system administrators in a Configmgr 2007 environment to avoid these problems. Configmgr 2007 clients send state messages to their Fallback Status Point after successful deployment another one after successful Site assignment, giving you a detailed overview of your client rollout. This functionality obviously assumes that the client knows where to find his Fallback Status Point.
A Configmgr 2007 client can find the Fallback Status Point by querying Active Directory or because a specific Fallback Status Point was defined during the installation.
As you might have concluded by reading the function description of the Fallback Status Point this is not a mandatory Site System role. Although this role is not really required, it is strongly advised to install one, and depending on your setup the necessity for one might be greater than for other setups. If you plan to use Internet Based Client Management or plan to use Native Security Mode than having a Fallback Status Point is not a luxury.

Type of network traffic

Because Fallback Status Points serve, amongst other things, as the lifeline for clients with certificate problems, and are most notorious for their function in an internet based scenario, it should come as no surprise that the communication protocol of choice is http.

Scalability & Availability

Another interesting question is the placement of your Fallback Status Point(s). There are two approaches to this. The first one is to just put a Fallback Status Point in your Central Site at the top of your hierarchy. Given the fact that the amount of network traffic to the Fallback Status Point is fairly limited, and mainly happens during the initial client rollout, this approach is one approach that should work pretty well in most environments. Another approach that is worthwhile to investigate is to put Fallback Status Points in accordance with your administrative model. In other words, put a Fallback Status Point in every location where you have administrative personnel that will follow-up on client rollout and client health. This makes it easy for Site Administrators to keep an eye on their own environment’s client health and rollout.
Note: The Fallback Status Point cannot be installed on a system that already has a Site System role installed that requires https for its communication protocol.

The above note might influence your Fallback Status Point decision quite a bit. This obviously only impacts sites that operate in Native Security Mode, but you might still want to consider it in your designs to minimize the impact of security mode upgrades in the future. The reason that they cannot be co-located is that Configmgr 2007 installs all Site System roles in the same website. Configmgr 2007 has the option of installing in a different website than the default website, but this is a site wide setting, meaning that all Site Systems would then install their websites in this new “SMSWEB” website, which doesn’t solve our http/https problem. Although you could have separate virtual directories with different http/https settings this is generally not accepted as a good security practice. Conclusion, the Fallback Status Point is generally best installed on a machine separate from the Management Point, Software Update Point or Distribution Point which might increase the cost of having the Fallback Status Point locations based on your administrative model.

Security

Because the Fallback Status Point is most important in internet based client management, and is most likely to be installed in a demilitarized zone, it deserves some extra security attention. The Fallback Status Point is the only Site System in Native Security mode that allows anonymous http connections to be mode. Although all other Site Systems are fairly well-protected using https and by requiring mutual authentication based on client certificates, the Fallback Status Point, because of its function cannot have these stringent security requirements in place. This leaves the Fallback Status Point open for attack.

To mitigate the impact of any potential attack Configmgr 2007 has implemented two ways of mitigation. The first one was covered in the configuration section, this is the throttling of the amount of messages you are willing to accept for this Fallback Status Point. The default settings are rather loose, but you could easily trim these numbers down to something that is more in accordance with your environment. The second way of mitigating the impact of an attack on your Fallback Status Point is to make sure that the firewall blocks all traffic from the Fallback Status Point to the intranet. By configuring the option Allow only site server initiated data transfers from this site system as explained in the adding a Site System section, you can make sure that the Fallback Status Point operates in a pull-only mode. So even if the Fallback Status Point would rollover during an attack it cannot be used as a jumphost to attack the rest of the Configmgr 2007 infrastructure. With these two security precautions configured the Fallback Status Point becomes an uninteresting target for most hackers.

Microsoft System Center Configuration Manager 2007 On-Demand Webcasts

On-Demand Webcasts

TechNet Webcast: An Introduction to Microsoft Deployment Toolkit Tools (Level 200)
Original Air Date: May 5, 2008
Customer Rating:
TechNet Webcast: Configuration Manager 2007 and Network Access Protection (Level 300)
Original Air Date: May 14, 2008
Customer Rating:
TechNet Webcast: Configuration Manager SP1 and R2 Overview (Level 300)
Original Air Date: February 28, 2008
Customer Rating:
TechNet Webcast: Deploying and Upgrading to System Center Configuration Manager (Part 1 of 2) (Level 300)
Original Air Date: December 3, 2007
Customer Rating:
TechNet Webcast: Deploying and Upgrading to System Center Configuration Manager (Part 2 of 2) (Level 300)
Original Air Date: December 4, 2007
Customer Rating:
TechNet Webcast: Deploying Operating Systems with Configuration Manager 2007 (Part 1 of 2) (Level 300)
Original Air Date: March 14, 2008
Customer Rating:
TechNet Webcast: Deploying Operating Systems with Configuration Manager 2007 (Part 2 of 2) (Level 300)
Original Air Date: March 21, 2008
Customer Rating:
TechNet Webcast: Deploying Operating Systems with System Center Configuration Manager (Part 1 of 2) (Level 300)
Original Air Date: December 10, 2007
Customer Rating:
TechNet Webcast: Deploying Operating Systems with System Center Configuration Manager (Part 2 of 2) (Level 300)
Original Air Date: December 14, 2007
Customer Rating:
TechNet Webcast: Deploying Operating Systems with System Center Configuration Manager 2007 (Level 300)
Original Air Date: October 5, 2007
Customer Rating:
TechNet Webcast: Deploying System Center Configuration Manager 2007 (Level 200)
Original Air Date: July 2, 2007
Customer Rating:
TechNet Webcast: Deploying System Center Configuration Manager 2007 Clients (Level 300)
Original Air Date: July 6, 2007
Customer Rating:
TechNet Webcast: Desired Configuration Management in Systems Center Configuration Manager 2007 (Level 300)
Original Air Date: October 16, 2007
Customer Rating:
TechNet Webcast: Introduction to System Center Configuration Manager 2007 (Level 200)
Original Air Date: June 26, 2007
Customer Rating:
TechNet Webcast: Lite Touch Installation Using Microsoft Deployment Toolkit (Level 200)
Original Air Date: May 7, 2008
Customer Rating:
TechNet Webcast: Microsoft System Center Configuration Manager 2007: Deployment (Level 300)
Original Air Date: June 5, 2007
TechNet Webcast: Microsoft System Center Configuration Manager 2007: Managing Servers (Level 300)
Original Air Date: June 7, 2007
TechNet Webcast: New License Options for System Center Configuration Manager 2007 (Level 100)
Original Air Date: August 14, 2007
Customer Rating:
TechNet Webcast: New Tools to Streamline the Imaging and Deployment Process in Windows Server 2008 (Level 300)
Original Air Date: September 19, 2007
Customer Rating:
TechNet Webcast: Optimizing Desktop Management with System Center Configuration Manager and Microsoft SoftGrid Application Virtualization (Level 300)
Original Air Date: January 15, 2008
Customer Rating:
TechNet Webcast: Overview of System Center Configuration Manager 2007 (Level 300)
Original Air Date: October 1, 2007
Customer Rating:
TechNet Webcast: Software Distribution with System Center Configuration Manager (Level 300)
Original Air Date: December 13, 2007
Customer Rating:
TechNet Webcast: Software Update Management with System Center Configuration Manager (Level 300)
Original Air Date: December 6, 2007
Customer Rating:
TechNet Webcast: System Center Configuration Manager: The Datacenter (Level 300)
Original Air Date: November 6, 2007
Customer Rating:
TechNet Webcast: Zero Touch Installation Using Microsoft Deployment Toolkit and System Center Configuration Manager 2007 (Level 200)
Original Air Date: May 13, 2008
Customer Rating:

SCCM 2007 Resources

SCCM 2007 Resources

Sccm 2007 Toolkit
The new Configuration Manager 2007 toolkit is live. The toolkit comes with the following tools:

Client Spy - A tool to help troubleshoot issues related to software distribution, inventory, and software metering on Configuration Manager 2007 clients.


"This is the Advanced client spy you might now from the sms 2003 toolkit 2"
Policy Spy - A policy viewer to help review and troubleshoot the policy system on Configuration Manager 2007 clients.


"Policy spy is again a tool that was already available in the sms 2003 toolkit 2. It allows you to take a look at the content of the policies that a client has received. This is a GREAT troubleshooting resource, and a terrific tool if you want to do Sccm 2007 deep dives.
Trace32 - A log viewer that provides a way to easily view and monitor log files created and updated by Configuration Manager 2007 clients and servers. "The Sccm 2007 log viewer, and don't let anyone tell you otherwise! This beautiful gem make those Configuration manager logs really readable. Apart from making the logs more readable it also comes with an error lookup tool built-in that lets you convert error numbers to readable error messages. This error lookup tool accepts win32 errors in Decimal and hexadecimal (-2147024891 or 80070005) and Network error messages (53).
Security Configuration Wizard Template for Configuration Manager 2007 - An attack-surface reduction tool for the Microsoft Windows Server 2003 operating system with Service Pack 1 and Service Pack 2 (SP1 and SP2) that determines the minimum functionality required for a server's role or roles, and disables functionality that is not required.
"The template to lock your SCCM 2007 site systems air-tight"


DCM Model Verification - A tool used by desired configuration management content administrators for the validation and testing of configuration items and baselines authored externally from the Configuration Manager console. "DCM authoring assistant, I'll do a separate blog post on DCM in the near future, it wasn't my favorite feature in Sms 2003, were it was a feature-pack, and I wasn't too thrilled with it becoming an integral part of the product. After some recent new things I learnt about it though, I guess I will have to change my mind.


DCM Digest Conversion - A tool used by desired configuration management content administrators to convert existing SMS 2003 Desired Configuration Management Solution templates to Desired Configuration Management 2007 configuration items.
"For the few brave souls out their that decided to get their hands dirty using the Dcm feature pack for Sms 2003"


DCM Substitution Variables - A tool used by desired configuration management content administrators for authoring desired configuration management configuration items that use chained setting and object discovery.
"You know what, I don't know enough about DCM to understand what this does"

http://www.microsoft.com/downloads/details.aspx?FamilyID=948e477e-fd3b-4a09-9015-141683c7ad5f&DisplayLang=en

Configuration Packs
As mentioned in the description of the toolkit, I will do another post on DCM, but below you will find some configuration packs to use with DCM in Sccm 2007.
http://www.microsoft.com/technet/prodtechnol/scp/configmgr07.aspx

Microsoft Deployment
Microsoft Deployment has been released as well, this is the successor to the Business desktop deployment accelerator. A lot of the functionality that BDD had, was directly rolled into Sccm 2007. The main reason to use Microsoft Deployment in combination with Configuration manager 2007 according to me is the support for unknown "bare metal" computers, and potentially the dynamic selection of the userstate store depending on statesize, and available local storage. And a more flexible way to slip-stream package installs after the image has been deployed.
Download details- Microsoft Deployment
SCCM 2007 Documentation
The Configuration manager 2007 technical library has been updated with new content.
http://technet.microsoft.com/en-us/library/bb892811.aspx
SCCM 2007 Webcasts
There is a great bunch of Configuration Manager webcast available, and quite a few new ones are planned for the near future.
http://www.microsoft.com/events/series/technetmms.aspx?tab=webcasts&id=42364#42364
SCCM 2007 Virtual Lab(s)
We only have one Configuration Manager Virtual lab available for now, but I assume several new ones will be added over the next couple of months.
http://www.microsoft.com/events/series/technetmms.aspx?tab=virtuallabs

custom Configmgr 2007 admin console




Building a custom Configmgr 2007 admin console
The work that needs to be done in the Configuration manager 2007 admin console is often spread out amongst different team members. Not all of these team members require access to the full admin console. Most environments do configure the permission set in a somewhat restrictive member so that team members only have the permission they need, but what is often forgotten is building a custom minimal admin console with just access to the features people need.
This shouldn't be done from a security point of view, the additional security this brings is neglectable, but more from a usability point of view. It makes the admin console easier to use, and avoids access denied errors, or empty detail panes because someone clicks on a heading in the admin console for which he doesn't have permission.

Now how do you build such a custom Configmgr 2007 admin console you might ask.
Step 1) You launch mmc.exe
Step 2) In the File menu, you select Add/remove snap-in
Step 3) Add the system center configuration manager snap-in, and select the "Select console tree items to be loaded (custom)" radio button.

Step 4) Select the console tree items you want

Step 5) Click Next, Finish and Ok, below is a screenshot of the tree pane of the custom console I created

Step 6) Select "System Center Configuration manager" in the tree pane, right-click it and select "New Window from here"
Step 7) In the File menu select options
Step 8) Name your console "Custom Configmgr admin console"
Step 9) In the console mode select "User mode - Limited access, single window"
Step 10) Clear the checkbox for "Allow the user to customize view"
Step 11) Tick the checkbox for "Do not save changes to this console"
Step 12) In the file menu save your snap-in
Step 13) In the prompt about multiple windows being open click "Yes"

Step 14) Launch your customized mmc console and verify whether everything looks according to plans.
PS: a similar option was already available in sms.


--
Enjoy.

a step by step on how to build a base XP SP3 image in SCCM 2007

This post and subsequent posts will be a step by step on how to build a base XP SP3 image in SCCM.

I will be outlining not necessarily pointing out every click. Hopefully others will find this helpful. This assumes an understanding of SCCM and uses what is refereed to as a “Thin Image Strategy”.
Create a network access account, it only need be a domain user and its password should not expire. Add the account to the Computer Client Agent in the Client node under Site Settings
Import XP SP3 as an operating system Install Package.
Add a Distribution point to your new XP SP3 package created in step 1
Create the XP SP3 sysprep package in SCCM
The Deploy.cab included on the CD was not updated properly for XP SP3 so you must download a new version here.
Create a package that points at the extracted CAB file for its source
You do not need to create any programs for the package the build task sequence takes care of this
Add the package to a DP that can be used during your build
Create a package for the Config Mgr Client
Specify always obtain file from source directory
Usually here I create a share at \\SCCMSERVER\Souce$\SCCMClient.
Update the ccmsetup command line properties accordingly. Extensive information about command line properties on TechNet here.
Add the package to a DP that can be used during your build
Create a “Build and capture a reference operating system image” task sequence
Name the task sequence something appropriate like “Build & Capture Windows XP SP3 Gold Image”
Select the x86 boot image
Select the Operating System Package you created in step 1
Enter a product key
Set the local admin password to any password
Join a workgroup
Select the Config Mgr client you created in step 4
Don’t add any software to the base image
Set your image properties
Select a location to save the image and make sure you include the full path including the .wim extension
Enter an account with rights to write to the share
Finish up
Change the task sequence to use “Quick Format”
Right Click on the Task Sequence and choose Edit
Select the “Partition Disk 0″ step
Choose properties on the Default (Primary) partition and check the “Quick Format” option
Create a collection to which you will advertise the task sequence; I usually use "customer" Base Builds
Advertise the task sequence to the collection you created in step 7 as optional
Right click Task sequence and choose advertise, follow the wizard
Make sure you select the check box “Make this task sequence available to boot media and PXE”
If you are in test and your boundaries are not defined make sure you select “When no local distribution points are available, use remote distribution point”
Make sure you completed step 1
Ensure that you have the network and mass storage drivers to boot the device on the boot image and in the driver store (If you have to do this in the future you must update the PXE and standard DPs)
Add the appropriate boot images (x86 / x64) to the PXE and standard DPs
Allow the client to boot from PXE
If this client previously had an SCCM agent on it you just need to add the client to the collection you created in step 6
If this is a new client and SCCM is pre-R2 add the client manually
Add the client by right clicking the Computer Associations node under OSD and choosing “Import Computer Information”
Enter the Name of the computer
Enter the MAC and or SMBIOS GUID
Add the computer to the collection you created in step 7
Boot the device up to PXE and choose your task sequence. In less than an hour you should have the start of a great XP Image

Monday, August 4, 2008

pregnant women diet haemoglobin issues Options

http://groups.google.com/group/ms-technologies-ans-by-pavan/browse_thread/thread/4049a1df34452f6a


To eat well during pregnancy you must do more than simply increase how much you eat. You must also consider what you eat. Although you need about 300 extra calories a day — especially later in your pregnancy, when your baby grows quickly — those calories should come from nutritious foods, so they can contribute to your baby's growth and development. Why It's Important to Eat Well When You're Pregnant? Do you wonder how it's reasonable to gain 25 to 35 pounds (on average) during your pregnancy when a newborn baby weighs only a fraction of that? Although it varies from a woman to woman, this is how those pounds may add up: 7.5 pounds: average baby's weight 7 pounds: extra stored protein, fat, and other nutrients. 4 pounds: extra blood 4 pounds: other extra body fluids 2 pounds: breast enlargement 2 pounds: enlargement of your uterus 2 pounds: amniotic fluid surrounding your baby 1.5 pounds: the placenta Of course, patterns of weight gain during pregnancy vary. It's normal to gain less if you start out heavier and more if you're having twins or triplets — or if you were underweight before becoming pregnant. More important than how much weight you gain is what makes up those extra pounds. When you're pregnant, what you eat and drink is the main source of nourishment for your baby. Truthfully, the link between what you consume and the health of your baby is much stronger than once supposed. That's why doctors now say, for instance, that no amount of alcohol consumption should be considered safe during pregnancy. The extra food you eat shouldn't just be empty calories — it should provide the nutrients your growing baby needs. For instance, calcium serves make and keep bones and teeth strong. While you're pregnant, you still need calcium for your body, plus extra calcium for your developing baby. Similarly, you require more of all the essential nutrients than you did before you became pregnant. A Nutrition Primer for Expectant Mothers Whether or not you're pregnant, a healthy diet includes proteins, carbohydrates, fats, vitamins, minerals, and plenty of water. The U.S. government publishes dietary guidelines that can help you determine how many servings of each kind of food to eat every day. Eating a variety of foods in the proportions indicated is a good step toward staying healthy. Food labels can tell you what kinds of nutrients are in the foods you eat. The letters RDA, which you find on food labeling, stand for recommended daily allowance, or the amount of a nutrient recommended for your daily diet. When you're pregnant, the RDAs for most nutrients are higher. Here are some of the most common nutrients you need and the foods that contain them: Nutrient Needed for Best sources Protein cell growth and blood production lean meat, fish, poultry, egg whites, beans, peanut butter, tofu
Carbohydrates daily energy production breads, cereals, rice, potatoes, pasta, fruits, vegetables Calcium strong bones and teeth, muscle contraction, nerve function milk, cheese, yogurt, sardines or salmon with bones, spinach Iron red blood cell production (needed to prevent anemia) lean red meat, spinach, iron-fortified whole-grain breads and cereals Vitamin A healthy skin, good eyesight, growing bones carrots, dark leafy greens, sweet potatoes Vitamin C healthy gums, teeth, and bones; assistance with iron absorption citrus fruit, broccoli, tomatoes, fortified fruit juices Vitamin B6 red blood cell formation; effective use of protein, fat, and carbohydrates pork, ham, whole-grain cereals, bananas Vitamin B12 formation of red blood cells, maintaining nervous system health meat, fish, poultry, milk (Note: vegetarians who don't eat dairy products need supplemental B12) Vitamin D healthy bones and teeth; aids absorption of calcium fortified milk, dairy products, cereals, and breads Folic acid blood and protein production, effective enzyme function green leafy vegetables, dark yellow fruits and vegetables, beans, peas, nuts Fat body energy stores meat, whole-milk dairy products, nuts, peanut butter, margarine, vegetable oils (Note: limit fat intake to 30% or less of your total daily calorie intake) Scientists know that your diet can affect your baby's health — even before you become pregnant. For example, recent research shows that folic acid helps prevent neural tube defects (including spina bifida) from occurring during the earliest stages of fetal development — so it's important for you to consume plenty of it before you become pregnant and during the early weeks of your pregnancy. Even though lots of foods, particularly breakfast cereals, are fortified with folic acid, doctors now encourage women to take folic acid supplements before and throughout pregnancy (especially for the first 28 days). Be sure to ask your doctor about folic acid if you're considering becoming pregnant. Calcium is another important nutrient for pregnant women. Because your growing baby's calcium demands are high, you should increase your calcium consumption to prevent a loss of calcium from your own bones. Your doctor will also likely prescribe prenatal vitamins for you, which contain some extra calcium. Your best food sources of calcium are milk and other dairy products. However, if you have lactose intolerance or dislike milk and milk products, ask your doctor about a calcium supplement. (Signs of lactose intolerance include diarrhea, bloating, or gas after eating milk or milk products. Taking a lactase capsule or pill, or using lactose-free milk products may help.) Other calcium-rich foods include sardines or salmon with bones, tofu, broccoli, spinach, and calcium- fortified juices and foods. Doctors don't usually recommend starting a strict vegan diet when you become pregnant. However, if you already follow a vegetarian diet, you can continue to do so during your pregnancy — but do it carefully. Be sure your doctor knows about your diet. It's challenging to get the nutrition you need if you don't eat fish and chicken, or milk, cheese, or eggs. You'll likely need supplemental protein and may also need to take vitamin B12 and D supplements. To ensure that you and your baby receive adequate nutrition, consult a registered dietitian for help with planning meals. Food Cravings During Pregnancy You've probably known women who craved specific foods during pregnancy, or perhaps you've had such cravings yourself. Researchers have tried to determine whether a hunger for a particular type of food indicates that a woman's body lacks the nutrients that food contains. Although this isn't the case, it's still unclear why these urges occur. Some pregnant women crave chocolate, spicy foods, fruits, and comfort foods, such as mashed potatoes, cereals, and toasted white bread. Other women crave non-food items, such as clay and cornstarch. The craving and eating of non-food items is known as pica. Consuming things that aren't food can be dangerous to both you and your baby. If you have urges to eat non-food items, notify your doctor. But following your cravings is fine, as long as you crave foods and these foods contribute to a healthy diet. Frequently, these cravings diminish about 3 months into the pregnancy. Food and Drinks to Avoid During Pregnancy As mentioned earlier, avoid alcohol. No level of alcohol consumption is considered safe during pregnancy. Also, check with your doctor before you take any vitamins or herbal products. Some of these can be harmful to the developing fetus. And although many doctors feel that one or two 6- to 8-ounce cups per day of coffee, tea, or soda with caffeine won't harm your baby, it's probably wise to avoid caffeine altogether if you can. High caffeine consumption has been linked to an increased risk of miscarriage, so limit your intake or switch to decaffeinated products. When you're pregnant, it's also important to avoid food-borne illnesses, such as listeriosis and toxoplasmosis, which can be life- threatening to an unborn baby and may cause birth defects or miscarriage. Foods you'll want to steer clear of include: soft, unpasteurized cheeses (often advertised as "fresh") such as feta, goat, Brie, Camembert, and blue cheese unpasteurized milk, juices, and apple cider raw eggs or foods containing raw eggs, including mousse and tiramisu raw or undercooked meats, fish, or shellfish processed meats such as hot dogs and deli meats (these should be well- cooked) fish that are high in mercury, including shark, swordfish, king mackerel, or tilefish If you've eaten these foods at some point during your pregnancy, try not to worry too much about it now; just avoid them for the remainder of the pregnancy. If you're really concerned, talk to your doctor. About Fish. Fish and shellfish can be an extremely healthy part of your pregnancy diet — they contain beneficial omega-3 fatty acids, and are high in protein and low in saturated fat. But limit the types of fish you eat while pregnant because some contain high levels of mercury, which can cause damage to the developing nervous system of a fetus. Mercury, which occurs naturally in the environment, is also released into the air through industrial pollution and can accumulate in streams and oceans, where it turns into methylmercury. The methylmercury builds up in fish, especially those that eat other fish. Because canned albacore (or white) tuna and tuna steaks are generally considered to be higher in mercury than canned light tuna, the U.S. Food and Drug Administration (FDA) recommends that you eat no more than 6 ounces a week. A 2006 review by Consumer Reports, though, showed that some canned light tuna can contain levels of mercury even higher than that of white tuna. But the FDA maintains that the levels are safe if consumption of the fish is limited, and that the current recommendations should stand. It can be ...

Also..... Walnuts....... Sorry I forgot.. This helps Baby Mind to Grow up... And this make's baby's to remember everything in one word to say as” EkasanthaGrahi"

All Best,
Paddy

How to check the WMI repository before rebuilding it

How to check the WMI repository before rebuilding it
I've had some WMI repository repair tidbits stashed away in my e-mail that I was going to blog about sooner or later. I'm not sure if today is sooner or later, but I did have to go looking through my old e-mails to find these steps for a lab machine today, and figured that was a sign I should finally post this information to the blog. If you suspect that the WMI repository has been corrupted, before throwing in the towel and blowing it away you can/should try to repair it
I couldn't remember where I got these command lines so I had to go look them up again! Looks like if the repository can't be repaired, it will be recreated anyway: http://www.microsoft.com/technet/scriptcenter/topics/help/wmi.mspx
Of course, you could use the WMI Diagnosis Utility to check for WMI corruption, but I'm a pretty impatient person at heart and find that this is just faster for me. The steps when using these commands go kind of like this--check it, fix it and worst case replace it.
Anyway, to check the WMI repository for errors on a Server 2003 SP1 or SP2 systems, run the following command from command prompt:
rundll32 wbemupgd, CheckWMISetup
Once you've run that command, check the setup.log file located at: %windir%\System32\Wbem\Logs\Setup.log. Check for entries from today's date. If you find none, then WMI is probably OK and you should continue troubleshooting somewhere else. If however, you see an error message from today saying that it can't find a namespace then yes, your WMI repository does have issues and you should do the below:
rundll32 wbemupgd, RepairWMISetup
This will re-create your WMI repository minus any custom .mof additions that were implemented without the -autorecover switch.
For Windows XP SP2, use the following command to check for corruption, and repair if necessary:
rundll32 wbemgupgd, UpgradeRepository
For Windows XP SP1, the check and repair commands are below and function just like the Windows Server 2003, SP1 commands:
rundll32 wbemupgd, CheckWMISetup
and
rundll32 wbemupgd, RepairWMISetup

Happy WMI Check,
PaddyMaddy

Vbs Script To Repair A Remote SMS Client With Error Handling

Vbs Script To Repair A Remote SMS Client With Error Handling

This is a modified version of my original post from last year entitled: Vbs Script To Repair A Remote SMS Client with error handling provided for Advanced clients.

Note: After the script has executed review the CcmRepair log file to verify its success.

VBS Script:

On Error Resume Next

strComputer = InputBox("Enter Client Machine To Repair")
Set SmsClient = GetObject("winmgmts://" & strComputer & "/Root/Ccm:SMS_Client")

If Err <> 0 Then
MsgBox "Error: " & "(" & Err.Number & ") " & Err.Description

Else
SmsClient.RepairClient
MsgBox "Repair Is In Progress For " & UCase(strComputer)

End If