Archive for March, 2009

finding a bunch of server’s ip address

get-content server.txt| foreach {
$strComputer = $_
$colItems = get-wmiobject -class “Win32_NetworkAdapterConfiguration” `
-computername $strComputer | Where{$_.IpEnabled -Match “True”}
foreach ($objItem in $colItems) {
write-host $strComputer ” : ” $objItem.IPAddress
}
}
in the server.txt file, one server per line and no extra space at the end of each server.

Tuesday, March 31st, 2009

finding physical servername

For some reason, I have a problem remembering server name but don’t have any problem remembering SQL name instances. Maybe because I connect to the name instance more often then not. But when someone ask me what’s the physical servername of so and so SQL name instances, i’m lost.
a co-worker showed me a [...]

Wednesday, March 18th, 2009

order by asc for two (2) columns

a co-worker today asked if there was a way to insert data from one table into another but sort the columns by ASC for BOTH columns. For example, tableA has the following value:
rowid: 1,2,3,4
columnA: 3,7,1,6
columnB: 6,7,2,4
In his new table, he wants it to look like so (tableB):
rowid: 1,2,3,4
columnA: 1,3,6,7
columnB: 2,4,6,7
@ first, it should be [...]

Monday, March 16th, 2009