Tuesday, December 4, 2012

Disable/Enable your network card from the command line.

Save these commands as a .cmd file:

@ECHO OFF
CLS
ECHO Disabling network interfaces.
netsh interface set interface "Local Area Connection" DISABLE
netsh interface set interface "Wireless Network Connection" DISABLE
ECHO Enabling network interfaces
netsh interface set interface "Local Area Connection" ENABLE
netsh interface set interface "Wireless Network Connection" ENABLE
PAUSE


*This has only been tested with Windows 7

Wednesday, October 31, 2012

Default Gateway Ping Test Batch File

This is a batch file that will let you test your connection status by pinging your default gateway.  Copy this code into notepad and save the file with a .BAT or .CMD extension.

@ECHO OFF
COLOR 1F
TITLE GATEWAY PING TEST
:PINGTEST
CLS
FOR /F "TOKENS=2 DELIMS=:" %%G IN ('IPCONFIG ^| find "Default Gateway"') DO (
    IF NOT "%%G"==" " (
        PING -w 30000 -n 1 %%G
        IF ERRORLEVEL 1 ECHO UNABLE TO PING GATEWAY!!!
    )
)
ECHO.
CHOICE /T 5 /D Y /M "WAITING 5 SECONDS BEFORE RETRY"
GOTO PINGTEST

*This has only been tested with Windows 7.  YMMV

Friday, October 5, 2012

Erasing or Wiping a Floppy Disk

Apparently there is a new switch to the format command that will let wipe a disk with multiple passes of writing 0 to the sector. For example:

format A: /P:3 /V:

will erase disk A: writing 3 passes of zero on each sector. "/V:" is for blanking the volume label. The disk is still usable but the old data is not recoverable. (Checked with PC Inspector File Recovery) This works with Vista and higher.

Tuesday, May 15, 2012

Free Online Virus Scanners

This is where I'm keeping my list of free scanners.  I may even update this list on a semi-frequent basis.

  1. ESET: http://www.eset.com/us/online-scanner/
  2. Bitdefender: http://www.bitdefender.com/scanner/online/free.html 
  3. Trend-Micro HouseCall: http://housecall.trendmicro.com/ 
Also, update your virus definitions and get a valid copy of antivirus software.  I've been using Microsoft Security Essentials and Clamwin with pretty good results.
  1.  Microsoft Security Essentials: http://windows.microsoft.com/en-US/windows/products/security-essentials
  2. Clamwin: http://www.clamwin.com/content/view/18/46/

This is not a virus scanner, but it will analyze unknown binaries or links.

Tuesday, April 17, 2012

Setting or changing a computer description.

You can right-click "My Computer" and set the computer description:

You can also do it from the command line:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>net config server /srvcomment:"Brian Hart's Notebook"
The command completed successfully.

You can use the computer description to identify who owns a computer without infringing on the company naming policy.

If you are on a Windows 7 system and cannot see the description, create a folder named "Network.{208d2c60-3aea-1069-a2d7-08002b30309d}" (without the quotes).

More info: http://blog.chrisara.com.au/2009/08/restoring-computer-description-in.html











Tuesday, April 3, 2012

Quickly Add or Remove Programs.

If you want to quickly Add or Remove a program from windows you can type "appwiz.cpl" in your Win7 search box or your XP Start->Run box.

Remember it as the "Application Wizard in my Control Panel".











Why do we want to do this?  More on that later.

Monday, April 2, 2012

Protecting your external hard drive data.

Always put your your external hard drive on the floor.  Somewhere it won't get kicked or stepped on, like under the coffee table.  It's already as low as it can get so it can't get dropped and lose all your family pictures and Justin Beiber tunes.

Thursday, March 1, 2012

How to hide Excel data query authentication settings.

Sometimes it's easier (lazier?) to use an Excel query for simple reports.  One problem with this is that the query authentication properties are viewable to anyone who has access to the report.  While this is like teaching a dog algebra for the average user, an advanced user could, conceivably, use this connection data to create their own, unauthorized queries.

While there is no way that I know of to hide the query information, you can create a set of protected procedures that:
  1. adds the authentication (connection string)
  2. runs the query
  3. then removes it again.
This is a simple example of what it could look like:
  1. First you'll want to create a new VBA module in your Excel worksheet with procedures that look something like this:

    Sub AddConnect()
        'this will add the connection string to
        'all connections in the active workbook
        For Each CN In ActiveWorkbook.Connections
            CN.ODBCConnection.BackgroundQuery = False 'this line is optional
            CN.ODBCConnection.Connection = _
            "ODBC;DRIVER={Progress OpenEdge 10.1C Driver};" & _
            "UID=YOURUSERNAME;PWD=YOURPASSWORD;" & _

            "HOST=YOURHOST;PORT=YOURPORT;DB=YOURDATABASE;" & _
            "DefaultIsolationLevel=READUNCOMMITTED"

        Next
    End Sub

    Sub RemoveConnect()
        'this will remove the connection string from
        'all connections in the active workbook
        For Each CN In ActiveWorkbook.Connections
            CN.ODBCConnection.Connection = "ODBC;"
        Next
    End Sub

    Sub ListConnections()
        'this will list all query connection strings
        'in the active workbook
        For Each CN In ActiveWorkbook.Connections
            MsgBox (CN.ODBCConnection.Connection)
        Next
    End Sub

    Sub RefreshAll()
        'this will refresh all the data connections in the active workbook
        AddConnect 'add the connection strings
        ActiveWorkbook.RefreshAll 'refresh all connections
        RemoveConnect 'remove the connection strings
    End Sub


  2.  You can then password protect the module by right-clicking it and selecting properties.
  3. Then check "Lock project for viewing" and enter your password.  Finally, click OK.
  4. You can then add a command button to your worksheet with the macro assigned to RefreshAll().