Be sure to watch the Moon turn from orange to blood red on Tuesday August 27th 2007
This VBS script will take a list of machines from a text file called MachineList.Txt and will write the machine name, specified log file name and the specified log files size in MB to an excel spreadsheet.
Note: The script can be modified to get the file size for any file as long as the file name and file path that is hard coded is available on all machines in the list as I have no error checking added to first verify that the file does in fact exist.
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 = "Log File Name"
objExcel.Cells(1, 3).Value = "Log File Size"
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\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from CIM_DataFile Where name = 'C:\\WINDOWS\\system32\\CCM\\Logs\\InventoryAgent.Log'")
For Each objItem in colItems
objExcel.Cells(intRow, 1).Value = UCase(strComputer)
objExcel.Cells(intRow, 2).Value = UCase(objItem.FileName)
objExcel.Cells(intRow, 3).Value = FormatNumber(objItem.FileSize/1024/1024,1) & " MB"
intRow = intRow + 1
Next
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"
This VBS script will allow you to enter a Domain name from an input dialog box. The script will then write the appropriate Domain’s user names and the timestamp for when their Domain password was last changed. It will then write the results to an Excel spreadsheet.
strDomain = InputBox ("Enter Domain Name")
objExcel.Cells(1, 1).Value = "User Name"
objExcel.Cells(1, 2).Value = "Password Changed"
Set objContainer = GetObject("LDAP://CN=Users,DC=" & strDomain & ",DC=com")
objContainer.Filter = Array("User")
On Error Resume Next
For each objUser in objContainer
If left(objUser.objectCategory,9) = "CN=Person" Then
arrUser = Split(objUser.Name, "CN=")
objExcel.Cells(intRow, 1).Value = arrUser(1)
objExcel.Cells(intRow, 2).Value = objUser.PasswordLastChanged
End If
objExcel.Range("A1:B1").Select
In my previous post entitled Browse For A VBS Script And Send The Results To The Command Prompt Window below I wrote a VBS script that would allow you to browse for a VBS script and then execute the script and send the results to the command prompt window.
Here is a script that allows you to browse for a VBS script and when executed the results will be sent to notepad using the same process as the command prompt script version.
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "VBS Scripts|*.Vbs"
objDialog.InitialDir = "C:\"
intResult = objDialog.ShowOpen
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("ResultsSet.Txt") Then
objFSO.DeleteFile "ResultsSet.Txt"
Set objShell = CreateObject("WScript.Shell")
Set objOutput = objFSO.CreateTextFile("ResultsSet.Txt")
objOutput.Close
strCmdLine1 = strCmdLine & "Cmd /C Cscript //NoLogo " & Chr(34) & objDialog.FileName & Chr(34)
objShell.Run strCmdLine1 & " >> ResultsSet.Txt",, True
objShell.Run "Notepad.Exe ResultsSet.Txt"
Set objOutput = Nothing
Browse For A Vbs Script And Send The Results To The Command Prompt Window
http://myitforum.com/cs2/blogs/dhite/archive/2007/06/10/browse-for-a-vbs-script-and-send-the-results-to-the-command-prompt-window.aspx
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:
Nic.IPAddress0,
Nos.Caption0
Join v_Gs_Operating_System Nos
On Sys.ResourceID = Nos.ResourceId
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%'
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'
'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
In SMS 2003 when you have client resources assigned to a secondary site they cannot be assigned to the secondary site by default.
They will however be assigned to the parent site for that secondary site server even if the machines IP address falls within the site boundaries for the secondary site server.
By default in SMS 2003 your Advanced clients are assigned to the primary parent site not the secondary site like your legacy clients. However the advanced clients residing on the secondary site will use the Distribution Points (DP’s) as well as the Proxy Management Points (PMP’s) in use for the secondary site server.
Here you will find information on how to assign user rights on a Windows 2003 Domain Controller.
This example will show you how to add the right to "log on as a service". You can also use this guide to add user accounts to any of the rights listed at the end of this page.
1. Select “Domain Controller Security Policy” from the Administrative tools.
2. Expand “Local Policies”
3. Select “User Rights Assignment” and double click on the "log on as a service" in the leaf to the right.
4. Select "Add user or group" and enter the username as Domain\Account name or select the “Browse” button to browse for the account name and then add it.
5. Click “Apply” then click “OK” and you are returned to the Domain Controller Security Policy applet where you can exit when you have completed your tasks.
The list below is a listing of the User Rights Assignment(s) for Windows 2003 Server Service Pack (SP) 2:
Access this computer from the network
Act as part of the operating system
Add workstations to domain
Adjust memory quotas for a process
Allow log on locally
Allow log on through Terminal Services
Back up files and directories
Bypass traverse checking
Change the system time
Create a pagefile
Create a token object
Create global objects
Create permanent shared objects
Debug programs
Deny access to this computer from the network
Deny log on as a batch job
Deny log on as a service
Deny log on locally
Deny log on through Terminal Services
Enable computer and user accounts to be trusted for delegation
Force shutdown from a remote system
Generate security audits
Impersonate a client after authentication
Increase scheduling priority
Load and unload device drivers
Lock pages in memory
Log on as a batch job
Log on as a service
Manage auditing and security log
Modify firmware environment values
Perform volume maintenance tasks
Profile single process
Profile system performance
Remove computer from docking station
Replace a process level token
Restore files and directories
Shut down the system
Synchronize directory service data
Take ownership of files or other objects
Here you will find information on how to prepare your Server prior to installing and configuring System Center Essentials (SCE) 2007 in your infrastructure environment.
You must install the SCE 2007 Management Server on any of the following Operating Systems either the 32-bit or 64-bit versions with Service Pack (SP) 1 or greater:
Microsoft Windows Server 2003 Standard Edition
Microsoft Windows Server 2003 Enterprise Edition
Microsoft Windows Server 2003 Standard R2 Edition
Microsoft Windows Server 2003 Enterprise R2 Edition
Microsoft Windows Small Business Server 2003 Standard Edition
Microsoft Windows Small Business Server 2003 Premium Edition
Microsoft Virtual PC 2004.
Microsoft Virtual Server 2005.
You must also ensure that the following are installed:
Windows Server 2003 Service Pack 1
Internet Information Services (IIS) 6.0
Microsoft World Wide Web Service is running and set to automatic startup mode
IIS Background Intelligent Transfer Service (BITS) 2.0
Microsoft Data Access Components (MDAC) 2.80.1022.0 or greater
Windows Installer 3.1 or later must be installed
.NET Framework 2.0 or greater
.NET Framework 3.0 Components
Additionally you must ensure that the following are met:
Active Directory (AD) must be deployed
Your operating system must be installed on a drive formatted with NTFS
Tip: You must uninstall Software Update Server 1.0 before attempting to install Windows Server Update Services 3.0.
The following SCE 2007 Management Server hardware minimum requirements are listed below:
1.8 GHz processor (2.8 GHz or faster recommended)
1 GB of RAM (2 GB RAM recommended)
12 GB of available hard disk space (20 GB recommended)
1 GB of available hard disk space on the system drive.
In order to install SCE 2007 you should have a SQL server backend for the database already installed locally or you can use a Remote SQL database separate from the SCE server or the installation will install SQL Server 2005 Express Edition (Included on the CD-ROM Installation Media as SqlExpR_Adv.Exe in the Setup folder) with Advanced Services locally.
Note: You can also buy installation media with SCE 2007 and SQL Server 2005 Standard edition on it specifically licensed to use with SCE 2007.
You will need to install SQL Server 2005 any version listed below either the 32-bit or 64-bit versions with Service Pack (SP) 1 or greater installed and when you install SQL Server 2005 make sure that the SQL Reporting Services is installed as well as configured and patched with the SP 1 upgrade:
SQL Server 2005 Enterprise Edition
SQL Server 2005 Express Edition
SQL Server 2005 Standard Edition
SQL Server 2005 Workgroup Edition
Tip: You must have SQL 2005 set to use Windows Authentication Mode.
Note: SCE 2007 does not support SQL 2005 Database Mirroring nor cluster support.
After the installation has completed SCE 2007 will allow you to support the following as managed computer resources:
Microsoft Windows 2000 Professional
Microsoft Windows 2000 Server
Microsoft Windows 2000 Advanced Server
Service Pack (SP) 4 or greater
Either the 32-bit or 64-bit versions with Service Pack (SP) 1 or greater:
Service Pack (SP) 1 or greater
Microsoft Windows Vista Business Edition
Microsoft Windows Vista Enterprise Edition
Microsoft Windows Vista Ultimate Edition
Microsoft Windows XP Professional
Either the 32-bit or 64-bit versions with Service Pack (SP) 2 or greater
Windows XP Tablet PC Edition
Service Pack (SP) 2 or greater.
Windows Server 2003 Web Edition
Microsoft Virtual PC 2004
Microsoft Virtual Server 2005
Here you will find ten quick PowerShell console scripts that may be of use to you someday.
Ten Quick PowerShell Console Scripts
Gwmi -cl win32_Bios
Gwmi -cl Win32_BootConfiguration | Select BootDirectory
Gwmi -cl Win32_logicalDisk | Select DeviceId, ProviderName, Size, FreeSpace
Gwmi -cl win32_OperatingSystem
Gwmi -cl Win32_OperatingSystem | Select SerialNumber
Gwmi -cl Win32_OSRecoveryConfiguration | Select DebugFilePath
Gwmi -cl Win32_Processor | Select Manufacturer, Name
Gwmi -cl Win32_Share
Gwmi -cl Win32_USBController | Select Name
Gwmi -cl Win32_VideoController | Select Name, Description
The term living hand to mouth can be traced back to the time of America’s great depression (1929-1939) when simple things such knowing when your next meal will be was usually unknown.
It was said that when people especially those living in the great cities found food at places such as ‘Soup Kitchens’ or ‘Bread lines’ they were so hungry that the food went from their hands right into their mouths. It was said that they were eating “Hand to mouth”.
One of the new component features in Operations Manager 2007 is the Audit Collection Services which very basically allows for you to collect security events from managed machines.
The Audit Collection Services uses forwarder components included in the agent in real time monitoring in an encrypted transmission. The Audit Collection Services information is also exposed to WMI so you can view the collected database information.
Note: The Audit Collection Services is not installed as a default and must be installed from the installation Media after Operations Manager 2007 has been successfully installed as detailed in the link that follows.
Additional Information:
How to Install an ACS Collector and Database
http://technet.microsoft.com/en-us/library/bb309644.aspx
The Intel Processor Identification Utility Version 3.6 can be used with Windows 2000, Windows Server 2003, Windows XP and Windows Vista to gather information about your local processor.
Once you have downloaded the application and install it the utility is easy to use in that all you have to do is launch it and accept the license agreement and it will display your processors Speed, System Bus Speed and L2 cache memory information. It also has additional tables for CPU Technologies and CPUID Data.
Most if not all of the information that the utility provides can be gathered using other freeware utilities or scripting technologies such as VBS or HTA scripts however the graphical interface is quite nice.
The obvious shortcoming of the utility is that it does not offer support for remote processors in that there is no way to connect to a remote machine and retrieve the information like you can do with scripting technologies which would be nice. On the plus side is that they have a bootable version that is not operating system specific which would be hard to do using a scripting technologies such as a VBS script.
Windows Version
http://support.intel.com/support/processors/tools/piu/sb/CS-014921.htm
Bootable Version
http://support.intel.com/support/processors/tools/piu/sb/CS-015823.htm
Note: The bootable above version is operating system independent.
I first became interested in leaning about Microsoft’s Visual Basic Scripting or VBS scripts when I was programming in Microsoft Visual Basic (VB) 6.0 the last offering of the product by Microsoft in the late 1990’s.
I was particularly interested in the fact that VBS scripts were not as time consuming to create and did not rely on the VB runtime libraries being present on the host and target machines to operate as expected. My mentor was Jason Scheffelmaer (http://myitforum.com/cs2/blogs/jscheffelmaer) who joined me as an SMS administrator when our company went global with sites in England and throughout Europe in the early 2000’s. I was amazed at how quickly Jason could create VBS scripts to perform the same functions as my Visual Basic scripts and I was hooked on VBS scripts. Being the Lazy admin as I am do you blame me?
VBS Script was developed by the folks at Microsoft as the scripting language for Active Server Pages (ASP) but was soon adapted for basic Windows scripting on the client side for web page scripting. VBS scripting has a lot in common with VB in particular the syntax which made my transition from VB to VBS easy to do. However as noted above VBS scripts do not rely on VB runtime libraries it relies on the Windows Script Host (WSH) included in most Operating Systems or as a download from Microsoft. In Windows scripting VBS Scripting is used today primarily to access Windows Management Instrumentation (WMI) Namespace classes such as the Win32_Operatingsystem or the Win32_Services classes.
If you do not have a Jason at your disposal to teach you the fundamentals and the basics of VBS scripting Microsoft has provided you with learning resources as well as downloadable VBS Script collections to get you started listed below.
The myITforum web page is also a great place to find VBS scripts in the Scripting Articles section and to find solutions to your VBS problems or to ask for answers to your VBS scripting questions in the VB Script forum. The myITforum columnist Rod Trent, Ron Crumbaker and Dan Thomson also provide you with a downloadable Microsoft Access database called the myITforum Code Repository where you can find VBS as well as other scripting language scripts gathered from myITforum in once convent location.
I encourage you to read and download the Microsoft supplied documentation as well as visit the VBS scripting resources at myITforum and become a VBS scripter or sharpen you existing skills and maybe even pick up a few ideas for scripts of your own. If you have a VBS script that you want to share with others please post them to the following http://www.myitforum.com/downloads/upload.asp for the benefit of others.
Microsoft Learning Resources
Microsoft Windows 2000 Scripting Guide (On Line Version of the Book)
http://www.microsoft.com/technet/scriptcenter/guide/default.mspx?mfr=true
Downloadable Sesame Script Archive (Sesame Script 2005-2007)
http://www.microsoft.com/downloads/details.aspx?FamilyId=FF973FBE-9382-4E4C-80DE-E7DE14FD83E6&displaylang=en
VBScript Quick Reference Download (Microsoft Word Document)
http://www.microsoft.com/downloads/details.aspx?FamilyId=9C80B0DF-B9B4-4FCB-B513-02F8F40049E8&displaylang=en
Downloadable Microsoft VBS Script Collections
The Hey, Scripting Guy! Archive (Volume 1 August 2004 - June 2006)
http://www.microsoft.com/downloads/details.aspx?FamilyID=5f5e0bda-923a-4744-8289-afb73f6a5ed8&displaylang=en
TechNet Script Center Sample Scripts (Portable Script Center)
http://www.microsoft.com/downloads/details.aspx?FamilyID=b4cb2678-dafb-4e30-b2da-b8814fe2da5a&DisplayLang=en
myITforum Resources
Scripting Articles
http://www.myitforum.com/articles/11/section.asp
VB Script Forum
http://www.myitforum.com/forums/VB_Script/forumid_7/tt.htm
myITforum Code Repository
http://www.myitforum.com/articles/2/view.asp?id=6298
Here you will find information on how to setup MOSS 2007 using the Advance Install procedures.
1. Inset CD-ROM installation media and run Setup.Exe.
2. Then the Enter Your Product Key task appears where you enter your Product key and if the key is confirmed a green check box will soon appear. Click “Continue” to begin the installation.
3. Next the Read the Microsoft Software License Terms task appears. Read over the license agreement and when you are done check the “I accept the terms of this agreement” check box and then click “Continue”.
4. Next the Choose the installation you want task appears where you can elect to install a Basic or Advanced version of MOSS 2007.
Note: The Basic install will automatically install the MOSS database for you where the Advanced install allows you to specify options for the MOSS database as well as allows you to specify server roles. The Advanced install is preferable to allow you more control over the installation.
5. Next the Server Type task appears were you can select to perform a complete install, a web front end or a stand alone installation. Choose “Complete – Install all components. Can add servers to from a SharePoint farm.” Then click “Install Now” to begin the install. Next the Installation Progress task will appear stating that it is “Installing Microsoft Office SharePoint Server 2007…” and will run for a few minutes..
6. Next you are prompted to “Run the SharePoint Products and Technologies configuration wizard”. Select “Close” and the setup dialog box will appear stating “In order to complete setup, a system reboot is necessary. Would you like to reboot now?”.
7. After the reboot log back onto the server and select “Program Files” then “Microsoft Office Server”, and finally “SharePoint Products and Technologies Configuration Wizard” to begin the Welcome to SharePoint Products and Technologies task and then select “Next” to begin the wizard.
8. Next the SharePoint Products and Technologies Configuration Wizard dialog box will appear stating “The following services may have to be restarted or reset during configuration: Internet Information Services, SharePoint Administration Service, SharePoint timer service.” Click “Yes” to continue.
9. Next the Connect to a server farm task appears where you can select “Yes, I want to connect to an existing server farm” or “No, I want to create a new server farm” select “No, I want to create a new server farm” since this is the initial setup and click “Next” to continue.
10. Next the Specify Configuration Database Settings task appears. Enter the “Database Server” name and accept the default of SharePoint_Config for the “Database name”. In the Specify Database Access Account leaf enter the account name that you want to use to connect the database. If it is a domain account enter the name as Domain\AccountName or if it is a local account on the SharePoint server such as the local administrators account enter it as AdministratorName and enter the password for the account and select “Next” to continue.
11. Next the Configure SharePoint Central Administration Web Application task appears where you can choose to “Specify port number”” or accept the default of 43405. In the Configure Security Settings leaf choose either “NTLM” or “Negotiate (Kerberos)” security or accept the defaults and then select “Next” to continue.
12. Next the Completing the SharePoint Products and Technologies Configuration Wizard summary page appears listing your selected options review it and then select “Next” to continue.
Tip: At this time if you see anything in the summary page that you want to change or modify use the “Back” button to locate the appropriate task and make your changes as needed and click the “Next” button to continue.
13. Next the Configuring SharePoint Products and Technologies task begins and executes for several minutes and after step 9 has completed the Configuration Successful summary will appear then click “Finish” to allow the installation to complete and open the Central Administration page where you must complete several Administrator tasks because the Server farm configuration Not Complete message is displayed.
Next week we will discuss these tasks to allow you to make your final customizations
If you find that when you open the MOM 2005 Operators console there are numerous heartbeat alerts present stating that the managed computers are unreachable or even that they are offline the issue may be a domain time synchronization issue. This is particularly true if the MOM server and the MOM One point SQL Database are on separate servers.
This may be due to the fact that the current system time setting on the MOM 2005 server is out of synchronization with the domain time or is out of synchronization with the MOM SQL Database.
In a Windows 2003 server domain the domain time is set and determined by the Windows 2003 primary server (As long as it is a PDC Enumerator) and it is the official time keeper for the domain. As far as your Windows XP or better workstations are concerned by default they synchronize their local system time with the Windows 2003 primary server or the domain automatically.
To correct these issues synchronize the time for the MOM server and the MOM database server with the domain. You can do so by running any of the following from with a command prompt window:
Net Time %LogonServer% /Set /y
Net Time \\PDC_Host_Name /Set /y
Net Time \\ PDC_Host_IP_Address /Set /y
Here you will find the steps necessary to enable remote connections for the Express as well as the Developer editions of Microsoft SQL server 2005.
Each SQL 2005 instance must be enabled before you can connect to it from a remote machine or you may receive an error message similar to the one below:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.
Follow the steps below to allow remote connections.
1. Open the Microsoft SQL Server 2005 program group and select “Configuration Tools” and then select the “SQL Server Surface Area Configuration” tool.
2. At the Configuration page select “Surface Area Configuration for Services and Connections” and click the Database Engine to expand it and then select “Local and remote connections” and choose the protocols appropriate for you and then select “Apply” when you are finished..
3. Click “OK” at the message box to restart the Database Engines Service.
4. From the “Surface Area Configuration for Services and Connections page” expand the Database Engine once again and select “Service” and the select “Stop” to stop the MsSqlServer service and then select “Start” to restart it.