November 2007 - Posts

VBS Scripts To Read Active Directory And Send All Computers Password Age To Excel

 

Here you will find two VBS scripts that will read Active Directory (AD) and return all of the machines and their password age (In days) and send the results to an excel spreadsheet sorted by the password age column. The first script uses the local domain and the second one prompts you to enter a domain name.

 

Reads Local Domain:

 

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 = "Password Age"

 

Const ADS_SCOPE_SUBTREE = 2

 

Set objConnection = CreateObject("ADODB.Connection")

Set objCommand = CreateObject("ADODB.Command")

 

objConnection.Provider = "ADsDSOOBject"

objConnection.Open "Active Directory Provider"

 

Set objCommand.ActiveConnection = objConnection

Set objRootDSE = GetObject("LDAP://RootDSE")

 

strDNSDomain = objRootDSE.Get("DefaultNamingContext")

strBase = "<LDAP://" & strDNSDomain & ">"

strFilter = "(&(ObjectCategory=Computer))"

strAttributes = "name, distinguishedName"

strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";SubTree"

 

objCommand.CommandText = strQuery

objCommand.Properties("Page Size") = 99999

objCommand.Properties("Timeout") = 300

objCommand.Properties("Cache Results") = False

 

Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst

Do Until objRecordSet.EOF

Set objComputer = GetObject("LDAP://" & objRecordSet.Fields("distinguishedName") & "")

dtmValue = objComputer.PasswordLastChanged

dtmDiff = Datediff("D", dtmValue, Now)

strLasttime = dtmDiff

 

objExcel.Cells(intRow, 1).Value = objRecordSet.Fields("Name").value

objExcel.Cells(intRow, 2).Value = strLasttime

objRecordSet.MoveNext

intRow = intRow + 1

loop

 

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

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

Set objRange = objExcel.Range("B1")

objRange.Sort objRange,1,,,,,,1

 

Msgbox "Done"

 

Prompts For Domain Name:

 

strDomain = InputBox("Enter Domain Domain")

 

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 = "Password Age"

 

Const ADS_SCOPE_SUBTREE = 2

Set objConnection = CreateObject("ADODB.Connection")

Set objCommand = CreateObject("ADODB.Command")

objConnection.Provider = "ADsDSOObject"

objConnection.Open "Active Directory Provider"

 

Set objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000

objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

 

strBase = "<LDAP://" & strDomain & ">"

strFilter = "(&(ObjectCategory=Computer))"

strAttributes = "name, distinguishedName"

strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";SubTree"

 

objCommand.CommandText = strQuery

objCommand.Properties("Page Size") = 99999

objCommand.Properties("Timeout") = 300

objCommand.Properties("Cache Results") = False

 

Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst

Do Until objRecordSet.EOF

Set objComputer = GetObject("LDAP://" & objRecordSet.Fields("distinguishedName") & "")

dtmValue = objComputer.PasswordLastChanged

dtmDiff = Datediff("D", dtmValue, Now)

strLasttime = dtmDiff

 

objExcel.Cells(intRow, 1).Value = objRecordSet.Fields("Name").value

objExcel.Cells(intRow, 2).Value = strLasttime

objRecordSet.MoveNext

intRow = intRow + 1

loop

 

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

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

Set objRange = objExcel.Range("B1")

objRange.Sort objRange,1,,,,,,1

 

Msgbox "Done"

 

VBS Script To Determine When All Users From A Specified Domain Password Was Last Changed

http://myitforum.com/cs2/blogs/dhite/archive/2007/08/26/vbs-script-to-determine-when-all-users-from-a-specified-domain-password-was-last-changed.aspx

 

 

 

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

VBS Script To Write System Restore Information To An Excel Spreadsheet

 

This VBS script will allow you to enter a remote workstation name from an input dialog box and return the machines System Restore information to an Excel spreadsheet. It will include all but the System Checkpoints which are created by the system. It will return the sequence number, the description, creation time date stamp and the event type.

 

VBS Script:

 

strComputer = InputBox ("Enter Machine Name")

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "Sequence Number"

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

objExcel.Cells(1, 3).Value = "Creation Time"

objExcel.Cells(1, 4).Value = "Event Type"

 

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

Set colItems = objWMIService.ExecQuery("Select * from SystemRestore Where Description <> 'System Checkpoint'")

For Each objItem in colItems

objExcel.Cells(intRow, 1).Value = objItem.SequenceNumber

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

objExcel.Cells(intRow, 3).Value = ConvWbemTime(objItem.CreationTime)

If objItem.EventType = 100 Then

objExcel.Cells(intRow, 4).Value = "Begin System Change"

ElseIf objItem.EventType = 101 Then

objExcel.Cells(intRow, 4).Value = "End System Change"

ElseIf objItem.EventType = 102 Then

