March 2007 - Posts

VBS Script To Write SMS Client Cache Configuration Information To Excel

 

This VBS script will take a list of SMS client machine names from a text file called MachineList.Txt and will write the following SMS cache configuration information to an excel spreadsheet:  The cache’s present location, current size and if it is currently in use.

 

For more information see my post entitled: The SMS Advanced Client Temporary Program Download Folder Cache here:

 

http://myitforum.com/cs2/blogs/dhite/archive/2007/03/24/the-sms-advanced-client-temporary-program-download-folder-cache.aspx

 

 

VBS Script:

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "Machine Name"

objExcel.Cells(1, 2).Value = "Location"

objExcel.Cells(1, 3).Value = "Size (MB)"

objExcel.Cells(1, 4).Value = "In Use"

 

On Error Resume Next

Set Fso = CreateObject("Scripting.FileSystemObject")

Set InputFile = fso.OpenTextFile("MachineList.Txt")

Do While Not (InputFile.atEndOfStream)

strComputer = InputFile.ReadLine

 

Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/ccm/SoftMgmtAgent")

Set colItems = objWMIService.ExecQuery("Select * from CacheConfig")

For Each objItem in colItems

objExcel.Cells(intRow, 1).Value = UCase(strComputer)

objExcel.Cells(intRow, 2).Value = objItem.Location

objExcel.Cells(intRow, 3).Value = objItem.Size

objExcel.Cells(intRow, 4).Value = objItem.InUse

intRow = intRow + 1

Next

Set colItems = Nothing

Set objWMIService = Nothing

Loop

 

objExcel.Range("A1:D1").Select

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

Posted by dhite | with no comments
Filed under:

VBS Script To Change A Remote SMS Clients Cache Size

 

This VBS script will take a local or remote machine name from an input box and then will prompt you to enter a Cache size in MB that you want to change the Cache size to. The script will then stop and then start the SMS Agent Host by Name (CCMExec) to apply the change without the need to restart the service manually as is required when modifying the cache.

 

For more information see my post entitled: The SMS Advanced Client Temporary Program Download Folder Cache here:

 

http://myitforum.com/cs2/blogs/dhite/archive/2007/03/24/the-sms-advanced-client-temporary-program-download-folder-cache.aspx

 

Note: The Put method (Put_) is designed to be used when you either create or update a WMI instance or a class object and writes the changes to the specified WMI repository.

 

VBS Script:

 

strComputer = InputBox ("Enter Machine Name")

intCacheSize = InputBox ("Enter New Cache Size (MB)")

 

Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/ccm/SoftMgmtAgent")

Set colItems = objWMIService.ExecQuery("Select * from CacheConfig")

 

For Each objItem in colItems

objItem.Size = intCacheSize

objItem.Put_ 0

 

MsgBox "The Cache On " & UCase(strComputer) & " Located At: " & objItem.Location & " Will Be Changed To: " & objItem.Size & " MB"

Next

 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Service Where Name = 'CCMExec'")

 

For Each objItem in colItems

objItem.StopService(strServiceName)

Wscript.Sleep 10000

objItem.StartService(strServiceName)

Next

 

MsgBox "Done"

 

Posted by dhite | with no comments
Filed under:

Granting SMS Web Reports Users Access To New Or Existing Views Using SQL Scripts

 

This article will provide you with an example of how you can grant Select permissions to the smsschm_users and webreport_approle accounts to a new or existing SMS view programmatically using a SQL query as opposed to using the SQL Server Management Studio.

 

If you have created a SQL view and referenced that view in a web report and the select permissions have not been applied for the smsschm_users and webreport_approle accounts you may receive the following error when executing your web report(s):

 

An error occurred when the report was run. The details are as follows:

SELECT permission denied on object 'View_Name', database 'SMS_XXX', owner 'dbo'.

Error Number: -2147217911

Source: Microsoft OLE DB Provider for SQL Server

Native Error: 229

 

If you already have an existing view created and you want to grant Select permissions to the smsschm_users and the webreport_approle accounts execute this command from within the query window of your SMS Database after changing View_Name to the name of your existing view:

 

Grant Select On View_Name To smsschm_users, webreport_approle

 

If you have not yet created your view use this script below as a template for creating new views to use as SMS web reports. The template script will first check for the presence of the specified view and if it is found the view will be deleted or dropped. Next the template will create the specified view and then grant the appropriate Select permission to the smsschm_users and the webreport_approle accounts:

 

