Windows – No Disk

The other day a client calls up and says she keeps getting a “Windows – No Disk” window, that will not go away no matter how many times she closes it.  I then asked when did this problem appear, in which she replied “after I pulled out the USB Flash Drive”.  So at this point I was thinking that some files she was working on, wanted to save themselves to the usb flash drive and could not since the drive was not present, thus causing the annoying “No Disk” error.  I then instructed her to save her work elsewhere on the hard drive and restart her workstation.  Windows - No Disk ErrorUnfortunately however, after she restarted her workstation and logged in the error continued to pop up!

Since the restart didn’t solve the issue, I knew it was time pull out my best tool in the shed “Google Search”.  After a couple google searches and a couple forums, I found out that the reason for this error is due to a usb driver that became corrupted during installation. The solution is to uninstall the usb drivers and reinstall them.

Once I had uninstalled all the usb drivers in Computer Management and restarted the workstation, the “Windows – No Disk” error appeared no more.  Mere mortals can only guess why the usb driver became corrupted in Windows, but thanks to google and a post on technet this XP annoyance was solved!

References:

http://social.technet.microsoft.com/Forums/en/itprovistahardware/thread/d5f38918-d11b-45c4-861d-b53aa3dbdaed

  • Share/Bookmark

NTBACKUP error – “End of Media encountered while backing up to non-removable media.”

Today I was investigating why some ntbackup jobs were failing on a remote server, and came across this error message in the logs : “End of Media encountered while backup up to non-removable media”. So I googled the error, and came up with a couple forums talking about how backups being saved to tape drives get this error when the tape runs out of space.  In my situation however, I was not using a tape drive for the backups, I was using an external hard drive.

Below is a screenshot of the NTBACKUP log

NTBACKUP log error

As you can see in the NTBACKUP log, when it tried to backup the files to the external hard drive it encountered the “End of Media” error.