objExcel.Cells(intRow, 4).Value = "Begin Nested System Change"

ElseIf objItem.EventType = 103 Then

objExcel.Cells(intRow, 4).Value = "End Nested System Change"

End If

 

intRow = intRow + 1

Next

 

Function ConvWbemTime(IntervalFormat)

sMonth = mid(IntervalFormat,5,2)

sDay = mid(IntervalFormat,7,2)

sYear = mid(IntervalFormat,1,4)

ConvWbemTime =  sMonth & "-" & sDay & "-" & sYear

End Function

 

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

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

MsgBox "Done"

 

Additional Information From Microsoft:

 

“System Restore monitors system changes and saves the system state as a restore point. If a system problem develops as a result of a system change, the user can return the system to a previous state using the data from a restore point....Applications and the system can create restore points when system changes occur....System Restore does not restore user data or documents, so it will not cause users to lose their files, e-mail, browsing history, or favorites. System Restore is also made available to users in safe mode, making it easier for them to restore their computers to a state before problems occurred.”

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Verify If The Admin$ Share Exist On A Remote Machine

 

This VBS script will allow you to verify if the Admin$ share is accessible and exist on a remote machine.

 

VBS Script:

 

strComputer = InputBox ("Enter Machine Name")

 

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

Set colShares = objWMIService.ExecQuery("Select * from Win32_Share Where Name = 'Admin$'")

 

If colShares.Count = 0 Then

MsgBox "Admin$ Does Not Exist On: " & UCase(strComputer)

Else

MsgBox "Admin$ Exist On: " &  UCase(strComputer)

End If

 

 

Posted by dhite | with no comments
Filed under:

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'

 

 

Posted by dhite | with no comments
Filed under:

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'

 

 

Posted by dhite | with no comments
Filed under:

SMS 2003 Advanced Client Push Requirements

 

In SMS 2003 the Client Push Installation process requires the following for the client resources and the site server in order to function as expected.

 

Client Resources

 

1. File sharing must be set and enabled.

2. The ADMIN$ Administrative share must exist and be accessible.

3. The Server service must be enabled and started.

4. The Client Push Installation account must have access to the resource.

 

Site Server

 

The site server requires the creation of an administrative account (Client Push Installation Account) to use that can access the client resources with elevated privileges. This means that it needs to be a member of the domain admins group because this group is copied to all resources once they are joined to a domain by default.

 

Note: Many times this is the reason why your client resources are not installing or functioning as expected because the end user has removed the account from the machine or from the Domain Administrators group.

 

The account that you create for the Client Push Installation Account must also be specified in the Accounts tab for the “Client Push Installation” Properties.

 

 

Posted by dhite | with no comments
Filed under:

Windows 2003 Server Local And System Environment Variables

 

Local

 

Variable

Description

%ALLUSERSPROFILE%

Echoes the all Users Profile.

%APPDATA%

Echoes where application data is stored by default.

%CD%

Echoes the current working directory string.

%CMDCMDLINE%

Echoes the command line used to start the current Cmd.exe.

%LOGONSERVER%

Echoes the Domain Controller (DC) that validated the current logon session.

%PROMPT%

Echoes the command prompt settings for the current interpreter.

%USERDOMAIN%

Echoes the domain name where the user account exists.

%USERNAME%

Echoes the user name of the current logged on user.

%USERPROFILE%

Echoes the Returns the location of the profile for the current user.

 

System

 

Variable

Description

%CMDEXTVERSION%

Echoes the version number of the current Command processor’s extensions.

%COMPUTERNAME%

Echoes the name of the computer.

%COMSPEC%

Echoes the path of the Command shell exe.

%DATE%

Echoes the current date.

%ERRORLEVEL%

Echoes the last error code for the last command issued.

%HOMEDRIVE%

Echoes the current logged on users home directory drive letter.

%HOMEPATH%

Echoes the path to the current logged on users home directory.

%HOMESHARE%

Echoes the network path of  the current logged on users shared home directory.

%NUMBER_OF_PROCESSORS%

Echoes the number of processors installed.

%OS%

Echoes the Operating System name.

%PATH%

Echoes the Path contents.

%PATHEXT%

Echoes the file extensions list the operating system deems as executable.

%PROCESSOR_ARCHITECTURE%

Echoes the chip processor architecture.

%PROCESSOR_IDENTFIER%

Echoes the processors description.

%PROCESSOR_LEVEL%

Echoes the processors model number.

%PROCESSOR_REVISION%

Echoes the processors revision number.

%RANDOM%

Echoes a randomized number from 0 to 32767.

%SYSTEMDRIVE%

Echoes the System Root directory drive letter hosting the Operating System.

%SYSTEMROOT%

Echoes the Operating Systems system root directory drive letter and directory name.