If Exists (Select * From dbo.SysObjects Where ID = Object_ID(N'[View_Name]')

and ObjectProperty(ID, N'IsView') = 1)

Drop View View_Name

Go

 

Create View View_Name As

<Your_Sql_Query_Here>

Go

Grant Select On View_Name To smsschm_users, webreport_approle

Go

 

Note: Be sure to change all four instances of View_Name to the name of your view.

 

Using this template on a regular basis to create your views for using in your SMS web reports will ensure that you apply the appropriate Select permissions and will allow you to consistently create your views for the SQL database.  For example you have the following simple SQL query that will associate the System_Disc tables User_Name0 column with the User_Disc tables Full_User_Name0 column that you want to use as a web report:

 

Select

SD.Name0,

SD.User_Name0,

UD.Full_User_Name0

From System_Disc SD

Join User_Disc UD on SD.User_Name0 = UD.User_Name0

 

Using the SQL template above you would simply replace the line that reads <Your_Sql_Query_Here> with the SQL query example above as shown here:

 

If Exists (Select * From dbo.SysObjects Where ID = Object_ID(N'[View_Name]')

and ObjectProperty(ID, N'IsView') = 1)

Drop View View_Name

Go

 

Create View View_Name As

Select

SD.Name0,

SD.User_Name0,

UD.Full_User_Name0

From System_Disc SD

Join User_Disc UD on SD.User_Name0 = UD.User_Name0

Go

Grant Select On View_Name To smsschm_users, webreport_approle

Go

 

Then you can test the view from within the SQL query window by executing the following:

 

Select * From View_Name

 

From this point on it is just a matter of creating the web report as normal.

 

Posted by dhite | with no comments
Filed under:

Microsoft List Of Updates In Windows Server 2003 Service Pack 2

 

On Thursday March 22nd Microsoft published their List of updates that have been applied to the recently released Windows Server 2003 Service Pack 2. There are a number of significant and important updates included as well as some such as font updates that seem to me to merely occupy space. However somewhere out there someone along the line pointed out that “Some characters from End User Defined Character (EUDC) fonts do not appear correctly in Windows XP” and the fix was incorporated.

 

It is interesting to note in looking at the supported platforms below that Windows XP Professional x64 Edition is also supported. Is Microsoft going to make this the rule going forward that Service packs for Windows XP Professional x64 will be applied via the Windows 2003 server service packs rather than the XP service packs or is this just a one time event but I digress so I will cease?

 

Supported Platforms:

 

Windows Server 2003 All Editions (32-bit x86)

Windows Server 2003 Itanium-based Editions

Windows Server 2003 x64 Editions

Windows Server 2003 R2 Editions

Windows Server 2003 Storage Server R2 Edition

Windows Server 2003 Compute Cluster Edition

Windows Server 2003 for Small Business Servers R2 Edition

Windows XP Professional x64 Edition

 

List of updates in Windows Server 2003 Service Pack 2:

http://support.microsoft.com/kb/914962

 

 

Posted by dhite | with no comments
Filed under:

PowerShell Script To Export Installed Product Information To A CSV File

 

Use this PowerShell script to export a specified machine’s installed Win32_Product information to a Csv file.

 

PowerShell Script:

 

$MachineName = Read-Host "Enter Machine Name"

Gwmi -Name Root\Cimv2 -cl Win32_Product –Comp $MachineName |

Select Name, Version |

Export-Csv C:\Win32_Product.Csv –NoType

 

Posted by dhite | with no comments
Filed under:

The Spelling Alphabet

 

A spelling alphabet is a set of words which are used to represent the letters of the alphabet. It is particularly useful when reading serial numbers or product keys out loud to people either on the telephone or across the room where they do not have the ability to read your alphanumeric string.

 

Using the list below you can avoid any confusion when repeating simple or long complex alphanumeric stings to someone by replacing the word associated with the letter of the alphabet when speaking to others. For example this alphanumeric string: MOM2005 can be read as: Mike, Oscar, Mike 2, 0, 0, 5.

 

To have this reference available when the need arises you can copy and paste the spelling alphabet below into Word or Notepad then print it and place it in your office somewhere near your telephone.

 

A  =  Alpha

B  =  Bravo

C  =  Charlie

D  =  Delta

E  =  Echo

F  =  Foxtrot

G  =  Golf

H  =  Hotel 

I  =  India 

J  =  Juliet

K  =  Kilo

L  =  Lima

M  =  Mike

N  =  November

O  =  Oscar

