Thursday, November 20, 2014

Disconnect all remote shares in Windows

Want to disconnect all the mapped drives (even ones that don't have a drive letter) that Windows is keeping open for you? Here you go:
net use * /delete

Wednesday, November 19, 2014

Forget dd for disk copying - use cat instead!

Instead of waiting an eternity for dd to copy one hard drive to another, you can use cat. It is way, way faster, and it will functionally work the same to clone a drive (grub will work, etc.). The following command will clone source drive /dev/hda to target drive /dev/hdb:

cat /dev/sda >/dev/sdb

Reference: http://unix.stackexchange.com/a/144227

Tuesday, November 18, 2014

Trust all IPv4 ranges on SalesForce.com

Only do this if you know what you are doing to yourself. This helpful script will set up a trusted IP range for all possible IPv4 ranges in your SalesForce.com organization. Trusting all IP ranges means you can log in to SFDC from any IP address and not be prompted to enter a verification code from new browsers. I would only recommend this in a sandbox or demonstration environment as this definitely reduces your SFDC org's security.

Link: http://raydehler.com/cloud/clod/enable-all-trusted-ip-ranges-for-a-salesforce-org.html

Retrieving MS SQL Server CD Key using Powershell

From this excellent post: http://mspowershell.blogspot.in/2010/11/sql-server-product-key.html

function Get-SQLserverKey {
    ## function to retrieve the license key of a SQL 2008 Server.
    ## by Jakob Bindslet (jakob@bindslet.dk)
    param ($targets = ".")
    $hklm = 2147483650
    $regPath = "SOFTWARE\Microsoft\Microsoft SQL Server\100\Tools\Setup"
    $regValue1 = "DigitalProductId"
    $regValue2 = "PatchLevel"
    $regValue3 = "Edition"
    Foreach ($target in $targets) {
        $productKey = $null
        $win32os = $null
        $wmi = [WMIClass]"\\$target\root\default:stdRegProv"
        $data = $wmi.GetBinaryValue($hklm,$regPath,$regValue1)
        [string]$SQLver = $wmi.GetstringValue($hklm,$regPath,$regValue2).svalue
        [string]$SQLedition = $wmi.GetstringValue($hklm,$regPath,$regValue3).svalue
        $binArray = ($data.uValue)[52..66]
        $charsArray = "B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9"
        ## decrypt base24 encoded binary data
        For ($i = 24; $i -ge 0; $i--) {
            $k = 0
            For ($j = 14; $j -ge 0; $j--) {
                $k = $k * 256 -bxor $binArray[$j]
                $binArray[$j] = [math]::truncate($k / 24)
                $k = $k % 24
         }
            $productKey = $charsArray[$k] + $productKey
            If (($i % 5 -eq 0) -and ($i -ne 0)) {
                $productKey = "-" + $productKey
            }
        }
        $win32os = Get-WmiObject Win32_OperatingSystem -computer $target
        $obj = New-Object Object
        $obj | Add-Member Noteproperty Computer -value $target
        $obj | Add-Member Noteproperty OSCaption -value $win32os.Caption
        $obj | Add-Member Noteproperty OSArch -value $win32os.OSArchitecture
        $obj | Add-Member Noteproperty SQLver -value $SQLver
        $obj | Add-Member Noteproperty SQLedition -value $SQLedition
        $obj | Add-Member Noteproperty ProductKey -value $productkey
        $obj
    }
}


Use the function to retrieve the Product Key from the local PC:

Get-SQLserverKey

Or to retrieve the Product Key from one or more PCs (locally or remotely):

Get-SQLserverKey "pc1", "pc2", "server999", "server777"

Monday, November 17, 2014

CVP Community Forums link

I have no idea why this was so hard for me to find: https://communities.cisco.com/community/developer/collaboration/contact-center/customer-voice-portal

OS X Yosemite 10.10.1 update - can't restart bug

I had this bug while trying to update to Yosemite 10.10.1 from Yosemite 10.8. It couldn't complete the update because it was stuck trying to restart. Finder would hang and the dock wouldn't leave. I couldn't even restart or shut down without hard powering it off by holding the power button down. sudo shutdown -r in a terminal didn't even work. The fix is to log in with safe mode. I loosely followed these odd directions, and the update applied normally in safe mode.