Friday, July 9, 2010

Vmware Project Onyx

VMware Onyx is cool project, it converts mouse click actions to power shell script for automation. I tested with it and found it very useful.

You can download and participate in communities using blow link,

www.vmware.com/go/onyx

Enjoy Scripting!

Script to report the Folders not accessed for some period - PowerShell

In File servers there would be many folders which wouldn't be accessed for a long time. We can archive to slower disks/delete it to save space.

To report the folders not used for a period to a excel, we can use the below script. I've put the period as 365 days. We can edit the script even to delete.

trap{continue}
clear
$excel = new-object -comobject excel.application
$excel.visible = $false
$workbook = $excel.workbooks.add()
$sheet = $workbook.WorkSheets.Item(1)
$sheet.cells.item(1,1) = "FileName"
$sheet.cells.item(1,2) = "LastAccessDate"
$sheet.cells.item(1,3) = "Path"
$sheet.cells.item(1,4) = "Is it a FOLDER"
$today = Get-Date
$lastaccess = $today.adddays(-365)
$x = 2
$strpath = "c:\access.xls"
$1 = get-ChildItem "e:\" -Recurse | where {$_.lastaccesstime -le $lastaccess} | where {$_.psiscontainer -eq $true}
foreach ($file in $1) {
$sheet.cells.item($x,1) = $file.name
$sheet.cells.item($x,2) = $file.lastaccesstime
$sheet.cells.item($x,3) = $file.FullName
$sheet.cells.item($x,4) = $file.PSIscontainer
$x++}
$range = $sheet.usedRange
$range.EntireColumn.AutoFit()
out-null
IF(Test-Path $strPath){
Remove-Item $strPath
$Excel.ActiveWorkbook.SaveAs($strPath)}
ELSE{
$Excel.ActiveWorkbook.SaveAs($strPath)}
$excel.quit()
spps -name excel

Wednesday, April 28, 2010

Disable/TurnOff DEP in Windows 2003

Some applications need DEP to be turned off. We can exlcude the process by going to

MyComputer > Properties > Advanced > Settings(Performance) > Data Excecution Prevention

Add the program to be excluded.

To Disable it completely, Edit boot.ini file. Add/change /Noexecute=AlwaysOff. Reboot System.

Wednesday, April 21, 2010

Integerated Remote Console is unavailable, it is already in use by different client (HP ILO)

You may get this error, if the ILO is already opened by some one. We could aquire the session by changing a setting, be aware this would disconnect the other user. Below are the steps to do it,

- Open the Web administration page and browse to the required device in Device Bay.
- Select ILO > Web administration
- In the Web administration > Remote Console > Settings > Enable "Remote Console Acquire" > Apply










This sould enable you to take control.

Happy Administration :)

Saturday, April 17, 2010

Wifi-ADHoc support in Android

wifi connectivity using AP mode and GPRS works great

This post is related to enabling Wifi-ADHoc support in android 1.5, its simple and it works great. I tried this in HTC hero, i beleive it should be same for other make.

- Your phone should be rooted. Take a look at this link to root, http://theunlockr.com/2009/08/27/how-to-root-your-htc-hero-in-one-click/

- You should have android SDK in your computer. If not download from this http://developer.android.com/sdk/index.html

- We need to edit 2 files "tiwlan.ini" & "wpa_supplicant.conf". Ensure you take the backup of these files before editing.

- Pull the both the files from the mobile to the computer, this would be easy for editing.

adb pull /system/etc/wifi/tiwlan.ini tiwlan.ini
adb pull /data/misc/wifi/wpa_supplicant.conf wpa_supplicant.conf

- Edit the file as below
* In twilan.ini file set WiFiAdhoc = 1 (Will be 0 by default)
* Add the below 2 lines to the file
dot11DesiredSSID = Android (Wifi adhoc name configured in the computer)
dot11DesiredBSSType = 0

* In wpa_supplicant.conf, replace the contents with the below.
ctrl_interface=tiwlan0
ap_scan=2
network={
ssid="android"
scan_ssid=1
mode=1
key_mgmt=NONE
}

- Restart Wifi, it should detect your wifiadhoc networks.

Enjoy & have fun!

Sunday, January 10, 2010

Running Scripts in Remote Sytems

As a System Administrator we would want to run some simple scripts in multiple computers. Microsoft has some great tools to ease the job, PsTools is really powerful easy tool.

PsTools is a bundle, we are look at PsExec. Which can be used to run scripts on remote computers.

Below is a simple example to find uptime of multiple systems and dumping to a file.

- Enter the system names in a notepad and save as a batch file (eg. mc.bat)
- Have a script written and save it as a batch file. (eg. uptime.bat "systeminfo | find "Up Time")
- This script will write the uptime of the systems on the command prompt
- Now use the tool to run it. Ensure you are in the directory where the tool is. Also ensure admin share is enabled in the remote systems.
psexec @mc.bat -u "username" -p "password" /c "path to script"
- This will execute the script in the remote systems mentioned in the mc.bat file.

Just makes our task easier. We can lots with this. Have it downloaded and explored in the below link,
http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx

Enjoy Scripting!

Saturday, December 19, 2009

XP - Useful RUN commands


If you are a Windows XP user and love to work with the keyboard fast, below shortcuts would help,