PowerShell/Scripts/write-motd.ps1

104 lines
4.8 KiB
PowerShell
Raw Normal View History

2021-08-26 10:46:12 +02:00
<#
2021-07-13 21:10:02 +02:00
.SYNOPSIS
write-motd.ps1
.DESCRIPTION
2021-09-25 19:43:22 +02:00
Writes the message of the day (MOTD)
2021-07-13 21:10:02 +02:00
.EXAMPLE
2021-09-25 19:43:22 +02:00
PS> ./write-motd
2021-08-29 17:50:03 +02:00
.NOTES
Author: Markus Fleschutz · License: CC0
2021-07-13 21:10:02 +02:00
.LINK
https://github.com/fleschutz/PowerShell
2020-12-29 15:14:21 +01:00
#>
2020-12-19 18:52:55 +01:00
# Retrieve information:
2020-12-21 15:18:05 +01:00
$CurrentTime = Get-Date -format "yyyy-MM-dd HH:mm"
$TimeZone = (Get-TimeZone).id
2020-12-19 18:52:55 +01:00
$UserName = $(whoami)
$ComputerName = $(hostname)
2020-12-21 15:18:05 +01:00
$OSName = $PSVersionTable.OS
$PowerShellVersion = $PSVersionTable.PSVersion
$PowerShellEdition = $PSVersionTable.PSEdition
$UptimeDays = (Get-Uptime).Days
$UptimeHours = (Get-Uptime).Hours
$Uptime = "$UptimeDays days, $UptimeHours hours"
$NumberOfProcesses = (Get-Process).Count
2020-12-19 18:52:55 +01:00
#$Logical_Disk = Get-CimInstance -ClassName Win32_LogicalDisk | Where-Object -Property DeviceID -eq $OS.SystemDrive
#$Processor = Get-CimInstance -ClassName Win32_Processor
#$Current_Load = $ReturnedValues.Processor.LoadPercentage
#$Memory_Size = "{0}mb/{1}mb Used" -f (([math]::round($ReturnedValues.Operating_System.TotalVisibleMemorySize/1KB))-
#([math]::round($ReturnedValues.Operating_System.FreePhysicalMemory/1KB))),([math]::round($ReturnedValues.Operating_System.TotalVisibleMemorySize/1KB))
#$Disk_Size = "{0}gb/{1}gb Used" -f (([math]::round($ReturnedValues.Logical_Disk.Size/1GB)-
#[math]::round($ReturnedValues.Logical_Disk.FreeSpace/1GB))),([math]::round($ReturnedValues.Logical_Disk.Size/1GB))
# Write to the Console
2020-12-21 15:18:05 +01:00
write-host ""
write-host ""
write-host " ,.=:^!^!t3Z3z., " -foregroundcolor Red
write-host " :tt:::tt333EE3 " -foregroundcolor Red
write-host " Et:::ztt33EEE " -foregroundcolor Red -nonewline
write-host " @Ee., .., " -foregroundcolor green -nonewline
write-host " Time: " -foregroundcolor Red -nonewline
write-host "$CurrentTime" -foregroundcolor Cyan
write-host " ;tt:::tt333EE7" -foregroundcolor Red -nonewline
write-host " ;EEEEEEttttt33# " -foregroundcolor Green -nonewline
write-host " Timezone: " -foregroundcolor Red -nonewline
write-host "$TimeZone" -foregroundcolor Cyan
write-host " :Et:::zt333EEQ." -NoNewline -foregroundcolor Red
write-host " SEEEEEttttt33QL " -NoNewline -foregroundcolor Green
write-host " User: " -NoNewline -foregroundcolor Red
write-host "$UserName" -foregroundcolor Cyan
write-host " it::::tt333EEF" -NoNewline -foregroundcolor Red
write-host " @EEEEEEttttt33F " -NoNewline -ForeGroundColor Green
write-host " Hostname: " -NoNewline -foregroundcolor Red
write-host "$ComputerName" -foregroundcolor Cyan
write-host " ;3=*^``````'*4EEV" -NoNewline -foregroundcolor Red
write-host " :EEEEEEttttt33@. " -NoNewline -foregroundcolor Green
write-host " OS: " -NoNewline -foregroundcolor Red
write-host "$OSName" -foregroundcolor Cyan
write-host " ,.=::::it=., " -NoNewline -foregroundcolor Cyan
write-host "``" -NoNewline -foregroundcolor Red
write-host " @EEEEEEtttz33QF " -NoNewline -foregroundcolor Green
write-host " Kernel: " -NoNewline -foregroundcolor Red
write-host "NT " -NoNewline -foregroundcolor Cyan
write-host "$Kernel_Info" -foregroundcolor Cyan
write-host " ;::::::::zt33) " -NoNewline -foregroundcolor Cyan
write-host " '4EEEtttji3P* " -NoNewline -foregroundcolor Green
write-host " Uptime: " -NoNewline -foregroundcolor Red
write-host "$Uptime" -foregroundcolor Cyan
write-host " :t::::::::tt33." -NoNewline -foregroundcolor Cyan
write-host ":Z3z.. " -NoNewline -foregroundcolor Yellow
write-host " ````" -NoNewline -foregroundcolor Green
write-host " ,..g. " -NoNewline -foregroundcolor Yellow
write-host " PowerShell: " -NoNewline -foregroundcolor Red
write-host "$PowerShellVersion $PowerShellEdition" -foregroundcolor Cyan
write-host " i::::::::zt33F" -NoNewline -foregroundcolor Cyan
write-host " AEEEtttt::::ztF " -NoNewline -foregroundcolor Yellow
write-host " CPU: " -NoNewline -foregroundcolor Red
write-host "$CPU_Info" -foregroundcolor Cyan
write-host " ;:::::::::t33V" -NoNewline -foregroundcolor Cyan
write-host " ;EEEttttt::::t3 " -NoNewline -foregroundcolor Yellow
write-host " Processes: " -NoNewline -foregroundcolor Red
write-host "$NumberOfProcesses" -foregroundcolor Cyan
write-host " E::::::::zt33L" -NoNewline -foregroundcolor Cyan
write-host " @EEEtttt::::z3F " -NoNewline -foregroundcolor Yellow
write-host " Current Load: " -NoNewline -foregroundcolor Red
write-host "$Current_Load" -foregroundcolor Cyan
#write-host "%" -foregroundcolor Cyan
write-host " {3=*^``````'*4E3)" -NoNewline -foregroundcolor Cyan
write-host " ;EEEtttt:::::tZ`` " -NoNewline -foregroundcolor Yellow
write-host " Memory: " -NoNewline -foregroundcolor Red
write-host "$Memory_Size" -foregroundcolor Cyan
write-host " ``" -NoNewline -foregroundcolor Cyan
write-host " :EEEEtttt::::z7 " -NoNewline -foregroundcolor Yellow
write-host " System Volume: " -NoNewline -foregroundcolor Red
write-host "$Disk_Size" -foregroundcolor Cyan
write-host " 'VEzjt:;;z>*`` " -foregroundcolor Yellow
write-host ""
2020-12-19 18:52:55 +01:00
exit 0