-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathVer.ps1
56 lines (52 loc) · 1.64 KB
/
Ver.ps1
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<#
.SYNOPSIS
Ver
Created By: Dana Meli-Wischman
Created Date: December, 2019
Last Modified Date: March 18, 2021
.DESCRIPTION
My idea of a Windows version script.
.EXAMPLE
VER
.NOTES
Still under development.
#>
$FileVersion = "0.2.1"
Clear-Host
if ($env:HOME -match "C:\\Users\\") {
Say "Detected Windows. Processing..."
Start-Sleep -S 1
Clear-Host
$VarFile = ($env:BASE + "\ver.tmp")
$Filetest = Test-Path -Path $VarFile
if ($Filetest -eq $True) { Remove-Item –Path $VarFile }
[Console]::SetCursorPosition(0, 0)
Say ""
Say -ForegroundColor white "My Version Information $FileVersion"
Say -ForegroundColor red "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
Get-SmallVer;
$computerOS = (Get-CimInstance CIM_OperatingSystem)
$TC1 = ($computerOS.caption)
$TC2 = ($computerOS.version)
WC "~darkcyan~[~~darkyellow~$TC1 $TC2~~darkcyan~]~"
[Console]::SetCursorPosition(0, 5)
systeminfo /fo csv | ConvertFrom-Csv | Select-Object OS*, System*, Hotfix* | Format-List | Out-File $VarFile
(Get-Content $VarFile) | Where-Object { $_.trim() -ne "" } | Set-Content $VarFile
$lines = (Get-Content $VarFile).count
$i = 0
$j = 1
$p = 5
While ($j -le $lines) {
$read = (Get-Content $VarFile)[$i]
if ($read -eq "") { break }
[Console]::SetCursorPosition(0, $p); Say -ForegroundColor darkcyan $read
$i++; $j++; $p++
}
$Filetest = Test-Path -Path $VarFile
if ($Filetest -eq $True) { Remove-Item –Path $VarFile }
return
}
else {
Say "Did not detect Windows. Working on the linux version right this second. Exiting"
return
}