This VBS script will take the machine names from a text file called MachineList.Txt and write the machine(s) name, Current Management Point and site code to an excel spreadsheet.
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 = "Current Management Point"
objExcel.Cells(1, 3).Value = "Site Code"
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")
Set colItems = objWMIService.ExecQuery("Select * from SMS_Authority")
For Each objItem in colItems
strSiteCode = Replace(objItem.Name, "SMS:", "")
objExcel.Cells(intRow, 1).Value = UCase(strComputer)
objExcel.Cells(intRow, 2).Value = objItem.CurrentManagementPoint
objExcel.Cells(intRow, 3).Value = strSiteCode
Next
intRow = intRow + 1
loop
objExcel.Range("A1:C1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
Msgbox "Done"
Use this Vbs script to send SMS collection information to Excel.
Vbs Script:
objExcel.Cells(1, 1).Value = "CollectionID"
objExcel.Cells(1, 2).Value = "CollectionRules"
objExcel.Cells(1, 3).Value = "Comment"
objExcel.Cells(1, 4).Value = "CurrentStatus"
objExcel.Cells(1, 5).Value = "MemberClassName"
objExcel.Cells(1, 6).Value = "Name"
objExcel.Cells(1, 7).Value = "OwnedByThisSite"
objExcel.Cells(1, 8).Value = "RefreshSchedule"
objExcel.Cells(1, 9).Value = "RefreshType"
objExcel.Cells(1, 10).Value = "ReplicateToSubSites"
On Error Resume Next
strComputer = InputBox("Enter Site Server Name")
strSiteCode = InputBox("Enter Site Code")
Set objWMIService = GetObject("winmgmts://" & strComputer & "\root\sms\site_" & strSiteCode)
Set colItems = objWMIService.ExecQuery("Select * from SMS_Collection")
objExcel.Cells(intRow, 1).Value = objItem.CollectionID
objExcel.Cells(intRow, 2).Value = objItem.CollectionRules
objExcel.Cells(intRow, 3).Value = objItem.Comment
objExcel.Cells(intRow, 4).Value = objItem.CurrentStatus
objExcel.Cells(intRow, 5).Value = objItem.MemberClassName
objExcel.Cells(intRow, 6).Value = objItem.Name
objExcel.Cells(intRow, 7).Value = objItem.OwnedByThisSite
objExcel.Cells(intRow, 8).Value = objItem.RefreshSchedule
objExcel.Cells(intRow, 9).Value = objItem.RefreshType
objExcel.Cells(intRow, 10).Value = objItem.ReplicateToSubSites
Set colItems = Nothing
Set objWMIService = Nothing
objExcel.Range("A1:J1").Select
MsgBox "Done"
This VBS script will read the machine names from a text file called MachineList.Txt and return the machines Logical Disk information and send the results to an Excel spreadsheet.
The information will include the following: Machine Name, Drive letter, Total Size, Used Space, Free Space and Free Space Percentage.
objExcel.Cells(1, 2).Value = "Drive"
objExcel.Cells(1, 3).Value = "Total Size"
objExcel.Cells(1, 4).Value = "Used Space"
objExcel.Cells(1, 5).Value = "Free Space"
objExcel.Cells(1, 6).Value = "Free Space Percentage"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("MachineList.txt", 1)
Do Until objFile.AtEndOfStream
strComputer = objFile.ReadLine
Set objWMIService = GetObject("winmgmts://" & strComputer)
Set colDisks = objWMIService.ExecQuery("Select * From Win32_LogicalDisk Where DriveType = 3")
For Each objDisk In colDisks
objExcel.Cells(intRow, 1).Value = Ucase(strComputer)
objExcel.Cells(intRow, 2).Value = objDisk.DeviceID
objExcel.Cells(intRow, 3).Value = (FormatNumber(objDisk.Size/ 1024^3, 1)) & " GB"
objExcel.Cells(intRow, 4).Value = (FormatNumber(objDisk.Size/ 1024^3, 1) - FormatNumber(objDisk.FreeSpace/ 1024^3, 1)) & " GB"
objExcel.Cells(intRow, 5).Value = (FormatNumber(objDisk.FreeSpace/ 1024^3, 1)) & " GB"
objExcel.Cells(intRow, 6).Value = FormatPercent(objDisk.FreeSpace/objDisk.Size, 0)
If FormatPercent(objDisk.FreeSpace/objDisk.Size, 0) <= "25%" Then
objExcel.Cells(intRow, 6).Font.ColorIndex = 3
Else
End If
Loop
objExcel.Range("A1:F1").Select
This SQL server script will find all of the subnets between two given values that your SMS network discovery has located. To use this query change the IP octets to the location holders with the subnets that you want to display the values between. For example if you know that you have the SMS subnet boundaries 192.168.102.0 and 192.168.107.0 defined as subnet boundaries for your site you can add the values below to the script:Where (Ip_Subnets0 > '192.168.99.0' And Ip_Subnets0 < '192.168.110.0')This will return all the subnets between 100 and 109 that the SMS network discovery process has identified as active or in use. If the subnets 104 and 108 appear in the results pane then you should investigate the reasons why these particular subnets are not boundaries within your SMS site.
SQL Query:
Set NoCount On
Select Distinct
Subnets.Ip_Subnets0 Results
From System_Disc
Join System_Ip_Subnets_Arr as Subnets
On System_Disc.ItemKey = Subnets.ItemKey
Where (Ip_Subnets0 > '192.168.0.1'
And Ip_Subnets0 < '192.168.1.254')
Set NoCount Off
This SQL query much like its counterpart in the SMS console will provide you with the component status for you site.
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'
End As 'Current State',
Case Summarizer_Components.Type
When 0 Then 'AutoStarting'
When 1 Then 'Scheduled'
When 2 Then 'Manual'
End As 'StartUp Type'
From summarizer_components
-- Change xxx to the Three letter site code you wish to query.
Where Summarizer_Components.SiteCode = 'XXX'
Here you will find a list of SMS 2003 reading materials listed in order of publication that I refer readers to when asked for my help on learning SMS. If you need or want to learn SMS or are just hoping to advance your knowledge of SMS this list is for you.
It is important to note here that reading the materials presented below is only the first step in becoming proficient in the SMS arena. On the job experience is best way to learn SMS even when you have to learn things “Under Fire” as most of us have done. To augment or expand your learning of SMS myITforum can also be a great asset to have at your disposal and I encourage you to sign up for the daily newsletter and visit WWW.myITforum.Com on a regular basis.
Note: The links for the books here are from Amazon where the cost of the books has been consistently lower than other book seller WebPages or in stores. To save even more on the cost of your purchases I recommend that you look for books marked as Used. Many of these “Used” books are new and have never been used they are just sold on the Amazon storefront for other sellers.
Recommended Reading
Microsoft Systems Management Server 2003 Administrator's Companion
By Steven D. Kaczmarek
Feb 2004 - CD-ROM
http://www.amazon.com/gp/offer-listing/0735618887/ref=pd_bbs_sr_olp_1/104-6303260-0558366?ie=UTF8&s=books&qid=1185472839&sr=8-1
Professional MOM 2005, SMS 2003, and WSUS
By Randy Holloway, Telmo Sampaio, Marcus Oh, and Russ Kaufmann
May 2006
http://www.amazon.com/gp/offer-listing/0764589636/ref=pd_bbs_sr_olp_6/104-6303260-0558366?ie=UTF8&s=books&qid=1185473035&sr=8-6
SMS 2003 Recipes: A Problem-Solution Approach
By Greg Ramsey and Warren Byle
Sep 2006
http://www.amazon.com/gp/offer-listing/1590597125/ref=pd_bbs_sr_olp_2/104-6303260-0558366?ie=UTF8&s=books&qid=1185472839&sr=8-2
Pro SMS 2003
By Rod Kruetzfeld
Nov 2006
http://www.amazon.com/gp/offer-listing/1590596986/ref=pd_bbs_sr_olp_3/104-6303260-0558366?ie=UTF8&s=books&qid=1185472839&sr=8-3
SMS 2003 Administrator's Reference: Systems Management Server 2003
By Ron D. Crumbaker
http://www.amazon.com/gp/offer-listing/0471749508/ref=pd_bbs_sr_olp_5/104-6303260-0558366?ie=UTF8&s=books&qid=1185472839&sr=8-5
Additional Microsoft Documentation Resources:
Systems Management Server 2003 Product Documentation
http://www.microsoft.com/technet/sms/2003/library/proddocs.mspx
List of technical resources for Systems Management Server 2003
http://support.microsoft.com/kb/828368
This post will provide you with the available NetSh command line switches and provide you with examples on how to use the utility.
NetSh is a network shell command line utility that allows you to display or even modify or otherwise change your Network Interface Card (NIC) settings or configuration on Microsoft windows XP or better local or remote Operating system machines.
With the NetSh utility you can also specify the command line arguments to run or execute a script so that you can execute multiple commands from the same execution with the –F switch followed by the script name.
NetSh Syntax And Command Switch Reference
The basic Syntax of the NetSh is shown directly below followed by a chart with the command line switch and a brief description of each.
NetSh [-a AliasFile] [-c Context] [-r RemoteComputer] [{NetshCommand|-f ScriptFile}]
Switch
Description
? or Help
Displays Help and provides this list of commands.
Add
Adds a new configuration entry to a list.
Bridge
Changes to the `NetSh Bridge' prompt context.
Delete
Deletes a configuration entry as opposed to Add entries.
Diag
Changes to the `NetSh Diag' prompt context.
Dump
Displays the contents of a configuration script.
Exec
Runs a script file.
Firewall
Changes to the `NetSh Firewall' prompt context.
Interface
Changes to the `NetSh Interface' prompt context.
Ras
Changes to the `NetSh Ras' prompt context.
Routing
Changes to the `NetSh Routing' prompt context.
Set
Updates configuration settings.
Show
Displays information available.
WinSock
Changes to the `NetSh WinSock' prompt context.
Using The NetSh Command Utility
To use the NetSh utility you need to open a command prompt window and enter NetSh in the command prompt and press Enter. Then you will be presented with the NetSh prompt NetSh> then enter your command as in the example below that will display or show your current mode for the local machine which should be online: Show Mode
If you want to use the NetSh utility from a remote machine at the prompt window and enter: Set Machine MachinName and the NetSh command prompt will change to [MachineName] NetSh> and at this point the utility behaves as if you were at the remote machine.
Tip: To exit the utility enter Bye rather than closing the window manually then the utility will exit and you will once again be returned to the command prompt window where you can enter Exit.
NetSh Examples
To determine which NIC card is currently using an IP address from the NetSh command prompt window enter Interface and press enter and you will be presented with the NetSh prompt: NetSh Interface>. Then enter IP Show Config.
To change a machine from a static IP address to a DHCP client issue the following using the steps show above. From the NetSh Interface> prompt enter: IP Set Address "Local Area Connection" DHCP
To open the Webpage Graphical Interface (GUI) for the NetSh utility at the NetSh Prompt enter: NetSh Diag GUI
To view your Firewall configuration from the NetSh command prompt window enter Firewall and press enter and you will be presented with the NetSh prompt: NetSh Firewall> and then enter Show Service.
Note: You can also send the results of your commands to a text file with the > redirector such as NetSh Diag GUI > NetShDiag.Txt
Additional Information
Managing Windows 2000 Networking Components with NetSh
http://www.microsoft.com/technet/community/columns/cableguy/cg1101.mspx
Here you will find two PowerShell scripts that will allow you to sort the contents of a text file alphabetically and save the sorted file as a new text file to preserve the original or existing file. The first script merely sorts the contents of a text file. The second script sorts the contents of a text file and also removes any duplicate lines or entries that may be in the original text file.
In most of my VBS scripts I have references to a text file called MachineList.Txt. This is the suggested text file name to store a list of machines or IP addresses for the script(s) to use as an input file. This is easier than entering one machine name or IP address at a time into a VBS script and being Lazy as I am it is the way I write most of my scripts. As a result I wrote the PS1 script to sort the MachineList text file and later realized that I had much to my chagrin duplicates in some of the files and wrote the PS1 script to remove the duplicates. Be sure to change the "C:\DirectoryFolder\MachineList.Txt" to the directory folder name and text file name as needed.
Sort The Contents Of A Text File
$TextFile = $TextFile = "C:\DirectoryFolder\MachineList.Txt"
$NewTextFile = "C:\DirectoryFolder\NewMachineList.Txt"
GC $TextFile | Sort > $NewTextFile
Sort And Remove Duplicates From A Text File
GC $TextFile | Sort | GU > $NewTextFile
Additional Related Posts:
HTA Script To Remove Duplicates From A Text File
http://myitforum.com/cs2/blogs/dhite/archive/2007/05/27/hta-script-to-remove-duplicates-from-a-text-file.aspx
Using The Ultra-Edit Text Editor To Sort And Remove Duplicate Lines From Files
http://myitforum.com/cs2/blogs/dhite/archive/2006/05/21/20470.aspx
When a person is said to have too many irons in the fire it means that they have too many projects or activities going on at once. This term comes from the days when village Black Smiths or Smiths were the ones who fashioned Iron for things such as weapons and horse shoes.
A Black Smith would begin his day by getting his fire pit coals roaring hot and then he would place several pieces of iron into it to get them red hot so that they could more easily be hammered into their respective shapes. It was a common practice for the Smith to work on a piece and when it began to cool and was harder to shape he would place it back into the colas to get it hot again so it could be more easily worked. If he had several pieces of Iron in the pit he was said to have too many irons in the fire and was considered quite busy.
Maarten Goet's System Center Operations Manager 2007 Wiki is “Dedicated to all things System Center Operations Manager 2007” The site much like Operations Manager 2007 is relatively new but shows great promise as a resource for Operations Manager 2007. The page includes the following:
Welcome
http://opsmgr2007.wikidot.com/start
What's new
http://opsmgr2007.wikidot.com/system:what-s-new
General
http://opsmgr2007.wikidot.com/system:general
Installation
http://opsmgr2007.wikidot.com/system:installation
Agents
http://opsmgr2007.wikidot.com/system:agents
Database
http://opsmgr2007.wikidot.com/system:database
Management Server
http://opsmgr2007.wikidot.com/system:management-server
Management Packs
http://opsmgr2007.wikidot.com/system:management-packs
Monitoring
http://opsmgr2007.wikidot.com/system:monitoring
Reporting
http://opsmgr2007.wikidot.com/system:reporting
Consoles
http://opsmgr2007.wikidot.com/system:consoles
Powershell
http://opsmgr2007.wikidot.com/system:powershell
Notification
http://opsmgr2007.wikidot.com/system:notification
Audit Collection Services
http://opsmgr2007.wikidot.com/system:audit-collection-services
Agentless Exception Monitoring
http://opsmgr2007.wikidot.com/system:agentless-exception-monitoring
Screenshots
http://opsmgr2007.wikidot.com/system:screenshots
Downloads
http://opsmgr2007.wikidot.com/system:downloads
Links
http://opsmgr2007.wikidot.com/system:links
Forum
http://opsmgr2007.wikidot.com/forum:start
Recent posts
http://opsmgr2007.wikidot.com/forum:recent-posts
Page tags
http://opsmgr2007.wikidot.com/system:page-tags
Operations Manager 2007 Wiki Home Page
http://opsmgr2007.wikidot.com