Wednesday, December 13, 2006

Feeling Regular and the use of Fibre.

No, I'm feeling fine, though a tad tired.

I'm finally getting around to exploring Regular Expressions (RegEx) and coming to realize the value of the beast and the simplicity of the design. I picked the brain of my friend and mentor, Brent Ashley today and he showed me the RegEx Coach and introduced me to some of the logic. I found more in my O'Reilly book, "JavaScript: The Definative Guide" (I have the 3rd edition) tonight and I can say one thing about RegEx.

LEARN IT! Come to understand it and you'll be SO far ahead of the game. It is far from being the ONLY thing you need to know, but it will make you that much better at doing things the right way.

Now, I also asked Brent to do a code an informal code-review on a little VBScript thing I was working on. Frankly, it wasn't going well because I was just a little more rusty that I enjoy being, but I asked for the review to get an idea of where I need to improve. I found out.

It's tough to hear that you're not an ace, but you NEED to hear it. Efficiency is everything in development and my design was weak. There's much more I need to learn, but his manner of showing me where I can improve was skillful and conscientious.

Monday, November 13, 2006

Slow running Linux VM on VMWare ESX?

If your VMWare ESX implementation of a Linux guest OS is running slow... a stop-gap solution may be the following...

Create a script that connects to a reliable time server and retrieves the time:
#!/bin/bash
# Sync HWClock to timeserver.mynetwork.local
/bin/date
/sbin/service ntpd stop
/usr/sbin/ntpdate 192.168.0.50
/sbin/hwclock --systohc
/sbin/service ntpd start
/bin/date
Now, add two entries to crontab:
1 */1 * * * /var/scripts/scheduled/synctime >> /var/log/synctime.log
*/2 * * * * /sbin/hwclock --hctosys


You can certainly adjust the times, this is set to get the real time once an "hour" at the 1. Then sync the OS from the VM hardware clock every 2 minutes.

Sample output of synctime:
Mon Nov 13 16:01:01 EST 2006
Shutting down ntpd: [ OK ]
13 Nov 16:04:46 ntpdate[19413]: step time server 192.168.0.50 offset 223.590418 sec
ntpd: Synchronizing with time server: [FAILED]
Starting ntpd: [ OK ]
Mon Nov 13 16:04:49 EST 2006

Monday, October 09, 2006

UPDATE Query from Excel to (My)SQL Database

Recently I found out about a problem going between versions of MySQL last week and I though you might enjoy the solution. You see FLOAT()'s functionality changed whereby FLOAT(4,2) once meant 0000.00 to now meaning 00.00. The problem with this is that database imported with a value of 2341.33 becomes 99.99! This could be very bad. Fortunately you can export from the old DB via Query Browser to Excel (XML) and employ VBA and ODBC to get things right, fast.

Notably this does not update all values, only values where there is data, if you were to use this routine to post to a database repeatedly I would suggest adjusting the 'If ActiveCell.Value <> "" Then' functionality to set Null values as needed.

Sub UpdateDB()
'
' 09/10/2006 by Cameron Stevens
'

Set myconn = CreateObject("adodb.connection")
Connection = "Driver={MySQL ODBC 3.51 Driver}; Server=MyServer; ~SPLIT LINE~
uid=webuser; pwd=b33rg00gl3s; database=brewery; option=3; port=3306;"
myconn.Open (Connection)
Set result = CreateObject("adodb.recordset")
Sql = "USE brewery;"
Set result = myconn.Execute(Sql)

Range("A1").Select
Selection.Offset(1, 0).Select
strUpdate = "UPDATE tblBottlePrices SET "
While ActiveCell.Value <> ""
strWHERE = " WHERE order_id='" & ActiveCell.Value & "' "
Selection.Offset(0, 4).Select
strSET = " "
If ActiveCell.Value <> "" Then strSET = strSET & "retail_price='" & ActiveCell.Value & "' "
Selection.Offset(0, 1).Select
If ActiveCell.Value <> "" Then strSET = strSET & ", discount_price='" & ActiveCell.Value & "' "
'Selection.Offset(0, 1).Select

