PowerShell/Scripts/write-motd.ps1

99 lines
4.8 KiB
PowerShell
Raw Normal View History

2021-04-07 11:53:57 +02:00
#!/usr/bin/pwsh
2020-12-29 15:14:21 +01:00
<#
2021-03-22 20:10:18 +01:00
.SYNTAX ./write-motd.ps1
.DESCRIPTION writes the message of the day (MOTD)
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
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