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..."
if ( $coservice.status.ToString() -ne "Running"){
"Colinux Service is NOT running ! Try to start Colinux Service..."
"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 ... "
"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
"Colinux-console (NT) already running !
"Quiting ..."



Post a Comment

Links to this post:

Create a Link

<< Home