strUQuery = strUpdate & strSET & strWHERE

Set result = myconn.Execute(strUQuery)

'MsgBox strUQuery
Selection.End(xlToLeft).Select
Selection.Offset(1, 0).Select
Wend
myconn.Close
Set result = Nothing
Set myconn = Nothing

End Sub

Accessing or Deleting an Inaccessible File/Folder

While the rights may be adjusted using CACLS or the like, there are occationally files hat prove inpenitrable. It seems that the pleasantries of Long File Names can occationally curse us if that LFN gets corrupted. You can do what you want to delete the folder but it won't budge. But... there's a trick... go to a command prompt and perform a DIR /X on the folder containing this file or folder. The /X switch shows you the 8.3 or short names for these files, rename the problematic file using the short name and all is well (i.e. REN ALLDEA~2 XXX).

While this isn't the only way into a file that's inaccessible, it may be the last resort with a file that's got a corrupt filename.

3D Text Screen Saver

At one time the 3D text Screen Saver had some cool tricks that depended upon your choice of words. If you typed in 'Beer', 'Volcano', or 'rock' you had a selection of things come up in the screen saver that meant something to the developers. Windows 2000 threw this Easter Egg out, but left a treasure behind. If you're using Windows2000 you have the opportunity to inflict your personality on this screen saver. To get your own selection of words appearing you need to do the following:
  1. Open Regedit and search for the string HKEY_CURRENT_USER\Control Panel\Screen Saver.3DText
  2. Create a new String Value called Magic
  3. Enter a value for it which will be the name of the file you want to use (e.g. c:\winnt\magic.txt)
  4. Create the file (c:\winnt\magic.txt) using notepad. The format is as follows:
    -Test
    blah
    deedum
    hello
    n00b

Important - The first word must be preceded by a hyphen as this is used to designate a group of words. It is this word that you must enter into the 3D Text screensaver 'textbox'. When you run the screensaver you will get a random showing af all the words under the hyphened word in the text file. You can add more sections to the text file (again give each section a hyphened keyword to use in the screen saver dialogue box).

Safe Data: Backup and Recovery

It is critical to ensure data integrity in todays business world. Loss of data can set you back days or weeks and may put you in hot water with more than your boss or client. There are a few methods and means by which to safeguard your data and help you sleep at night. After deciding what sort of media you will use a backup schedule is the key to a good night's sleep.

Please have a look at this White Paper from Sun Microsystems and call me if you have any questions or concerns.

Finding a PC on the network

If you have several hundred PCs in a domain and need to quickly find just one there's a quick trick to finding them. This is especially true if your org uses a odd naming conventions for the ComputerName. At a command prompt type 'net view | find /i "userid"'. The userid is an example. If you want to explore this one further look up the details of the command FIND. You can also redirect the output and open it in NotePad for simplicity. and copy & paste functionality.

Internet Explorer opens Zip file as web page or undisplayed graphic.

It seems that a Zip Plug-In or MIME-type handler of zip files may have stopped functioning. The best way to reset this is to uninstall or install, then uninstall such a tool.

The symptoms are such that unless you right-click on a link and Save As, clicking on a zip file just opens another, somewhat blank, web page.

You may install the PKWare plug-in and, if don't really want to use it, remove it afterwards. If you do want it, please support the author by purchasing the full license.

Web Development Confinement to Screen Resolution Restrictions

When you build a web site your goal is to make it easy to read for your target audience. The layout is important and the content's readability from a font and presentation perspective and how the text reads. The target audience may have a specific preference as to browser, screen resolution, or age/reading level. Just as a newspaper must cater to it's target audience so must you in developing your web site.

One tool I have found useful is a wallpaper template. I normally run at a high resolution (1600x1200) and remembering how things look to the common user (1024x768 these days, though it was once 800x600) is sometimes tough. This template helps keep your perspective. Simply re-size your browser to fit within the size you're targetting. If you're running Windows XP or (gasp) Windows 98 you could configure a second display to the appropriate resolution, but that's a different challenge. Windows 2000 doesn't actually have this capability, but it's my OS of choice.

Note: you may want to leave a little space at the bottom of the area for the task bar.