So at this point I was hitting my head against the wall wondering why in the *(#$ is this happening!!?  The external hard drive had plenty of free space for the backups, it just didn’t make any sense!!  As a usual Sysadmin response I decided to dig dipper into the issue.  After thinking it though a bit, I had some inspiration to check “Computer Management” and take a look at the partition and filesystem setup of the external hard drive.  Below is a screenshot of what I discovered in Computer Management:

computer management - bestsrv

If you look volume E: in the top right, under filesystem it reads “fat32″! Once I saw that it occurred to me that the backups were failing because they exceeded the 4GB file size limit of the fat32 filesystem.  Sure enough after checking the backup sizes It was just barely over 4GB which would explain why NTBACKUP reported that the disk was out of space.  After discovering the true cause behind the failing backups, I backed-up all the data on the Western Digital MyBook, reformatted it with NTFS, and transferred all the data back onto the external drive.  That effectively solved the issue and allowed the customer to continue to backup the server without buying any additional hardware.

It just comes to show that most problems are simple to fix and easy to overlook.

References:

http://www.experts-exchange.com/Storage/Misc/Q_20710438.html

http://en.wikipedia.org/wiki/File_Allocation_Table

  • Share/Bookmark

Powershell built-in GUI Editor!!

Many of you have probably been on the look for a gui editor for the new windows powershell, well look no more!  Microsoft has included a built-in gui editor for powershell (I didn’t even know until now), and all you need to do to run it is follow one of the 2 ways below.

Method 1

1. Click Start
2. Type “Powershell ise” and hit enter
3.  The Powershell integrated scripting environment will then start!

Method 2

1.  Open powershell
2.  In the console type: “powershell_ise.exe”
3.  Hit enter.

Below are some screenshots for reference:

powershell - run ise

Below is a screenshot of what the Powershell ISE looks like.  Check it out!

powershell editor

The powershell gui editor basically works like this:  The top area is your script editor, the middle area is where you will see the output/results of your powershell script and commands.  The bottom area is where you can enter powershell commands as if you were on the powershell command prompt.

Once you start using it, I am sure you will see a increase in productivity while creating/testing scripts.  This is because it allows you to edit a script, run it, see it’s output, and even run commands as if you were at the command prompt.  It’s streamlined everything you could want or need into one program!  +1 point for Microsoft! (we’ll see how long that lasts lol).

Well what are you waiting for?  Lets get scripting!

Powershell Download Links

1.  Powershell 2.0 CTP

  • Share/Bookmark

Unattended FTP script to download files

Looks like I also found a nice quick way to download files off my webserver using a ftp script.  It’s so simple that I don’t know why I didn’t even think of it before!  Before I had this script, I had to manually download my sysadmin-tools from my website onto the remote servers I was doing maintenance on that particular day.  That took about 3-5 minutes each time I had to download the tools I had in a zip file on my webserver, which as you can imagine get really repetitive and annoying after a while.  So after about the 50th time downloading the sysadmin-tools, I decided to automate it!

This is how I approached creating the script:

1.  It has to work out of the box with Windows (I administer and maintain Windows Server 2003 boxes)

2.  It had to connect to my webserver using my username and password

3.  It had to change directories on the server to the download directory

4.  K.I.S.S (keep it simple stupid!)

Decisions:

After reviewing the script requirements, I decided to write a simple batch script using the built in FTP command in windows.  I didn’t know windows had a built in FTP command to tell you the truth until I starting writing the script.

Unattended FTP Script:

Below are the contents of the batch file:

@echo off

ftp -s:ftpscript.txt

Below are the contents of the ftpscript.txt file:

open
yourserver.com
username
password
cd “/public_html/yourdownloadfolder”
binary
get “sysadmin-tools.zip” “C:\Users\username\Desktop\sysadmin-tools.zip”
quit

Explanation:

It’s pretty straightforward, the batch file using the ftp command to start the built-in ftp program in windows.  After that the batch script calls the “ftpscript.txt” file to supply the ftp command to execute.  In the ftpscript.txt file it basically says to connect to a server, enters a username and password, then changes directories to the directory that contains the file you wish to download, switches the FTP mode to binary so it will download the .zip file correctly, downloads the file to somewhere on my Desktop, and finally quits FTP.

FTP Modes:

Make sure you are downloading in the right FTP mode!! I was getting corrupted files at first when I was making the script because I was downloading the .zip file in the wrong mode.  Once I changed to binary it downloaded successfully without any corruption issues.

Text files (html, php, css, java) — use text mode
Multimedia files (images, audio, video) — use binary mode
Programs (.exe, .class, .jar, .swf) — use binary mode

References:
http://www.robvanderwoude.com/ftp.php
http://www.bluehostforum.com/showthread.php?t=9311

  • Share/Bookmark

Shutdown script did not shutdown the sever! Exit Code 0x4f7

Well recently a shutdown script that I wrote did not shutdown a server successfully for some odd reason.  The script looks like the following:

shutdown -r -t 20 -c “Shutting Down to Install Windows Updates”

So until now this script has been working flawlessly on multiple servers.  I’ve been able to schedule automatic reboots of remote servers easily using this script in combination with windows scheduled tasks as well.  It comes in handy when you need to reboot the server at a specific time, such as 5:25PM or 1:26AM, which is great for me since I do a lot of remote server maintenance and do not have physical access to these servers.

Anyway, after trying to reboot this one server it gave me a exit code of (0x47f) which showed up in the scheduled tasks log.

scheduled tasks 0x4f7

After Looking up the exit code, I found a website that directed me to convert 47f to decimal and enter the decimal value “net helmsg” in the command line.  The command I entered was “net helpmsg 1271″, which gave me the following answer: “The machine is locked and can not be shut down without the force option”.

net helpmsg 1271

Well isn’t that great!  A error code that is easily understandable from Microsoft!

The solution to this problem was to edit my script to include the force option.  Here is the updated script below:

shutdown -r -f -t 20 -c “Shutting Down to Install Windows Updates”

And that should do the trick.

References:

http://www.tech-archive.net/Archive/Windows/microsoft.public.windows.terminal_services/2006-08/msg00331.html

  • Share/Bookmark