Blog

Reset HP ILO Via the Command Line

Log on to the HP iLo using SSH and execute the following commands (in BOLD)…

</>hpiLO-> cd /map1
status=0
status_tag=COMMAND COMPLETED

</map1>hpiLO-> reset
status=0
status_tag=COMMAND COMPLETED
Resetting iLO.

CLI session stopped

Your SSH session will be terminated and should be able to connect via the web interface.

Read More

Create a windows 7 Bootable USB thumbdrive

Here are the steps that i followed to create a bootable USB drive.  Also if you have a USB drive that has U3 installed on it you may want to uninstall it prior to continuing.  Here are the instructions on how to uninstall U3 http://www.u3.com/uninstall

Format the Flash Drive

Run CMD.EXE and type the following.  Note: This set of commands assumes that the USB flash drive is addressed as ”disk 1″.  you should double check that by doing a list of the disks (type “list disk”) before cleaning it. 

  1. diskpart
  2. select disk 1 (assuming disk 1 was your thumb drive in the above list disk command)
  3. clean
  4. create partition primary
  5. select partition 1
  6. active
  7. format fs=fat32
  8. assign
  9. exit

Copy the Contents of the DVD to the USB Drive

Simply issue the following command to start copying all the content from the Windows 7 DVD to your newly formatted high speed flash drive.

  • xcopy d:*.* /s/e/f e:

And that’s it.  Boot up the machine, have it boot off the USB drive, and watch how fast the installation completes.

Read More

Rename Local Administrator Password

here is a script to rename the local administrator password using powershell… it renames the administrator account to the “!computerName”…

Remember to run powershell as administrator.

$Bang = “!”
$NewComputerName = gc env:computername
$NewAdminAccount = $Bang+$NewComputerName $admin = [ADSI]“WinNT://./Administrator,user” $admin.psbase.Rename(“$NewAdminAccount”)

Read More

powershell ping test

A way to test to see if the server is pingable

PS > # Using .NET method to ping test the servers
PS > $ping = new-object System.Net.NetworkInformation.Ping
PS > $ping.send($strComputer)

Status        : Success
Address       : 192.168.1.1
RoundtripTime : 0
Options       : System.Net.NetworkInformation.PingOptions
Buffer        : {97, 98, 99, 100…}

 

# Using .NET method to ping test the servers
$ping = new-object System.Net.NetworkInformation.Ping

$Reply = $ping.send($strComputer)
if($Reply.status -eq “success”)
{
#Do something here …
}

Read More

Compress Files with Windows PowerShell

Here are a few fuctions on how to create, update and extract a zip file within powershell. 

1. Create a New Zip

function New-Zip{

param([string]$zipfilename)
set-content $zipfilename (“PK” + [char]5 + [char]6 + (“$([char]0)” * 18))
(dir $zipfilename).IsReadOnly = $false

}

usage: new-zip c:demomyzip.zip

2. Add files to a zip via a pipeline

function Add-Zip
{

param([string]$zipfilename)
if(-not (test-path($zipfilename)))

{

set-content $zipfilename (“PK” + [char]5 + [char]6 + (“$([char]0)” * 18))
(dir $zipfilename).IsReadOnly = $false

}

$shellApplication = new-object -com shell.application
$zipPackage = $shellApplication.NameSpace($zipfilename)
foreach($file in $input)
 {
            $zipPackage.CopyHere($file.FullName)
            Start-sleep -milliseconds 500
 }

}

usage: dir c:zipFiles*.* -Recurse | add-Zip c:zipFile.zip

3. List the files in a zip

function Get-Zip

{

param([string]$zipfilename)
if(test-path($zipfilename))

{

$shellApplication = new-object -com shell.application
$zipPackage = $shellApplication.NameSpace($zipfilename)
$zipPackage.Items() | Select Path

}

}

usage: Get-Zip c:zipFile.zip

4. Extract the files form the zip

function Extract-Zip

{

param([string]$zipfilename, [string] $destination)
if(test-path($zipfilename))

{

$shellApplication = new-object -com shell.application
$zipPackage = $shellApplication.NameSpace($zipfilename)
$destinationFolder = $shellApplication.NameSpace($destination)
$destinationFolder.CopyHere($zipPackage.Items())

}

}

usage: extract-zip c:zipFile.zip c:destination

Read More