Tuesday, May 09, 2006

For the Corporate Help Desk

There is a basic presumption with these tools that your helpdesk/deskside people have Administrative rights to the desktop PCs. While some people are paranoid about this, with virus threats a real concern Administrative rights and remote control are essential. There should be policy regarding when and why the PC is accessed, especially for remote control.

One more consideration, though it may not be the way things are now, is that your systems should be built in a consistant manner. Different technical types do things different ways, that doesn't mean the way things are currently done are wrong, there are many good ways of doing things. Some techs prefer one large disk, others prefer a partitioned hard disk. There are arguments for both. The key is that throughout your organisation there's minimal varation.

These tools are formulated for one scheme where that hard disk is partitioned into 4 pieces. For a 40 Gb Drive it's likely C: 10Gb, D: 10Gb, E: 15Gb, and Y: 5Gb is the scheme though some variation in size may occur. At one time our systems were a single partition, the user's files trampled the space for OS files and caused excessive down-time. We're currently re-sizing systems due to a change in our application suite to ensure they are allocated enough space on C:. While this is time consuming it is necessary at this time based on choices beyond our control.

Our recent roll-out of systems has lessened the blow but the remaining systems need re-partitioning. While we are currently licensed for Symantec Ghost, we have decided to purchase licenses for Partition Magic to complete these systems efficiently. Re-Partitioning can be done using Ghost, with an added degree of safety, by backing up the system, then restoring it with the adjusted partition sizes.

Please note that long lines have been split. Look for ~SPLIT LINE~ to re-join these lines.

Checking Symantec Antivirus Defs Remotely

NOTE: X:\ISTOOLS is an accessible storage location for tools (duh). RMTSHARE.EXE is part of the Resource Kits for NT4/2000.

chkDefs.cmd
@echo off
color 1F
SET KILLSHARE=0
SET target=%1

if "%target%"=="/?" GOTO HELP
if "%target%"=="" SET /P target=Update which System?
if "%target%"=="" goto help
IF EXIST \\%TARGET%\C$\*.* GOTO DOIT
X:\ISTOOLS\RMTSHARE \\%TARGET%\C$=C:\ | FIND /I "command failed"
IF %ERRORLEVEL% EQU 0 GOTO FAILED

SET KILLSHARE=1
IF EXIST \\%TARGET%\C$\*.* GOTO DOIT

:DOIT
:VIEW
START NOTEPAD "\\%TARGET%\c$\Program Files\ ~SPLIT LINE~
Common Files\Symantec Shared\VirusDefs\DEFINFO.DAT.
goto end

:HELP
CLS
color 4F
echo **************************************************************************
echo * *
echo * chkDefs.cmd - Retrieves a remote systems Virus Defs Info. *
echo * *
echo **************************************************************************
echo * Usage: *
echo * chkDefs [computername] *
echo * *
echo * 8:42 AM 7/21/2004 *
echo **************************************************************************
pause
goto end
:FAILED
echo Could not create Remote Connection to %TARGET%
goto end

:NOTFOUND
echo Could not find system %TARGET%
goto end

:end
ATTRIB +R \\%TARGET%\c$\WINNT\system32\drivers\etc\HOSTS.
IF %KILLSHARE% EQU 1 X:\ISTOOLS\RMTSHARE \\%TARGET%\C$ /d
color

Internet Explorer Pop-Up Windows/Links are blank
Occationally something goes wrong in Internet Explorer that ensures every pop-up window is blank. To fix this the simple answer is to run 'regsvr32 /s urlmon.dll' and all is well. For simplicity this CMD file corrects the problem while not exposing some of the tech of the solution.

fixBlankPopUp.cmd
@echo off
color 1F
echo Expeiencing Blank Pop-Ups in Internet Explorer?
echo Close your browser and all Internet Explorer windows.
echo you're done come back here and...
pause
regsvr32 /S urlmon.dll
echo Done. Thank-you.
pause

Changing the HOSTS file to protect those surfing users...
The following will install a more restrictive HOSTS. file to protect or simply restrict a user's browsability. You may need to formulate or find some HOSTS files to accomodate your needs but the tools will work with any file you create. I have included a "Big Brother" option (HOSTS.BB) to use on those people who enjoy wasting company time.

