Monday, July 5, 2010

Map and unmap IPC$ with VBscript

I assume you know what an IPC$ mapping is for.

This will create the mapping:

dim objNetwork: Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "", "\\ser\IPC$", False, "user", "password"

And this will remove the mapping:

dim objNetwork: Set objNetwork = CreateObject("WScript.Network")
objNetwork.RemoveNetworkDrive "\\ser\IPC$", True

Wednesday, March 31, 2010

Gnome: Applications that starts on startup that aren't configured

There were applications that launched automaticaly when I logon and they weren't in System/preferences/startup applications. So I asked for help and I have been told to look in ~/.config/autostart where each file in that location was a launcher for an application at startup. But there was none.

As root, I did the following command in my home folder:

grep -R 'rhythmbox' .*

Then I found the culprit.. I had three files in the following folder:

~/.config/gnome-session/saved-session

Each of them was a launcher for an application that started. I deleted them and now my problem is solved.

I believe this is a bug as they were launchers created when I had the "Remember running applications" option enabled and then disabled it. Disabling the option should have deleted the launchers but it didn't. This may be fixed as I'm writing, and I could try to reproduce it but... LAZY

Thursday, March 25, 2010

Blue Screen Stop 0x000000EA nv4_disp

I had this BSOD on a computer witrh Windows XP and a Asus M2V motherboard.

A quick search revealed many solutions, most of them leading to disabling some AGP or other graphic card related features on the BIOS. But this motherboard has a BIOS with very few options, so no graphic card reladed options were available.

I googled further more and found out that there was a BIOS update for the M2V to improve system stability with GeForce 8 series cards.

I applied the latest update and the BSOD problem was gone.

I also noticed there was a LOT of updates for this board, most of them about memory compatibility... I guess I wouldn't recommend this board, unless updated!

Monday, March 22, 2010

Value 0 in line from paragraph [WinntDirectories] with Key "0"

This error happened when I was trying to repair a windows installation using RIS:
The following Value in txtsetup.sif is wrong or missing
Value 0 in line from paragraph [WinntDirectories] with Key "0"
Yep, no line number. I looked in google and found nothing! So I started with something simple and yet, it worked. Unbelievable :P

So, to fix that, using notepad, open the txtsetup.sif located in the i386 folder of the RIS image (remoteinstall\setup\[lang]\images\[image name]\i386) and add the following code to the [WinntDirectories] section:
0 = "\"
So it should look like this:
[WinntDirectories]
0 = "\"
1 = "\"
Save & Close, and there you go. Strange, eh?

Windows XP Recovery Console over PXE

What you need:
  • A working RIS server with a working Windows XP CD Image
NOTE: If you use RIS to install Windows XP manually (not unattended) and can already enter the recovery console through the welcome page, then stop here because that exactly what this guide shows. Well, almost. It shows how to use an existing CD Image with unattended setup and add the possibility to also start it without skipping the welcome screen.

Now that's quite simple, but MS docs weren't that obvious... Just put the following code:
[data]
floppyless = "1"
msdosinitiated = "1"
OriSrc = "\\%SERVERNAME%\RemInst\%INSTALLPATH%"
OriTyp = "4"
LocalSourceOnCD = 1

[SetupData]
OsLoadOptions = "/noguiboot /fastdetect"
SetupSourceDevice = "\Device\LanmanRedirector\%SERVERNAME%\RemInst\%INSTALLPATH%"

[UserData]
FullName = "%USERFULLNAME%"
OrgName = "%ORGNAME%"
ComputerName = %MACHINENAME%

[RemoteInstall]
Repartition = no
[OSChooser]
Description ="Microsoft Windows XP Professional - Recovery Console"
Help ="Allows user to perform repair operations, without local media, of a Windows Professional installation."
LaunchFile = "%INSTALLPATH%\%MACHINETYPE%\templates\startrom.com"
ImageType =FLAT
Version="5.1 (0)"
In the following file:
[Drive letter]:\RemoteInstall\Setup\[Language]\Images\[Windows CD Image]\i386\templates\console.sif
In my case, it was E:\RemoteInstall\Setup\French\Images\WINDOWS\i386\templates\console.sif

Now, make sure the i386 folder contains a suitable Windows 2000 driver for your PXE client(s) and restart the RIS server.

You should now have a new option to select from the RIS menu. You will notice it's the same text based setup as a normal XP Installation, only it won't do anything automatically so you can press R at the welcome screen and enter the Recovery Console.

Thursday, March 18, 2010

Gparted over PXE using NFS

