I was planning to write a pending blog post with different "how to" questions answered. Not limiting the post to any specific Microsoft product / technology , I will keep updating this one as and when I find time to spare. So then , lets get started....
How to check which Domain contoller the Current User is connected to ?
Start -> cmd -> SET LOGONSERVER
How to list all the SQL Server instances present on the local machine using SQLDMO ?
Create a new text file and paste following lines of VB code in that. Next save the file with .VBS extension and double click it. An output file will be generated listing all the SQL server instances on the host machine.
Option ExplicitOn Error Resume Next
Dim sSQLServerDim oSQLDMODim oInstancesDim nCountConst ForWriting = 2, ForAppending = 8Dim fso, fDim sFileDim sHostnameDim oNTInfo
sFile = "SQLInstances_" & Year(Date) &"_"& Month(Date) & "_" & Day(Date)&"_Log.txt"Set fso = CreateObject("Scripting.FileSystemObject")Set f = fso.OpenTextFile(sFile, ForAppending, True)
Set oNTInfo = CreateObject("WinNTSystemInfo")sHostname = oNTInfo.ComputerName
sSQLServer = "localhost"Set oSQLDMO = CreateObject("SQLDMO.SQLServer2")Set oInstances = oSQLDMO.ListInstalledInstances(sSQLServer)
f.writeLine "* * * * * * * * * * * * * * * * * * * * *"f.writeLine " Writing started at:" & Hour(Time) & "h" & Minute(Time) & "m" & Second(Time) & "s!"f.writeLine " System Name=" & CStr(sHostname) & "!"f.writeLine " SQL Server Name=" & CStr(sSQLServer) & "!" & vbCrLf
f.writeLine " Got oInstances.Count=" & CStr(oInstances.Count) & "!"If Err.Number <> 0 Then f.writeLine " >> Error occured!!! << " f.writeLine " >> Please send this log file << " f.writeLine " >> to the EMC Avamar Support Team! << " Err.ClearElse For nCount = 1 To oInstances.Count f.writeLine " " & CStr(nCount) & ".instance=" & CStr(oInstances.Item(nCount)) & "!" NextEnd If
f.writeLine vbCrLf & " Writing ended at:"& Hour(Time) & "h" & Minute(Time) & "m" & Second(Time) & "s!"f.writeLine "* * * * * * * * * * * * * * * * * * * * *" & vbCrLf & vbCrLf
f.CloseSet oSQLDMO = NothingSet f = NothingSet fso = NothingSet oInstances = NothingSet oNTInfo = Nothing
How to check if there are any duplicate SPN's in Windows Server 2008 ?
setspn -X Here X will search for duplicate SPNs
setspn -F Here F will perform the duplicate checking on forestwide level.