setHOSTS.CMD
@echo off
color 1F
SET KILLSHARE=0
SET target=%1

if "%target%"=="/?" GOTO HELP
if "%target%"=="" SET /P target=Update which System?
if "%target%"=="" goto help
IF EXIST \\%TARGET%\C$\*.* GOTO DOIT
X:\ISTOOLS\RMTSHARE \\%TARGET%\C$=C:\ | FIND /I "command failed"
IF %ERRORLEVEL% EQU 0 GOTO FAILED

SET KILLSHARE=1
IF EXIST \\%TARGET%\C$\*.* GOTO DOIT

:DOIT
IF NOT EXIST \\%TARGET%\C$\*.* GOTO NOTFOUND
IF "%2"==".BB" GOTO BROTHER
IF "%2"==".O" GOTO ORIGINAL
IF "%2"==".V" GOTO VIEW
IF "%2"==".bB" GOTO BROTHER
IF "%2"==".Bb" GOTO BROTHER
IF "%2"==".bb" GOTO BROTHER
IF "%2"==".b" GOTO BEAGLE
IF "%2"==".B" GOTO BEAGLE
IF "%2"==".o" GOTO ORIGINAL
IF "%2"==".v" GOTO VIEW

ATTRIB -R \\%TARGET%\c$\WINNT\system32\drivers\etc\HOSTS.
XCOPY X:\ISTOOLS\HOSTS.TXT \\%TARGET%\c$\WINNT\system32\drivers\etc\HOSTS. /Y
goto end
:BROTHER
ATTRIB -R \\%TARGET%\c$\WINNT\system32\drivers\etc\HOSTS.
XCOPY X:\ISTOOLS\HOSTS_BB.TXT \\%TARGET%\c$\WINNT\system32\drivers\etc\HOSTS. /Y
goto end
:BEAGLE
ATTRIB -R \\%TARGET%\c$\WINNT\system32\drivers\etc\HOSTS.
XCOPY X:\ISTOOLS\HOSTS_B.TXT \\%TARGET%\c$\WINNT\system32\drivers\etc\HOSTS. /Y
goto end
:ORIGINAL
ATTRIB -R \\%TARGET%\c$\WINNT\system32\drivers\etc\HOSTS.
XCOPY X:\ISTOOLS\HOSTS_O.TXT \\%TARGET%\c$\WINNT\system32\drivers\etc\HOSTS. /Y
goto end
:VIEW
START NOTEPAD \\%TARGET%\c$\WINNT\system32\drivers\etc\HOSTS.
goto end

:HELP
CLS
color 4F
echo **************************************************************************
echo * *
echo * setHOSTS.CMD is used to update or reset a HOSTS. file on a TCI system. *
echo * *
echo **************************************************************************
echo * Usage: *
echo * setHOSTS {computername] [switch] *
echo * *
echo * Default Action: place "safe" hosts file on system to protect *
echo * against hijackers and adware websites. *
echo * *
echo * *
echo * Switches: *
echo * .O - Original HOSTS. file *
echo * .V - View user's Host file *
echo * *
echo * 10:10 AM 6/24/2004 *
echo **************************************************************************
pause
goto end
:FAILED
echo Could not create Remote Connection to %TARGET%
goto end

:NOTFOUND
echo Could not find system %TARGET%
goto end

:end
ATTRIB +R \\%TARGET%\c$\WINNT\system32\drivers\etc\HOSTS.
IF %KILLSHARE% EQU 1 X:\ISTOOLS\RMTSHARE \\%TARGET%\C$ /d
color
pause

Wallpaper and ScreenSaver Enforcement
Ensuring the company is protected and that the corporate look and feel is consistent is critical. Not every company cares but those that do will like this. This can be enforced remotely using this tool, the added benefit is that it re-enforces itself once installed.

While I have customized this for each type of machine, your preference may be to customize by department. The whole system consists of two batch files, a menu file, plus the support files, which are stored in the support folder and dependant upon options. The screensaver I use was created using IrfanView 3.85, the perfect tool for simple graphic manipulation. The .ICO is an extra. I haven't decided what to do with that yet.