GParted website already has some docs about booting over PXE but it requires an HTTP server which you may not have or want to set up. Here's an How-to based on NFS, which is often used.

Make sure you've got an iso of GParted Live version 0.5.1-3 or earlier.

Then, use your favorite software (I use 7zip) to extract its content to a folder on your PXE server tftproot.

Take the necessary steps to share that folder using NFS (Network File System). If you use Linux, there is plenty of help available for that already. If your server is Windows based, then take a look at this how to (miror).

Now create an entry in your pxelinux.cfg/default file based on this one:
LABEL gparted
kernel vmlinuz
append initrd=initrd.img boot=live union=aufs netboot=nfs nfsroot=:/PATH/TO/ISO/CONTENT
And there you go!

Loading the entire ISO in a ramdisk also works but I find this dirty and unefficient :P

Avira Antivir Rescue over PXE


What you need:
  • A working PXE system with PXELinux
  • A linux environment (a live cd will do)
  • 7zip

Now, here's what you need to do! Don't worry, those are easy steps. I've included too many rather that not enough, along with comments so you understand each one of them. If all goes well, you'll be done in 15 minutes.
  1. Download rescue_system-common-en.exe from Avira website (unless you can download the ISO, in this case download it and go to step 4)

  2. Use 7zip to extract the content of rescue_system-common-en.exe to a temporary folder.

  3. There should be a large file in ".rsrc\RCDATA". This is an ISO file.

  4. Use 7zip to extract the content of the large file to another temporary folder (rename the file with the ".iso" extention if needed)

    Avira Rescue scans for its scanner files on local devices (such as CD) and copies them to its local filesystem. But with PXE, the only thing available is vmlinuz and initrd.gz. We'll be tweaking the latter to include those files as Avira Rescue does not support NFS (although it does support wget but that's another story and needs a web server).

    Now, start your Linux environment and get access to the extracted iso files, where initrd.gz is located. We need to unzip it, resize it so there's space left for updates, mount it, include the needed files in it, unmount it, and zip it back.

  5. Everything should be done as root
    su

  6. Unzip initrd
    gzip -d initrd.gz

  7. Add 50MB of free space to initrd
    dd if=/dev/zero bs=1M count=50 >> initrd

  8. Check the file to make sure everything's fine and fix anything wrong
    e2fsck -fp initrd

  9. Make the filesystem included in initrd use the extra space
    resize2fs initrd

  10. Make a temporary mount location
    mkdir iso

  11. Mounts the initrd filesystem to iso
    mount -o loop initrd iso

  12. Go into the iso folder and there, make this directory tree (Case sensitive):
    media/Devices/pxe

  13. In the extracted ISO files, there should be a folder named "Antivir". Always as root, copy the entire content of this folder to the pxe folder you just made.

  14. In the pxe folder, do the following to make sure the antivir file locaded in the pxe folder is executable!
    chmod a+x antivir

  15. Now leave the iso folder

  16. Unmount the filesystem
    umount iso

  17. This will tell you the size of initrd. Take note of it.
    ls -lk initrd

  18. Zip the initrd file using maximum compression.
    gzip -9 initrd

  19. Now, copy the newly tweaked initrd.gz file, AND the original vmlinuz file form the extracted iso files to your PXE server.

  20. edit your pxelinux.cfg/default (or whatever) file and add an entry based on this one:
    label 1
    MENU LABEL ^Antivir Rescue System
    KERNEL antivir/vmlinuz
    APPEND vga=769 initrd=antivir/initrd.gz ramdisk_size=185000 root=/dev/ram0 rw console=/dev/vc/4

  21. Change the value of "ramdisk_size" to the value noted at step 17 plus a few. I had 184747 so I put 185000.
    Note: At this stage, you could also look at the isolinux.cfg file located in the extracted iso for some more boot options.

And voilĂ , you should have a working Antivir Rescue working over PXE!

Thanks go to:
NiteHawk for helping me out in this thread
Avira for choosing Linux as a base system for your tool! FREEDOM!!! :thumbsup:

Wednesday, March 10, 2010

How to run for trouble

Looking for trouble? Simple! Hire an admin who's in a foreing country to replace everything your local IT Tech has done.

Want to piss your local tech off too? When your system needs physical maintnance, hire him back to debug your new system with all devices locked and no references...

While he's there, ask him to take a bite off your super duper foreing admin's butt and say it's ice cream.

/sarcasm

Linksys WRV54G Review

Cute Router! Cheap, has VPN support and a removable antenna with a standard plug! wow! I'm in!

...

