Archive for category Management

How to reset the Administrator password in Windows

Forgot your Administrator password? Or locked it out due to trying the wrong one too many times? This is the place for you.

I worked for a client recently that made a classic personnel mistake. After parting ways with a disgruntled employee they failed to change the Administrator password on their production server. This server is available publicly via remote desktop. As I was working on a issue for them one day I stopped being able to log in. It turns out their disgruntled employee had logged on and re-set their password, Oops!

If you find yourself in such a conundrum here is how I got them back into their machine. There is a great (free) app called PogoStick that you download as an ISO and burn to a CD, it’s available here: http://pogostick.net/~pnh/ntpasswd/. Just download it, burn it to a CD and then insert into the affected machine. Couple of notes here:
1) Be sure the machine your fixing is set up to boot from your CD rom first. This is done by going into your bios and finding the section related to boot devices. Every bios is different so that’s as specific of instructions as I can give.
2) Read through the screens. The app can do a number of things but many of them are experimental and some only work on certain versions of Windows. Play it safe and only reset the password to blank, setting it to a value didn’t work for me. Also be sure to unsuspend the id if it’s not already.
3) This one is important, and not so obvious in my opinion. After you’ve fixed the id you’re not done. You have to exit using the menu. It will eventually ask if you want to commit the changes to which you’ll answer (y)es.

That’s it. In case you’re not paying enough attention, you can now re-set the Administrator password from blank to some useful value in Windows itself. No need to use a command line app as I’ve heard some people have.

NOTE: If you need to reset an admin id on a domain controller that is an entirely different beast. The solution above works for local machine accounts only! If you want more info, or want to try to fix a account for a domain controller these look like useful websites. Caveat emptor though, it is possible to make the situation worse with some of these suggestions.
How to reset the Domain Admin Password under Windows 2003 Server
Unlocking Windows NT/2000/2003 Domain Controllers
Forgot your Windows password? No problems : Password resetting and recovering techniques

Advertisements

Leave a comment

Excellent website – catacombae. Find Duplicate files on your computer, get your DiskUsage, etc

I just found an excellent website, www.catacombae.org, on it Eric posts a few different useful utilities and the code is open source. I have used three of his utilities and they work great, the three I’ve used are:

1) DiskUsageAnalyzer
I used to use FolderSize for this, unfortunately Microsoft made a change in Windows 7 that no longer allows extending explorer in a way that allows this add-on to work. /shake fist @ MS. This utility works quite well, it’s great if your disk is getting full and you don’t know where all the space is being used. IMO this is a utility that should be built into windows.

2) FindDuplicates
This is actually an idea I wanted to write for ages, managing all those family photos and backups is a pain (we tend to copy photos we want to get printed to a temp to print folder, and then promptly forget about them). Unfortunately this app shows errors as they occur meaning it stops processing on every error. You’d think this wouldn’t be a issue, but in practice there are lots of reasons for this process to fail on files (locked files, permissions). It would be great if it would just build a list of errors and continue processing instead of making me click ‘Ok’ over, and over, and over. Great app for the price though!

3) HFSExplorer
HFSExplorer is a great little utility for reading Mac based hard drives on a PC. Works great. Though I’m told that Windows 7 will read HFS disks so this utility seems to only be useful on pre Windows 7 machines.

Thanks for the great utilities Erik!

1 Comment

Why is svchost.exe consuming all my CPU / disk?

If you’ve ever opened your task manager to see what is running on your machine you’ve likely wondered why svchost is running, why it’s running more than once, and why some take much more CPU than others.

Well the quick answer to your question is svchost is really not the process being run. svchost is what windows uses to run what are known as “Windows Services”. To view the Windows Services that are installed on your computer go here:
Control Panel->Administrative Tools->Services

Every service listed in Windows Services will spawn a svchost process when it runs. So in order to know why a particular svchost process is eating your computer you’ll need to track down which Windows Service it is. Thankfully there is a command line tool that makes this pretty easy. In Task Manager take note of the Process Id (PID) of the svchost in question. Then run this from the command line:
tasklist /fi “pid eq XXX” /svc
Where XXX is equal to the PID you took note of from Task Manger.

If you remembered the /svc switch you will see all the services your process depends on. If you’re having issues with non responsiveness it’s these service(s) that need to be dealt with.

Better yet, if you have Windows Vista or newer, in Task Manager right click the process in question and select “Go to service(s)”. This will show you a list of all the services running under that instance of svchost.

This site has pretty good detail on this topic: http://www.howtogeek.com/howto/windows-vista/what-is-svchostexe-and-why-is-it-running/

Happy process hunting!