%TIME%

Echoes the Operating Systems current time.

%WINDIR%

Echoes the Operating Systems drive letter and directory name.

 

 

Posted by dhite | with no comments
Filed under:

SCE 2007 Server Installation Essentials

 

To install SCE 2007 the Microsoft server that will host the application and the SQL database must have the Windows server 2003 Network Operating System (NOS) installed. If you are running Windows Server 2003 it must have Service Pack (SP) 1 or better installed. Windows Server 2003 R2 can also be used as well.

 

The SQL database must be SQL Server 2005 and cannot be in a clustered environment. The suggested SQL Server 2005 versions are the Standard and Enterprise editions however the Workgroup and Express versions are also supported. It is also suggested that SQL Server 2005 Service Pack (SP) 1 or better installed.

 

SCE 2007 also requires that the hosting server has Internet Information Server (IIS) 6.0 with Background Intelligent Transfer Service (BITS) 2.0 installed and running. You will also need to have the .NET Framework 2.0 Redistributable installed as well.

 

 

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

PowerShell Script To Force A Local SMS 2003 Client To Rediscover It’s Site Code

This PowerShell script will force a local machine to rediscover its SMS site code.

 

PowerShell Script:

 

$smsClient = New-Object -Com Microsoft.SMS.Client

Write-Host "SMS Site Assignment: " $smsClient.ReAssignSite()

 

 

Posted by dhite | with no comments
Filed under:

Under The Weather

 

This term also is a nautical term as with most of the sayings we have today. In vessels such as large ships some people may feel discomfort or just get sea sick due to the rolling of the waves and the swaying of the ship when they are topside or on the deck. Some relief can be found if they go below deck into the bowels of the ship where the waves are not visible and the vessel does not sway or rock as much because of the way the vessel sits low in the water.

 

When people do this they are said to be under the weather because the weather or the outside is not visible and they are separated from it by the deck of the ship and are in a more stable position.

 

 

Posted by dhite | with no comments
Filed under:

Installing The SQL Server 2005 Management Pack For OpsMgr 2007

 

The SQL Server 2005 Management Pack For OpsMgr 2007 allows you to discover SQL 2005 database engines, Instances and databases as well as allows you to discover Database File and Group objects.

 

Feature Summary:

 

• Active Directory Helper Service

• Agent jobs

• Backup

• Backup Query Engine

• Clustering

• Databases and Tables

• DB availability

• DBCC

• Full Text Search

• Log Shipping

• Replication

• Replication monitoring

• SQL Server Agent

• SQL XML

• Web Assistant

 

Download the SQL Server 2000-2005 Management Pack (SQL Server 2000-2005 System Center Operations Manager2007 Management Pack.Msi) and execute the Msi to extract the contents to C:\Program Files\System Center Management Packs. This will in turn create the C:\Program Files\System Center Management Packs\SQL Server 2000-2005  Management Pack directory.

 

Open the System Center Operations Manager 2007 Operations Console and from the Administration leaf open Actions: Import Management Packs and import the management packs in the following order:

 

1. Microsoft.SQLServer.Library.mp

2. Microsoft.SQLServer.2005.Discovery.mp

3. Microsoft.SQLServer.2005.Monitoring.mp

 

Microsoft SQL Server 2000/2005 Management Pack Download

http://www.microsoft.com/downloads/details.aspx?FamilyID=8C0F970E-C653-4C15-9E51-6A6CADFCA363&displaylang=en

 

 

Posted by dhite | with no comments
Filed under:

Microsoft Developer Network Online Magazine

 

The Microsoft Developer Network (MSDN) magazine is on line like the TechNet

http://myitforum.com/cs2/blogs/dhite/archive/2006/09/17/FREE-Subscription-To-TechNet-Magazine.aspx magazine and is updated soon after each issue has been mailed. It also has a back issue archive going back to 2000 as well as back issues of its sister publications Microsoft Systems Journal and Microsoft Internet Developer.

 

MSDN Magazine Online

http://msdn.microsoft.com/msdnmag

 

Additional MSDN Links:

 

MSDN Blog Page

http://blogs.msdn.com/msdnmagazine

 

MSDN Magazine Back Issue Archive

http://msdn.microsoft.com/msdnmag/backissues.aspx

 

CHM Magazine Downloads

http://msdn.microsoft.com/msdnmag/htmlhelp.aspx

 

MSDN Magazine Code Search

http://msdn.microsoft.com/msdnmag/code.aspx

 

MSDN Magazine Podcast

http://msdn.microsoft.com/msdnmag/podcast/default.aspx

 

MSDN Magazine RSS Feeds

http://msdn.microsoft.com/msdnmag/rss/rss.aspx

 

Sister Publications:

 

Microsoft Systems Journal