setCorp.CMD - FIRST FILE

@echo off
color 1F
SET KILLSHARE=0
SET target=%1

if "%target%"=="/?" GOTO HELP
if "%target%"=="" SET /P target=Update which System?
if "%target%"=="" goto help
if "%target%"=="." SET TARGET=%COMPUTERNAME%

IF EXIST \\%TARGET%\C$\*.* GOTO DOIT
\\tcint1\apps\ISTOOLS\RMTSHARE \\%TARGET%\C$=C:\ | FIND /I "command failed"
IF %ERRORLEVEL% EQU 0 GOTO FAILED

SET KILLSHARE=1
IF EXIST \\%TARGET%\C$\*.* GOTO DOIT

:DOIT
IF NOT EXIST \\%TARGET%\C$\*.* GOTO NOTFOUND
SET RESP=%2
IF "%RESP%"=="" GOTO NOSWITCH
echo Configuring %TARGET% as %RESP%:
GOTO PICK%RESP%
goto NOSWITCH

:NOSWITCH
if not exist \\tcint1\apps\ISTOOLS\setCorpChoices.txt goto Default
CLS
echo Updating System: %TARGET%
type \\tcint1\apps\ISTOOLS\setCorpChoices.txt
CHOICE /C:123456789Q Selection:

IF %ERRORLEVEL% EQU 1 SET RESP=Default
IF %ERRORLEVEL% EQU 2 SET RESP=T41
IF %ERRORLEVEL% EQU 3 SET RESP=T30
IF %ERRORLEVEL% EQU 4 SET RESP=T23
IF %ERRORLEVEL% EQU 5 SET RESP=T21
IF %ERRORLEVEL% EQU 6 SET RESP=S50
IF %ERRORLEVEL% EQU 7 SET RESP=M42
IF %ERRORLEVEL% EQU 8 SET RESP=M41
IF %ERRORLEVEL% EQU 9 SET RESP=M200
IF %ERRORLEVEL% EQU 10 SET RESP=
IF %ERRORLEVEL% EQU 11 SET RESP=
CLS
IF NOT "%RESP%"=="" echo Configuring for %RESP%:
GOTO PICK%RESP%

:Pick
CLS
echo No Selection, cancelled.
pause
goto end

:PickDefault
XCOPY X:\istools\setCorpsrc\CORPSTD.BMP ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
SET BITMAP=CORPSTD.BMP
XCOPY X:\istools\setCorpsrc\CORPSTD.CMD ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.SCR ~SPLIT LINE~
\\%TARGET%\c$\WINNT\SYSTEM32 /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.ICO ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
goto COMPLETE

:PickT41
XCOPY X:\istools\setCorpsrc\WPT41_*.BMP ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
SET BITMAP=WPT41_1600.BMP 2
XCOPY X:\istools\setCorpsrc\CORPSTD.CMD ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.SCR ~SPLIT LINE~
\\%TARGET%\c$\WINNT\SYSTEM32 /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.ICO ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
goto COMPLETE

:PickT30
XCOPY X:\istools\setCorpsrc\TCI_T30*.BMP ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
SET BITMAP=TCI_T30_1400.BMP 2
XCOPY X:\istools\setCorpsrc\CORPSTD.CMD ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.SCR ~SPLIT LINE~
\\%TARGET%\c$\WINNT\SYSTEM32 /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.ICO ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
goto COMPLETE

:PickT23
XCOPY X:\istools\setCorpsrc\TCI_T23*.BMP ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
SET BITMAP=TCI_T23_1280.BMP 2
XCOPY X:\istools\setCorpsrc\CORPSTD.CMD ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.SCR ~SPLIT LINE~
\\%TARGET%\c$\WINNT\SYSTEM32 /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.ICO ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
goto COMPLETE

:PickT21
XCOPY X:\istools\setCorpsrc\TCI_T21*.BMP ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
SET BITMAP=TCI_T21_1024.BMP 2
XCOPY X:\istools\setCorpsrc\CORPSTD.CMD ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.SCR ~SPLIT LINE~
\\%TARGET%\c$\WINNT\SYSTEM32 /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.ICO ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
goto COMPLETE