P  =  Papa

Q  =  Quebec

R  =  Romeo

S  =  Sierra

T  =  Tango

U  =  Uniform

V  =  Victor

W  =  Whisky

X  =  X-ray

Y  =  Yankee

Z  =  Zulu

 

 

Posted by dhite | 4 comment(s)
Filed under:

Geronimo!

 

During WWII American paratroopers began the tradition of yelling Geronimo! after jumping out of airplanes. However Jumping and Geronimo do not really go hand in hand. Geronimo (1829-1909) was a Chiricahua Apache leader who died at Fort Sill Okalahoma at the age of 85 from pneumonia after he fell from his horse and lay on the ground all night.

 

The tradition has its origins in a 1939 movie called “Geronimo” that paratroopers had watched as they were beginning their paratrooper training in 1940. According to the legend after a group of paratroopers watched the movie at Fort Benning Georgia one in particular an Army private named Aubrey Eberhardt decided to shout Geronimo! as he was jumping from the pane the next day and the expression caught on.

 

Posted by dhite | 4 comment(s)
Filed under:

Copying myITforum Blog Scripts And Content Without Loosing The Original Formatting

 

Several folks have asked why they get poor results and loose all of the formatting when they attempt to copy and paste myITforum Blog content of the many code examples from my Blog in particular to use for their own.

 

As far as my Blog content is concerned the content is Microsoft Word compatible and you can copy and paste any of the content from my posts into Microsoft Word and not loose any of the layout formatting or syntax color highlighting. Then simply copy and paste the Microsoft Word document content into your favorite code editor or into notepad and save the file with the appropriate file extension and the format will be preserved without the extraneous blank line spaces.

 

For example if you find a particular Vbs or Sql script that you want to use or modify for your own purposes (Which I wholeheartedly encourage you to do) highlight the text just under the header which usually begins with VBS Script: or SQL Script: to the end of the script and copy and then paste the text into Word and then copy and paste the Microsoft Word content into notepad or other text based editor.

 

If you are using a news reader such as SharpReader or BlogJet you can use the same process from there as you can from the Blog pages themselves.

 

 

Posted by dhite | with no comments
Filed under:

Converting MOM 2005 Management Pack AKM Files To XML Files

 

The MOM 2005 Resource Kit (MOM2005ResKit.Msi) includes a command line utility in the Tools directory in a folder called “Convert Management Packs to XML” that will allow you to convert MOM Management Pack Binaries (AKM files) to XML format.

 

The Utility (Mp2Xml.Exe) only has two arguments ‘Input’ and ‘Output’ and is quite easy to use. However you must be aware that the default MicrosoftOperationsManager2005.Akm files which is originally 336 KB when converted to XML format will balloon into a whopping 1,826 KB XML file.

 

To convert your Management Pack Binaries to XML files use the following syntax:

 

Mp2Xml.Exe File_Name.Akm File_Name.Xml

 

For example create a batch file (Unless you like typing into a command prompt window) in the “Convert Management Packs to XML” directory folder with the following ConvertToXml.Bat Contents syntax and execute it:

 

ConvertToXml.Bat Contents

 

Mp2Xml.Exe "C:\Program Files\Microsoft Operations Manager 2005\Management Packs\MicrosoftOperationsManager2005.akm" "C:\Program Files\Microsoft Operations Manager 2005\Management Packs\MicrosoftOperationsManager2005.Xml"

 

When executed this particular batch file will take the MicrosoftOperationsManager2005.Akm file and convert in into a file called MicrosoftOperationsManager2005.Xml.

 

Posted by dhite | with no comments
Filed under:

The Office SharePoint Designer 2007

 

In a previous post on the Microsoft Office SharePoint Designer 2007 Free Trial Download we talked very briefly about the high level aspects of the MOSS Designer. Here we will go into a little more detail about this remarkable little application.

 

The best part of the application is that it allows you to create professional looking pages without the need to write a lot of code. For the lazy admins such as me this is most definitely a plus.

 

You can automate your processes for approving documents and ease the burned of your other collaboration tasks using the workflow designer. There is even the option for creating custom event notification. The reporting and tracking aspects can be quite useful as well by allowing you to make use of data views as well as forms that will allow you to aggregate data both local and remote to your MOSS site and use that data in your document libraries or other lists.

 

One of the best uses for the MOSS Designer is that you can download the New Application Templates for Windows SharePoint Services 3.0 and use the MOSS designer to further customize all 40 of them to your liking.

 

