PowerShell Remoting Project Home

Friday, December 09, 2005

My First MSH Script


#===========================================================
#This script will check colinux service, start a colinux console (NT).
#This script comes with NO warrenty! Use at your own risk!
#===========================================================

"Cheching Colinux Service...."
$CoService = get-service Where-object {$_.ServiceName -like "*colinux*"}
if (!$CoService) { throw "Colinux Service Not Installed ! "}
"Found Colinux Service..."
$CoService
if ( $coservice.status.ToString() -ne "Running"){
"Colinux Service is NOT running ! Try to start Colinux Service..."
$coservice.Start()
}
"Colinux Service Is Running ! Get Colinux-daemon Process..."
$CoProcess = get-process Where-object {$_.ProcessName -like "*colinux-daemon*"}
if (!$CoProcess){ throw "Colinux-daemon Is Not Running ! " }
"Colinux-daemon Is Running ... "
$CoProcess
"Try to start Colinux console..."
$CoConsoleProcess = get-process Where-object {$_.ProcessName -like "*colinux-console*"}
$CoPID = [string] $CoProcess.Id
if (!$CoConsoleProcess){
D:\colinux\colinux-console-nt -a $CoPID
}
else{
"Colinux-console (NT) already running !
"Quiting ..."
}

Tags:    


Comments:

Post a Comment





<< Home