:PickS50
XCOPY X:\istools\setCorpsrc\TCI_S50*.BMP ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
SET BITMAP=TCI_S50_1600.BMP 2
XCOPY X:\istools\setCorpsrc\CORPSTD.CMD ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.SCR ~SPLIT LINE~
\\%TARGET%\c$\WINNT\SYSTEM32 /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.ICO ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
goto COMPLETE

:PickM42
XCOPY X:\istools\setCorpsrc\TCI_M42*.BMP ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
SET BITMAP=TCI_M42_1400.BMP 2
XCOPY X:\istools\setCorpsrc\CORPSTD.CMD ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.SCR ~SPLIT LINE~
\\%TARGET%\c$\WINNT\SYSTEM32 /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.ICO ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
goto COMPLETE

:PickM41
XCOPY X:\istools\setCorpsrc\CORPSTD.BMP ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
SET BITMAP=CORPSTD.BMP
XCOPY X:\istools\setCorpsrc\CORPSTD.CMD ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.SCR ~SPLIT LINE~
\\%TARGET%\c$\WINNT\SYSTEM32 /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.ICO ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
goto COMPLETE

:PickM200
XCOPY X:\istools\setCorpsrc\TCI_M200*.BMP ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
SET BITMAP=TCI_M200_SPECIAL.BMP
XCOPY X:\istools\setCorpsrc\CORPSTD.CMD ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.SCR ~SPLIT LINE~
\\%TARGET%\c$\WINNT\SYSTEM32 /I /Y /Q
XCOPY X:\istools\setCorpsrc\CORPSTD.ICO ~SPLIT LINE~
\\%TARGET%\c$\WINNT /I /Y /Q
goto COMPLETE

:COMPLETE
XCOPY X:\istools\REG.EXE \\%TARGET%\c$\WINNT /I /Y /Q
reg ADD \\%TARGET%\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run ~SPLIT LINE~
/V setCorp /t REG_SZ /d "C:\WINNT\CORPSTD.CMD %BITMAP%" /f
reg QUERY \\%TARGET%\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /V setCorp
color 4F
echo **************************************************************************
echo * *
echo * DONE: WALLPAPER AND BITMAPS WILL BE REPLACED ON NEXT REBOOT *
echo * *
echo * 9:05 AM 7/27/2004 *
echo **************************************************************************
goto end

:HELP
CLS
color 4F
echo **************************************************************************
echo * *
echo * setCorp.CMD is used to send a Virus Fix to a user's system *
echo * *
echo **************************************************************************
echo * Usage: *
echo * setCorp switch [computername] *
echo * *
echo * *
echo * Switches: *
echo * d - Default Toyota Wallpaper/Screensaver *
echo * *
echo * 9:07 AM 7/27/2004 *
echo **************************************************************************
pause
goto end
:FAILED
echo Could not create Remote Connection to %TARGET%
goto end

:NOTFOUND
echo Could not find system %TARGET%
goto end

:end
IF %KILLSHARE% EQU 1 X:\ISTOOLS\RMTSHARE \\%TARGET%\C$ /d
color
pause