STAY AWAY!!! It will give you headaches. Unstable as hell and some people are having issues with the wireless as well. But the WORST part is the VPN. It just don't work. Happy for you if it does, you're in the lucky few. There has been reports since 2004 about crappy VPN on various forums, even on cisco's but NO official fix or workaround.

So it fails at doing pretty much everything it was designed for. Except being cute. I fell for it. Just look at it, and don't touch it or you'll most likely get cancer...

Monday, March 8, 2010

Got it working

Just a few tips that might save you a lot of time.

after installing tftpd-hpa, as always the docs aren't helping a lot.
config file: /etc/defaults/tftpd-hpa
log file: /var/log/daemon

and if you set tftpd to daemon mode in its config file and encounter the following error in the log:
cannot bind to local socket: Address already in use
Then edit the /etc/inetd.conf file and comment out the line with TFTP in it and restart the machine (I've read there could be better ways to do it but haven't got that far)

oh and the TFTP-HPA installation won't create the tftpboot folder for you.

Keep in mind that the filename option it relative to the path given in the tftp configuration. For instance:
filename "pxelinux.0"
would be correct, but
filename "/var/lib/tftpboot/pxelinux.0"
would not.

I also needed the SYSLINUX package which contains PXELINUX but there's no obvious mention of it in the docs, if any. The file we're looking for are in /usr/lib/syslinux

It took me a couple of houres to accomplish the setup (you can tell by the hour of my previous post and this one's) and if I were to do this all again, it would take 30 minutes at most.

I have to admit that it's a bit frustrating that most of the time spent on this project was for meaningless details that should've been documented. RTFM they say... Oh well, I'm getting used to it as I prefer that kind of research which I will benefit rather than paying truck loads of money for software.

HEY let's drink herbal tea for a change :D

BOOTP vs PXE

I've been playing with the PXE concept in the past two weeks. For work that is, using MS Server 2k3's DHCP, Active Directory, DNS, WDS and RIS (man there are just too many acronyms in that field, it's just insane. I could've named a couple of others but let's just stop here).

Now I'm trying to build that kind of system here, using my own and trusty Debian server. So I thought I could start by installing a PXE Daemon but then I wondered, what about BOOTP? pxe daemon package in Synaptics Package Manager says I NEEDED a PXE daemon but... After a while on google, it's pretty much the only place it says that. In fact I only need a TFTP server in addition to what I already have.

So here's the answer: whether I need a PXE daemon or not depends on which PXE boot loader I'm using. Some need it, some don't. The syslinux ones don't need it. Since I plan on using PXELinux, that pretty much sums it up. I've even read comments about people who never heard of PXE daemons.

So unless you KNOW you REQUIRE a PXE Daemon, just don't bother.

BOOTP seems to be an outdated DHCP.

Oh and from what I've gathered overall, PXE is just a concept. What actually exist are a DHCP server and a TFTP server. You most likely know what a DHCP server and a FTP server are so you already know pretty much everyting.

In short, your old machine boots using its NIC and then gets info from the DHCP which contains where the TFTP server is and what is the file to download from the TFTP server. Your machine then downloads the file and then boots it.

Simple eh? Now I wonder why MS and other sites make it so complex.

Now I'm gone checking if I was right :P

Thursday, March 4, 2010

Missing WMDRMSDK.DLL and/or mfplat.dll

I've been trying to install Windows XP SP3 with a lot of updates slipstreamed into it, using Windows Remote Installation Service (RIS). Around midway, I got a message saying:
"This application has failed to start because WMDRMSDK.DLL was not found. Re-installing the application may solve this problem."
I searched the net for some answers and followed some steps to fix this, but also then I got the following:
" The procedure entry point MFPlatformStartup could not be found in the dynamic link library MFPlat.dll."
Those messages can also happend if you install from CD. These files are needed by Windows Media Player. God do I hate this piece of software...

I've been able to completely fix the problem without doing some steps I've read. It's very simple. Just follow these simple steps:
  1. get a copy of WMDRMSDK.DLL and MFPlat.dll (found in c:\windows\system32) from a working and up to date Windows XP installation. Home or Pro will do. (Some people have had trouble with files taken from download-the-dll-for-free sites)
  2. copy these two files directly in the i386 folder of the installation source
  3. Edit the TXTSETUP.SIF file in the i386 folder of the installation source and put the following text in the corresponding section:

    [SourceDisksFiles]
    wmdrmsdk.dll = 100,,,,,,,2,0,0
    mfplat.dll = 100,,,,,,,2,0,0
That's it. No need to touch the dosnet.sif file. I got rid of the errors with this. Hope this helps some people!