Archive for the ‘Tutorial’ Category

Restart networked PC remotely through Command Line (CMD)

Wednesday, June 24th, 2009

First off, you will need administrative rights on the machine you are trying to reboot and make sure you are able to ping it.

Step #1

Start > Run, Type shutdown -i

Step #2

Select shutdown or restart

Vista Powershell Script fix

Wednesday, June 24th, 2009

Step #1

Go to Run and type regedit

Step #2

HKEY_Local_Machine\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.Powershell\ExecutionPolicy

Step #3

In that registry key, change value to Unrestricted.

Buy Windows Vista.

Deployment Image Servicing and Management (DISM) – WinPE 3.0 Boot Environment

Friday, June 19th, 2009

I recently compiled a new library of commands since the upgrade from WinPE 2.0 to WinPE 3.0. With Windows 7 coming along they released a new way to create bootable USB sticks using Deployment Image Servicing and Management (DISM.exe). You might be asking yourself, what could I use this for? We are using it at my work to re-image computers, capture backup images, mount images, etc. There are many other uses for it but I will not get into that here. I have literally done this procedure a couple hundred times. In a future article I will show you how to write a simple batch script to automate this process. But it helps to understand what is going on with each command in case you have trouble. Batch scripts never work 100% of the time.

You will need the following to proceed:
Windows® Automated Installation Kit (AIK) for Windows® 7 RC (Download from Microsoft) : 05.01.09

  • Windows® Automated Installation Kit (AIK) for Windows® 7 RC (Download from Microsoft) : 08.06.09
  • Bootable Flash drive (500MB or larger)
  • Once you have installed WAIK then you will need to browse to your start menu and click on “Deployment Tools Command Prompt”. I have provided a picture below.

    DISM

    DISM

    Once you have launched DTCP you will need to follow through the commands I have compiled below. The first one I have provided a screenshot.

    DISM – Step #1 – Prep/Cleanup

    DISM /Cleanup-Wim

    The DISM cleanup command simply cleans up any previous wims/mounts you have been working with. If you do this a lot, you will need to use this command otherwise you will start receiving errors from previous wims possibly still left on the system.

    DISM Step #1

    DISM Step #1

    DISM – Step #2 – Copy WinPE 3.0 to your local C Drive

    copype.cmd x86 c:\winpe_x86
    copy c:\winpe_x86\winpe.wim c:\winpe_x86\ISO\sources\boot.wim

    This creates a winpe_x86 folder on your C: drive and then copies the contents of the WinPE folder from the WAIK installation to your folder.

    DISM – Step #3 – Mounting .Wim File on your local C Drive

    Dism /Mount-Wim /WimFile:C:\winpe_x86\winpe.wim /index:1 /MountDir:C:\winpe_x86\mount

    This command mounts the wim file that was copied over in step #2 so that you can browse the system32 folder and insert your custom scripts, etc.

    DISM – Step #4 – Adding Packages to your WIM

    Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:”C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-wmi.cab”
    Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:”C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\en-us\winpe-wmi_en-us.cab”

    There are many packages you can add to your WINPE boot environment, these are two I always add to mine.

    DISM – Step #5 – Adding Drivers to WinPE

    DISM /image:c:\winpe_x86\mount /Add-Driver /driver:C:\YOUR_FOLDER_OF_INF_DRIVERS\ /recurse

    A nice addition to DISM over the previous peimg command in WINPE 2.0 is the ability to add drivers with the /recurse command. The /recurse command now allows us to simply have all of our drivers in their own directory and tell DISM to scan the root folder and everything beneath it. The number of sub directories won’t matter. I have a huge library of drivers, for example, you will want to have the network and vga drivers for anything that you boot up to in the WinPE environment. By adding the network driver to your WinPE boot environment, it allows you to access network shares for capturing and deploying .wim images.

    DISM – Step #6 – Adding Custom Scripts, Batch Files, Etc.

    xcopy /e /y “C:\YOUR_FOLDER_OF_SCRIPTS” C:\winpe_x86\mount\Windows\System32\

    Without adding anything to your WinPE boot environment you will simply be left with a command prompt window when booting to it on a computer. I have added over 15 different batch scripts with different functions. Click here to download my WinPE discs. One thing I highly suggest adding is GImageX. GImageX is a very small GUI program that you can add to be able to capture, deploy, and mount images within the WinPE boot environment. I have provided a picture of GImageX GUI below.

    For WinPE 3.0 Boot Environment - Mount, Deploy, Capture Images

    For WinPE 3.0 Boot Environment - Mount, Deploy, Capture Images

    DISM – Step #7 – Unmounting your finished .WIM

    Dism /Unmount-Wim /MountDir:C:\winpe_x86\mount\ /Commit

    This commits the final changes to your .WIM file and anything you added to it. It is very important to unmount your .WIM file when you have finished.

    DISM – Step #8 – Copies your .WIM to Boot ISO

    copy c:\winpe_x86\winpe.wim c:\winpe_x86\ISO\sources\boot.wim /Y

    DISM – Step #9 – Creates bootable .ISO of WinPE 3.0

    oscdimg -n -bc:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso

    Now, if you are wanting to use a flash stick you will need to format a flash stick in a certain way, and then simply copy the contents of the c:\winpe_x86\ISO\ to your flash drive. And thats it! Stick it in a computer, restart, and boot to it. The .ISO made in step #9 can simply be burned to a CD with Nero or other program capable of making bootable CD and then you can boot to it in the same way.

    DISM – Step #10 – Optional Backup

    xcopy /e /y “C:\winpe_x86″ E:\BACKUP_FOLDER_FOR_LATEST_BOOT_BUILD\

    This step is optional, but I always like to keep a backup for the future. Also, if you ever need to create another bootable flash stick or CD you can simply go to your backup and grab the files.

    Fixing Corrupt Vista Profile – Logged in as Temp

    Monday, March 16th, 2009

    1. Restart your PC to release the locks on your profile.
    2. Log on with another administrative account
    3. Delete C:\Users\%username%
    4. Delete C:\Users\TEMP
    5. Delete the registry key matching your SID from
    “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\ProfileList”. Check the value “ProfileImagePath” to make sure you pick your own profile.
    6. Restart once again and then you’re done!

    Microsoft Windows Vista SP1

    Microsoft Windows Vista SP1

    Fix CLS Send or MAPI Error in Email

    Friday, March 13th, 2009

    In Window/System {or Windows\System32}, rename the Mapi32.dll file, and then start the Fixmapi.exe program by:

    1. Close all programs.
    2. Click Start, and then click Search.
    3. Click All files and folders.
    4. In the All or part of the file name box, type mapi32.dll, and then click Search.
    5 When the search process is complete, right-click the mapi32.dll file in Windows\System {or Windows\System32}, and then click Rename. (Note: if mapi is in memory, you will not be able to rename it. Click Ctrl-Alt-Delete and End Task on mapiisp32. Verify it’s not running before trying to rename it.)
    6. Type Mapi32.old, and then press ENTER.
    7. click Start a new search, and then click All files and folders.
    8. In the All or part of the file name box, type fixmapi.exe, and then click Search.
    9 When the search process is complete, double-click Fixmapi.exe to start the repair process.
    10. Follow the on-screen instructions to complete the MAPI repair process for Outlook.

    Microsoft Outlook 2007 Logo - Icon

    Microsoft Outlook 2007 Logo - Icon

    Windows XP SP3 Sysprep – Copy User Profile

    Friday, March 13th, 2009

    The line below needs to be added to the unattended section in the sysprep.inf file. The Unattended section should look like the following below.

    [Unattended]
    InstallFilesPath=C:\sysprep\i386
    UpdateServerProfileDirectory=1

    This will make sure the administrator profile is copied over to the default profile for ever user.

    Windows XP Logo

    Windows XP Logo

    Java 1.6.0.12 .msi package for distribution

    Thursday, February 19th, 2009

    Last msi package I tested today was Java. They also offer the msi package on their website. First you need to download their “offline installation” executable here. Then run the executable but don’t go through any additional prompts. Navigate to LocalAppData folder (the user’s Application Data folder). The location of the LocalAppData folder differs for each Windows platform.

    * Windows Vista: C:\Users\\AppData\LocalLow\Sun\Java\jre1.6.0_12
    * Windows XP: C:\Documents and Settings\\Local Settings\Application Data
    * Windows 2000 C:\Documents and Settings\\Application Data

    Copy the contents out of that folder to where you are keeping your msi distribution packages. The folder should look like the picture below without the install.bat which is my batch file.

    Java Directory Contents

    Java Directory Contents

    Here is the command I used for a quiet install for multiple users:

    msiexec /i "jre1.6.0_12.msi" SETMULTIUSER=1 /qb"

    Works fine for multiple users under windows 2000, XP, and Vista. More MSI package instructions coming tomorrow along with some tutorials on ImageX/Sysprep for Vista.

    Java 1.6 Logo

    Java 1.6 Logo

    Adobe Reader 9.0 .msi package for distribution

    Thursday, February 19th, 2009

    Adobe actually offers their .msi through their website. You have to sign up to be a distributor here and it takes them a few minutes to confirm your verification email. They email you a temporary link which contains a download package. You can read further here about how to extract the .msi package from the Adobe download.

    Once you have the .msi and .cab files, etc., in a directory I then used this command. This is the same command as used with the Firefox package.

    msiexec /i "AcroRead.msi" SETMULTIUSER=1 /qb"

    Adobe Reader 9.0 .msi package

    Adobe Reader 9.0 .msi package

    Mozilla Firefox 3.0.6 .msi package for distribution

    Thursday, February 19th, 2009

    First app I was trying to repackage was Mozilla Firefox version 3.0.6. After several unsuccessful attempts I discovered that FrontMotion already repackages Mozilla Firefox into msi packages and distributes them on their site.

    I have been having a hard time with the repackager on AdminStudio when it comes to multiple users. With ALLUSERS=1 this is suppose to do a Per-Machine install which means that it points to the install location. But the MSI’s have been trying to repair themselves from the first install location when new users launch them for the first time. I want to be able to remove the MSI’s from the machine after install.

    This is the command I am using to do a quiet install for multiple users and it works successfully. I tested under multiple accounts on XP VM and Vista workstation.

    msiexec /i "Firefox-3.0.6-en-US.msi" SETMULTIUSER=1 /qb"

    I am the student manager for the IT department at Walla Walla University and so we do a lot of re-imaging, formatting student’s computers, faculty, staff, etc. It is very nice once you have a few .msi packages you can write a simple batch script that once executed will do a silent install of all the apps and once finished launch Windows Updates. This can literally save you hours per machine.

    Firefox 3 Logo

    Firefox 3 Logo

    Show Hidden Files in Mac OS X Finder

    Friday, February 6th, 2009

    I recently switched over from PC to Mac and when I was looking through my folders I realized some things were missing. The folders missing all were named with a period coming before the name. The purpose was for them to arrange themselves at the top when folders are arranged alphabetically. However, on a Mac, in OS X a period before the name means that it becomes a hidden folder / file.
    Below is the command to show the hidden files in the Mac OS X Finder.

    Open up the terminal and type the following commands:

    defaults write com.apple.finder AppleShowAllFiles TRUE
    killall Finder

    Also, to revert back to normal, here is the command:

    defaults write com.apple.finder AppleShowAllFiles FALSE
    killall Finder