search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Powershell | No Comment | 7,575 views | 14/07/2012 21:45

If you install Parallels Plesk before, you should be aware about “Welcome Banner” of Plesk. It’s pretty cool! I did same thing on Powershell and made it function.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function Get-PoSHWelcomeBanner
{
param ($Hostname, $Port)
 
	# Get Hostname
	if (!$Hostname -or $Hostname -eq "+") 
	{
		$Hostname = "localhost"
	}
	else
	{
		$Hostname = @($Hostname.Split(","))[0]
	}
 
	# Get Port
	if ($Port -ne "80")
	{
		$Port = ":$Port"
	}
 
	clear
	Write-Host " "
	Write-Host "  Welcome to PoSH Server"
	Write-Host " "
	Write-Host " "
	Write-Host "  You can start browsing your webpage from:"
	Write-Host "  http://$Hostname$Port"
	Write-Host " "
	Write-Host " "
	Write-Host "  Thanks for using PoSH Server.."
	Write-Host " "
	Write-Host " "
	Write-Host " "
}

Seriously, this looks good :) It’s a good way to redirect people to web browser.