New Application Templates for Windows SharePoint Services 3.0

http://www.microsoft.com/technet/windowsserver/sharepoint/wssapps/templates/default.mspx

 

With the MOSS Designer you can also use Microsoft ASP.NET technology much like you can with Microsoft Visual Studio 2005 to fully customize your pages by adding menus and other controls to make your site truly standout.

 

Microsoft Office SharePoint Designer 2007 Free Trial Download

http://myitforum.com/cs2/blogs/dhite/archive/2007/03/11/microsoft-office-sharepoint-designer-2007-free-trial-download.aspx

 

Posted by dhite | with no comments
Filed under:

Monitoring SQL 2005 Performance Statistics With The DBCC SqlPerf Command

 

The SqlPerf Database Consistency Check (DBCC) command most of which is undocumented with the exception of the LogSpace option in the SQL Books On Line (BOL) can be used to monitor the performance statistics of your SQL 2005 database.

 

Here you will find brief descriptions and examples of each of the DBCC SqlPerf Commands to use on your SQL 2005 server.

 

DBCC SqlPerf (LogSpace)

 

The LogSpace option retrieves information about the transaction logs for all of the databases on the server and it writes the following: Database Name, Log Size (MB), Log Space Used (%) and Status.

 

Example: Exec ('DBCC SqlPerf (logspace)')

 

DBCC SqlPerf (UmsStats)

 

The UmsStats option retrieves information for your threads and it writes the following: Statistic and Value which includes statistic information on the following: Scheduler ID, Num users, Num runnable, Num workers, Idle workers, Work queued, Cntxt switches, Cntxt switches(idle), cheduler ID, Num users, Num runnable, Num workers, Idle workers, Work queued, Cntxt switches, Cntxt switches(idle), Scheduler Switches

and Total Work

 

Example: Exec ('DBCC SqlPerf (UmsStats)')

 

DBCC SqlPerf (WaitStats)

 

The WaitStats option retrieves information for the servers resources wait types and it writes the following: Wait Type, Requests, Wait Time and Signal Wait Time

 

Example: Exec ('DBCC SqlPerf (WaitStats)')

 

DBCC SqlPerf (IoStats)

 

The IoStats option retrieves information about your server’s outstanding reads and writes and it writes the following: Statistic and Value which includes statistic information on the following: Reads Outstanding and Writes Outstanding.

 

Example: Exec ('DBCC SqlPerf (IoStats)')

 

DBCC SqlPerf (RaStats)

 

The RaStats option retrieves information about your servers read-ahead statistics and it writes the following: Statistic and Value which includes information on the following: RA Pages Found in Cache, RA Pages Placed in Cache, RA Physical IO and Used Slots

 

Example: Exec ('DBCC SqlPerf (RaStats)')

 

DBCC SqlPerf (Threads)

 

The Treads option retrieves information for the server’s currently running threads and writes and it writes the following: Spid, Thread ID, Status, LoginName, IO, CPU and MemUsage

 

Example: Exec ('DBCC SqlPerf (Threads)')

 

 

Posted by dhite | with no comments

HTA Script To Retrieve A Remote SMS Clients Cache Configuration Information

 

This HTA script will take an SMS client machine name from an input text box and then return the SMS clients cache configuration information including its present location, current size and if it is currently in use to the active window.

 

For more information see my post entitled: The SMS Advanced Client Temporary Program Download Folder Cache here:

 

http://myitforum.com/cs2/blogs/dhite/archive/2007/03/24/the-sms-advanced-client-temporary-program-download-folder-cache.aspx

 

 

HTA Script:

 

<Html>

<Head>

<Title>HTA Script</Title>

<Style>

Body {Background-Color: CornSilk}

</Style>

 

<HTA:Application

Caption = Yes

Border = Thick

ShowInTaskBar = No

MaximizeButton = Yes

MinimizeButton = Yes>

 

<Script Language = VBScript>

Sub WindowsLoad

 

strComputer = MachineName.Value

Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/ccm/SoftMgmtAgent")

Set colItems = objWMIService.ExecQuery("Select * from CacheConfig")

For Each objItem in colItems

Window.Document.Title = "Cache Configuration For: " & UCase(strComputer)

strHtml = strHtml & "<td><Font color = Green> Location: </Font></Td>" & objItem.Location & "</Br>"

strHtml = strHtml & "<td><Font color = Green> Size: </Font></Td>" & objItem.Size & " MB" & "</Br>"