http://www.microsoft.com/msj

 

Microsoft Internet Developer

http://www.microsoft.com/mind

 

 

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

MOSS 2007 Estimated Pricing

 

Here you will find a listing of the estimated pricing from Microsoft for MOSS 2007 Server, Client Access Licenses (CAL’s) and Internet facing sites.

 

Server

Estimated Price

Office SharePoint Server 2007

$4424

Office SharePoint Server 2007 for Search Standard

$8213

Office SharePoint Server 2007 for Search Enterprise

$57,670

Office Forms Server 2007

$4424

 

 

CAL’s

Estimated Price

Standard CAL

$94

Enterprise CAL1

$75

Office Forms Server 2007 CAL

$54

Office SharePoint Designer 2007

$187

 

 

Internet Facing Sites

Estimated Price

Internet site

$40,943

Office Forms Server 2007 for Internet sites

$22,118

 

 

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

Microsoft SQL Server 2000 Error 15457

 

When looking at your SQL Server 2000 ERRORLOG file you may see a message similar to the following: 2007-12-25 12:01:30.47 spidxx Error: 15457, Severity: 0, State: 1. This error is usually followed with the additional message: 2007-12-25 12:01:30.47 spidxx Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install. You may also see the message(s) in the SQL Enterprise Manager > Management > SQL Server Logs interface.

 

The message Error: 15457, Severity: 0, State: 1 because it has a severity of 0 is an Informational message rather than an actual error message. The Error 15457 is generated when you open the SQL 2000 Enterprise Manager Properties and it is usually preceded with an error similar to the one listed below:

 

Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.

 

Tip: The default System Message is: Configuration option '%ls' changed from %ld to %ld. Run the RECONFIGURE statement to install.

 

Note: SQL Severity numeric values 0 – 10 are all Informational Messages.

 

The particular message above simply means that someone has opened the SQL Server Properties to check or view its configuration and since it is an informational message it can be disregarded or ignored.

 

To test this open the SQL server MMC snap-in in question and right mouse click on the Server name and from the connect menu select “Properties” and then select “OK” to close the window. Then from the Management leaf select “SQL Server Logs” and open the “Current DD/MM/YYYY mm:ss” log file and scroll to the bottom and the last two entries will be displayed as

 

Source: spidxx

Date: YYYY-MM-DD hh:mm:ss.ms

Message: Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.

 

Source: spidxx

Date: YYYY-MM-DD hh:mm:ss.ms

Message: Error: 15457, Severity: 0, State: 1

 

Note: You may have to refresh the Log file if the log is currently open from the context menu.

 

Tip: The Source SPID is not important as it is simply the Session ID for the current user that viewed the properties page and does not necessarily mean that they initiated any changes at the properties page. You can however run the following SQL query to determine the user name for the session ID if needed. Be sure to change the XX to the spid number listed in the source without the spid. For example if the session ID is spid99 enter 99:

 

Select System_User 'User Name' Where @@SPID = 'XX'

 

 

Posted by dhite | with no comments

HTA Script To Return A Remote Machines LDAP Path

 

This HTA script will take a remote machine name and domain name from input dialog boxes and will return the Computers LDAP path to the active window.

 

Example:

 

LDAP://CN=MachineName,CN=COMPUTERS,DC=DomainName,DC=COM

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

strDomain = Domain.Value

 

Const ADS_SCOPE_SUBTREE = 2

 

Set objConnection = CreateObject("ADODB.Connection")

Set objCommand = CreateObject("ADODB.Command")

objConnection.Provider = "ADsDSOObject"

objConnection.Open "Active Directory Provider"

Set objCommand.ActiveConnection = objConnection

 

objCommand.Properties("Page Size") = 1000

objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

 

On Error Resume Next

objCommand.CommandText = _

"Select ADsPath From 'LDAP://dc=" & strDomain & ",dc=com'" _

& "Where objectCategory='Computer' " & _

"And name=' " & strComputer & "'"

Set objRecordSet = objCommand.Execute

 

objRecordSet.MoveFirst

Do Until objRecordSet.EOF

strComputer = objRecordSet.Fields("ADsPath").Value

objRecordSet.MoveNext

Loop

 

Window.Document.Title = "Machine Name: " & UCase(MachineName.Value) & " Domain Name: " & UCase(Domain.Value)

If Err.Number <> 0 Then

strHtml = strHtml & "<td><Font color = Red>" & UCase(strComputer) & " Does Not Exist" & "</Font></Td></Br>"

Else

strHtml = strHtml & "<td><Font color = Green>" & UCase(strComputer) & "</Font></Td></Br>"

End If

DataArea.InnerHtml = strHtml

End Sub

 

</script><Body>

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

Enter Domain Name: <Input Type = "Text" Name = "Domain">

<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:
More Posts Next page »