CORPSTD.CMD
@ECHO OFF
SET WPStyle=%2
IF "%WPSTYLE%"=="" SET WPStyle=0
SET BITMAP=%~1
IF "%BITMAP%"=="" then SET BITMAP="CORPSTD.BMP"
ECHO Resetting to TCI Standards...
ECHO Resetting Wallpaper...
REG ADD "HKCU\Control Panel\Desktop" ~SPLIT LINE~
/V WallpaperStyle /T REG_SZ /D %WPSTYLE% /F
REG ADD "HKCU\Control Panel\Desktop" ~SPLIT LINE~
/V Wallpaper /T REG_SZ /D "C:\WINNT\%BITMAP%" /F
REG ADD "HKCU\Control Panel\Desktop" ~SPLIT LINE~
/V TileWallpaper /T REG_SZ /D 0 /F
REG ADD "HKCU\Control Panel\Colors" ~SPLIT LINE~
/V Background /T REG_SZ /D "0 0 0" /F
ECHO Resetting ScreenSaver...
REG ADD "HKCU\Control Panel\Desktop" /V SCRNSAVE.EXE ~SPLIT LINE~
/T REG_SZ /D "C:\WINNT\SYSTEM32\CORPSTD.SCR" /F
REG ADD "HKCU\Control Panel\Desktop" ~SPLIT LINE~
/V ScreenSaveActive /T REG_SZ /D 1 /F
REG ADD "HKCU\Control Panel\Desktop" ~SPLIT LINE~
/V ScreenSaverIsSecure /T REG_SZ /D 1 /F
REG ADD "HKCU\Control Panel\Desktop" ~SPLIT LINE~
/V ScreenSaveTimeOut /T REG_SZ /D 600 /F
ECHO Resetting Wallpaper...
REG ADD "HKU\.Default\Control Panel\Desktop" ~SPLIT LINE~
/V WallpaperStyle /T REG_SZ /D %WPSTYLE% /F
REG ADD "HKU\.Default\Control Panel\Desktop" ~SPLIT LINE~
/V Wallpaper /T REG_SZ /D "C:\WINNT\%BITMAP%" /F
REG ADD "HKU\.Default\Control Panel\Desktop" ~SPLIT LINE~
/V TileWallpaper /T REG_SZ /D 0 /F
REG ADD "HKU\.Default\Control Panel\Colors" ~SPLIT LINE~
/V Background /T REG_SZ /D "0 0 0" /F
ECHO Resetting ScreenSaver...
REG ADD "HKU\.Default\Control Panel\Desktop" ~SPLIT LINE~
/V SCRNSAVE.EXE /T REG_SZ /D "C:\WINNT\SYSTEM32\CORPSTD.SCR" /F
REG ADD "HKU\.Default\Control Panel\Desktop" ~SPLIT LINE~
/V ScreenSaveActive /T REG_SZ /D 1 /F
REG ADD "HKU\.Default\Control Panel\Desktop" ~SPLIT LINE~
/V ScreenSaverIsSecure /T REG_SZ /D 1 /F
REG ADD "HKU\.Default\Control Panel\Desktop" ~SPLIT LINE~
/V ScreenSaveTimeOut /T REG_SZ /D 60 /F
ECHO DONE.

setCorpChoices.txt


Please Select a Bitmap Collection to distribute:
================================================

1 - Default/Generic Corporate Suite

2 - T41 Laptop
3 - T30 Laptop
4 - T23 Laptop
5 - T21 Laptop

6 - S50 Desktop
7 - M42 Desktop
8 - M41 Desktop

9 - M200 Toshiba Portege

Q - Quit/Abort

Sunday, January 01, 2006

Can't get into PCAnywhere after re-boot.

If you're luck enough to be the Administrator on the remote PC and running Windows2000 locally (and Windows NT or better remotely) do the following:
  1. Right-click on 'My Computer', select Manage
  2. From the Action menu, select 'Connect to another computer...'
  3. Enter the name of the PC you need to control. Press OK.
  4. From the 'Services and Applications' tree, select Services.
  5. From the right-pane, select the pcAnywhere service.
  6. Right-click on the service and select 'Start'
  7. Close 'Computer Management' and attempt connection through pcAnywhere.
Note: If you need to do this from a command prompt (or you have WindowsNT) you may also use netsvc.exe from the Windows NT Resource Kit.

Create a folder based on today's date.

Though this can be applied in many ways, the WindowsNT/2000 Command Prompt has some powerful differences over the old MS-DOS Batch Language. the FOR command is just one difference. The delimiters specified and the order of the variables (%a, %b, %c) will depend on your localized settings. By default the following should create a folder called '20031129' (based on November 29th, 2003).

FOR /F "tokens=2,3,4 delims=/ " %a in ('date /t') do mkdir %c%a%b

This could be applied to a daily backup procedure using PKZIP from a command-line.

There is no individual ownership when you are part of a team, it's the sum of the parts that makes you the RESILIENT team you need to be.