strHtml = strHtml & "<td><Font color = Green> In Use: </Font></Td>"  & objItem.InUse & "</Br>"

strHtml = strHtml & "</Br>"

Next

DataArea.InnerHtml = strHtml

 

End Sub

 

</Script><Body>

Enter Machine Name: <Input Type = "Text" Name = "MachineName">

<Input Type = "Button" Value = "Run Script" Name = "Run_Button" onClick = "WindowsLoad"><P>

<Span Id = "DataArea"></Span></Body><Div Align = "Center">

<P><A Href="http://myitforum.com/cs2/blogs/dhite">Created For myITforum By Don Hite</A>

 

 

Posted by dhite | with no comments
Filed under:

The SMS Advanced Client Temporary Program Download Folder Cache

 

When you view the “Systems Management” applet in the control panel on the “Advanced” tab you will see in the bottom leaf a section called “Temporary Program Download Folder”. In this section you specify in Megabytes (MB) how much of the client’s disk space is to be allocated when an advance client receives an advertisement that is configured to downward the program locally. If this is the case it is downloaded to the Temporary Program Download Folder’s “Current Location” which is by default located in the %WinDir%\System32\CCM\Cache directory folder.

 

From the”Advanced” tab you can modify the “Amount of disk space to use” by moving the slider, using the up and down arrows or by manually adding the value into the window. You can also change this programmatically using various scripting technologies which is beyond the scope of this post.

 

You can also change the location of the cache by clicking the “Change Location” button and browse for the new location. You can also clear the cache by clicking the button “Delete Files” and then select ‘Yes’ to the prompt asking you “Are you sure you want to delete the files”

 

The SMS default cache size value of 250 MB is sufficient for most site organizations but you may find that the cache size is too small. This is especially true if you have a very large infrastructure and are distributing an abundance of packages such as hotfixes and patches or if you are distributing large packages such as the various Microsoft office suites.

 

It is important to note here that if the cache is full or there in insufficient space remaining for a package to be downloaded the advertised program may not download and therefore it will not be able to execute. This can happen if the package is locked by the client agent.

 

When a package is downloaded to the advanced client cache the client agent places a lock on the package and the lock is not removed until a day later (24 hours) after the program is executed or a month (30 Days) if the package has not be executed. When the lock is removed from the package a day or a month later depending in the circumstance it cannot be re-locked until it is removed from the client cache and downloaded again.

 

When your packages need to be downloaded locally to the advanced client and the cache is full or lacks sufficient free space to accommodate the download the client will enumerate the packages in the cache if any exist and attempt to determine if the existing packages in the cache have already executed and the allotted 24 hours has not yet passed. If it finds packages where this is the case the agent then deletes them to allow more free space and then attempts to download the package again. On the second attempt to download the package if there is now sufficient free space remaining the package is downloaded to be executed.

 

If you have a package or multiple packages that when combined are too large to fit into the cache they will not be downloaded and this is a good indication that your client’s cache size is insufficient for your infrastructure.

 

Posted by dhite | 3 comment(s)
Filed under:

Vbs Script To Remove A Specified Domain User Name From A Remote Machines Local Admins Group

 

This by request Vbs script will allow you to enter a domain and user name and remove them from the local administrators group on the server or workstation specified.

 

Vbs Script:

 

strComputer = InputBox ("Enter Machine Name")

strDomain = InputBox ("Enter Domain Name")

strUser = InputBox ("Enter User Name")

 

Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")

Set objUser = GetObject("WinNT://" & strDomain & "/" & strUser)

 

objGroup.Remove(objUser.ADsPath)

 

MsgBox "Done"

 

Posted by dhite | with no comments
Filed under:

10 Things You Should NOT Say To A Policeman

 

1. I can’t reach my license unless you hold my beer.

2. Sorry, Officer, I didn’t realize my radar detector wasn’t plugged in.

3. Aren’t you that guy from the Village People?

4. Hey, you must’ve been doing about 125 mph to keep up with me. Good job!

5. Are you Andy or Barney?

6. You’re not going to check the trunk, are you?

7. I pay your salary!

8. Gee, Officer! That’s terrific. The last officer only gave me a warning, too!

9. Do you know why you pulled me over? Okay, just so one of us does.

10. When the Officer says “Gee Son....Your eyes look red, have you been drinking?” You probably shouldn’t respond with, “Gee Officer your eyes look glazed, have you been eating doughnuts?

 

Posted by dhite | with no comments
Filed under:
More Posts Next page »