$conn = New-Object System.Data.SqlClient.SqlConnection $conn.ConnectionString = “Server=********\NCRWO;database=NCRWO_TransactionLog;Integrated Security=true;MultipleActiveResultSets=true” $conn.Open() $cmd = New-Object System.Data.SqlClient.SqlCommand $cmdInner = New-Object System.Data.SqlClient.SqlCommand $cmd.Connection = $conn $cmdInner.Connection = $conn $cmd.CommandText = “SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE=’BASE TABLE'” $swReader = $cmd.ExecuteReader() while ($swReader.Read()) { $cmdInner.CommandText =…
Category: Windows
Windows – who has a file open?
Use resmon.exe as shown below…
PowerShell for *nix people
PowerShell is becoming (has become) the replacement for VBScript on Microsoft operating systems. It is a fairly robust scripting language that I think most administrators will be happy to see. If you have a supported Microsoft operating system (i.e., not…
Querying Active Directory from java
This is just a stub I often use when configuring AD authentication for various applications. Invariably, I can use this to quickly determine why a given application configuration may be failing. import java.util.Hashtable; import javax.naming.*; import javax.naming.directory.*; class TestAD {…
Loop through and print directory size
Set objShell = CreateObject(“WScript.Shell”) Set objFSO = CreateObject(“Scripting.FileSystemObject”) Set objFolder = objFSO.GetFolder(“C:\”) Set colSubfolders = objFolder.Subfolders For Each objSubfolder in colSubfolders on error resume next Wscript.Echo objSubfolder.Name, objSubfolder.Size Next