Leave a comment

How to automate mapping network drives via script – VBS Logon Script – MapNetworkDrive

How to automate mapping network drives via script

My coworkers were constantly managing their clients mapped drives so I wrote a script to automate setting them up.  I wrote it both in VB6 and VBScript for those of you interested in seeing it written both late and early bound.  Here it is:

==== VBScript ====
(to use this put it in a file with a .vbs extension and then double click on it)

Main

Sub Main()
    Dim sNetworkString
    sNetworkString = "I:,\\somenetworklocation\somefolder;
J:,\\someothernetworklocation\asubfolder;M:,\\onemorenetworklocation\something"
    Dim sNetworkArray
    sNetworkArray = Split(sNetworkString, ";")
    Dim sNetworkLine

    Dim objNetwork
    Set objNetwork = CreateObject("WScript.Network") 

    'To remove a network drive: call objNetwork.RemoveNetworkDrive("I:",true,true)
    Dim item
    For Each item In sNetworkArray
        sNetworkLine = Split(item, ",")
        On Error Resume Next 'This is here to ignore the drive errors if they 
        'already exist
        objNetwork.MapNetworkDrive sNetworkLine(0), sNetworkLine(1)
        On Error GoTo 0
    Next
End Sub

==== VB6 ====
(to use this put it in a VB6 forms or console app, add a reference to
‘”Windows Script Host Object Model” and compile)

Private Sub Form_Load()
    Dim sNetworkString As String
    sNetworkString = "I:,\\somenetworklocation\somefolder;
J:,\\someothernetworklocation\asubfolder;M:,\\onemorenetworklocation\something"
    Dim sNetworkArray() As String
    sNetworkArray = Split(sNetworkString, ";")
    Dim sNetworkLine() As String

    Dim objNetwork As WshNetwork
    Set objNetwork = CreateObject("WScript.Network") ' WshNetwork

    'To remove a network drive: call objNetwork.RemoveNetworkDrive("I:",true,true)
    Dim item As Variant
    For Each item In sNetworkArray
        sNetworkLine = Split(item, ",")
        On Error Resume Next 'This is here to ignore the drive errors if they already exist
        objNetwork.MapNetworkDrive sNetworkLine(0), sNetworkLine(1)
        On Error GoTo 0
    Next item
End Sub

If you want to make this smarter you could play with objNetwork.EnumNetworkDrives().  By using this collection you could bypass my messy method of ignoring already mapped drives by ignoring the error they throw.

How it works:
You may of noticed above there is a variable declared like so:
sNetworkString = “I:,\\somenetworklocation\somefolder;
J:,\\someothernetworklocation\asubfolder;M:,\\onemorenetworklocation\something”
This variable is key to this function working. If you want to map more / less / different paths all you need to do is add your own to this string. It is delimited by comma and semi colon, so this maps the X drive:
sNetworkString = “X:,\\mycomputer\afolder”
and this maps X and Y:
sNetworkString = “X:,\\mycomputer\afolder;Y:,\\anothercomputer\folder1\folder2”
Note that there is no semi-colon (;) at the end of the string. This is intentionally omitted because of the way Split() works.

If you use this script in your company I would love to hear about it! Feel free to post your comments here, I always enjoy hearing about other people’s experiences.

2 Comments

Ctrl – Alt – Delete in Remote Desktop

I keep forgetting the key combination for Ctrl – Alt – Del in Remote Desktop, thanks to online-tech-tips.com for being the latest place I’ve found this info.  The key combination is:
Ctrl – Alt – End

Here are a bunch more you may like:
Alt + Page Up
– Switch between programs (Alt + Tab is the local command)
Ctrl + Alt + Esc
– Display the Task Manager (Ctrl + Shift + Esc is the local command)
Alt + Home
– Brings up the Start menu on the remote computer
Ctrl + Alt + (+) Plus/ (-) Minus
– Minus takes a snapshot of the active window and plus takes a snapshot of the entire remote desktop window.

I found these tips on online-tech-tips.com here: (though their display the task manager combination is wrong, should be Esc, not End)
http://www.online-tech-tips.com/windows-xp/ctrl-alt-del-remote-desktop/

Leave a comment

How to automate installing the .Net Framework, iSeries and Oracle Client

I created a batch file that checks to see if the .net framework 3.5, 4.0, iSeries and Oracle Client is installed and if not install them.  I found it pretty useful, here’s the code:

@echo off
if not exist %windir%\microsoft.net\framework\v3.5 (
echo Copying installer for .Net 3.5
xcopy “\\somenetworklocation\dotNetInstallers\dotnetfx35.exe” c:\dotNetInstallers\ /c /r /y /q
echo Installing .Net 3.5
c:\dotNetInstallers\dotnetfx35.exe /qb /nopatch /norestart /lang:enu
) Else (
echo .Net 3.5 already installed, skipping
)

if not exist %windir%\microsoft.net\framework\v4.0.30319 (
echo Copying installer for .Net 4.0
xcopy “\\somenetworklocation\dotNetInstallers\dotNetFx40_Full_x86_x64.exe” c:\dotNetInstallers\ /c /r /y /q
echo Installing .Net 4.0
c:\dotNetInstallers\dotNetFx40_Full_x86_x64.exe /norestart /passive
) Else (
echo .Net 4.0 already installed, skipping
)

if exist c:\dotNetInstallers (
rmdir c:\dotNetInstallers /S /Q
)

if not exist C:\ORACLE\Base\product\11.1.0\client (
echo Copying Oracle 11g .Net Data Adapter
xcopy “\\somenetworklocation\Oracle 11g ODAC and Oracle Developer Tools for Visual Studio 11.1.0.7.20\*.*” C:\OraInst\ /E /C /H /R /Y /Q
echo Installing Oracle 11g .Net Data Adapter
setup.exe -responseFile C:\OraInst\OracleInstallPrefrencesNew.rsp
rem setup.exe -silent -responseFile C:\OraInst\OracleInstallPrefrencesNew.rsp
) Else (
echo Oracle 11.1.0 client already installed, skipping
if exist c:\OraInst (
rmdir c:\OraInst /S /Q
)
)

if not exist “C:\Program Files\IBM\Client Access\READMESP.TXT” (
echo Installing IBM iSeries Driver
“\\somenetworklocation\iSeries Access Install Image w all Options\setup.exe” -s
) Else (
echo IBM iSeries Driver already installed, skipping
)

echo Installation Complete
echo NOTE: you may need to restart for the changes to take effect.
pause

Thanks to symantec’s forum for the inspiration for this one:
http://www.symantec.com/connect/forums/how-do-i-check-see-if-net-35-installed-continuing-install-job

===== ORACLE NOTES =====

Automating Oracle’s install requires an ini file of sorts.  The easiest way to generate this file is to run the install on a machine with the settings you’re interested in, like so:
setup.exe -record -destinationFile C:\OraInst\rec.rsp
Once you have that file you can use it to install like so:

setup.exe -silent -responseFile C:\OraInst\custom.rsp

There are some gotcha’s with this, one of note is the -responseFile option would not work for me when the file path had a space in it, even if I used the standard double quote escaping.  So
setup.exe -silent -responseFile "C:\Oracle Install\custom.rsp

wouldn’t work.
Also you can’t move the installer after generating it, if you do you will get a “Invalid staging area” error.  What I did to get around this was create a folder for installing, like:
c:\OracleInstallerVerx_xx_xx_x\
and generated the file there.  Then in the batch file copy the install from a network share to this local dir and then run setup.
Some more info on this is available on informit’s website here:
http://www.informit.com/articles/article.aspx?p=174771

===== iSeries NOTES =====

Automating iSeries works much the same as automating Oracle.  It creates an ini file of sorts when you run this command:
setup -r -f1d:\dir\file.iss
note that the flag "-f1" actually runs into the file and folder path, in this case: "d:\dir\file.iss". More here:
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzaij/rzaijcd.htm
To then install the app on subsequent machines run this:
setup -s -f1d:\dir\file.iss -f2d:\dir\file.log
-s indicates a silent install, -f1 is the ini file and -f2 is where the install logs messages to.  If you name the iss file this:
setup.iss, and put it in the same dir as the setup app you don’t have to provide the -f1 parm.  This is because the setup app will look for setup.iss automatically. More here:
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzaij/rzaijcd.htm

5 Comments

How to Remotely Enable Remote Desktop Connection

This has been very useful for me a number of times, how to remotely enable Remote Desktop Connection (assuming you’re an admin on the remote machine).

Use regedit (go start->run->type regedit->ok).
Connect to the remote machine (In regedit go file->Connect network registry…->Enter the remote machine’s name (no \\)->ok)
Go to this registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\fDenyTSConnections
if it doesn’t exist create it as a REG_DWORD (new DWORD Value), set it to 0

You may have to reboot the remote machine to get it to pick up.  Try remote desktop, if it doesn’t work run this command to reboot the remote machine:

shutdown -m \\theMachine -r

Thanks to many sites that I’ve found this on over the years, the most recent one being oreilly’s site:
http://oreilly.com/windows/archive/server-hacks-remote-desktop.html

Leave a comment