PowerShell: Arvuti info kuvamine: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Dkeler (talk | contribs)
No edit summary
Dkeler (talk | contribs)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
.Synopsis
<Source lang="powershell">
    Korjab rekursiivselt kokku failide nimed, asukohad ja laiendid ning arvutab räsid, tulemuse kirjutab CSV-sse.
   
   
.DESCRIPTION
.DESCRIPTION
Line 13: Line 12:
     https://wiki.itcollege.ee/index.php?title=PowerShell:_Arvuti_info_kuvamine  
     https://wiki.itcollege.ee/index.php?title=PowerShell:_Arvuti_info_kuvamine  


#--------------------------------------------------------------------
 
# Skripti ülesanne seletamine
#Skripti ülesanne seletamine
#--------------------------------------------------------------------
Write-Host " "  
Write-Host " "  
Write-Host "See skript valjastab ekraanile arvuti informatsiooni" -BackgroundColor green -ForegroundColor red
Write-Host "See skript valjastab ekraanile arvuti informatsiooni" -BackgroundColor green -ForegroundColor red
Line 43: Line 41:
         2 {
         2 {
           "GPU Information";
           "GPU Information";
           get-wmiobject win32_VideoController | Select-Object Name, VideoModeDescription, DriverVersion | Out-GridView
           get-wmiobject win32_VideoController | Select Name, VideoModeDescription, DriverVersion | Out-GridView
           break;
           break;
           }  
           }  
Line 63: Line 61:
         6 {
         6 {
           "Uptime";
           "Uptime";
           Write-Host “Susteemi uptime is” ((Get-Date) – ([WMI]“”).ConverttoDateTime((Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime)).Days “Days” ((Get-Date) – ([WMI]“”).ConverttoDateTime((Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime)).Hours “Hrs” ((Get-Date) – ([WMI]“”).ConverttoDateTime((Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime)).minutes “Min”
           Write-Host “Susteemi uptime on” ((Get-Date) – ([WMI]“”).ConverttoDateTime((Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime)).Days “Days” ((Get-Date) – ([WMI]“”).ConverttoDateTime((Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime)).Hours “Hrs” ((Get-Date) – ([WMI]“”).ConverttoDateTime((Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime)).minutes “Min”
           break;
           break;
         }
         }
Line 76: Line 74:
           }
           }
     }
     }
</source>

Latest revision as of 22:10, 4 November 2012

 
.DESCRIPTION
    Valida numbrit, mis vastab vajaliku informatsioonile, ning skript kuvab infot uues aknas
 
.NOTES
    Autor: Dmitri Keler
    Versioon: 1 
    Muutmise kuup2ev: 30.05.2012
 
.LINK
    https://wiki.itcollege.ee/index.php?title=PowerShell:_Arvuti_info_kuvamine 


#Skripti ülesanne seletamine
Write-Host " " 
Write-Host "See skript valjastab ekraanile arvuti informatsiooni" -BackgroundColor green -ForegroundColor red
Write-Host " " 
 
# Valikud
Write-Host "Info valimine" -BackgroundColor yellow
Write-Host "1. CPU" -BackgroundColor yellow
Write-Host "2. GPU" -BackgroundColor yellow
Write-Host "3. BIOS" -BackgroundColor yellow
Write-Host "4. HDD" -BackgroundColor yellow
Write-Host "5. Memory" -BackgroundColor yellow
Write-Host "6. Uptime" -BackgroundColor yellow
Write-Host "7. OS" -BackgroundColor yellow
Write-Host " "
$a = Read-Host "Valige 1-7: "
 
Write-Host " "
 
switch ($a) 
    { 
        1 {
           "CPU Information";
           get-wmiobject win32_processor | Select Name, CurrentClockSpeed, L2CacheSize, L3CacheSize, NumberOfCores, NumberOfLogicalProcessors | Out-GridView
           break;
          } 
        2 {
           "GPU Information";
           get-wmiobject win32_VideoController | Select Name, VideoModeDescription, DriverVersion | Out-GridView
           break;
          } 
        3 {
           "BIOS Information";
           get-wmiobject Win32_Bios | Out-GridView
           break;
          } 
        4 {
           "HDD Information";
           get-wmiobject Win32_LogicalDisk | Select SystemName, DeviceID, VolumeName, @{Name=size(GB);Expression={{0:N1} -f($_.size/1gb)}},@{Name=freespace(GB);Expression={{0:N1} -f($_.freespace/1gb)}} | Out-GridView
           break;
          } 
        5 {
           "Memory Information";
           get-wmiobject Win32_PhysicalMemory | Select DeviceLocator, DataWidth, @{Name=size(MB);Expression={{0:N1} -f($_.Capacity/1mb)}} | Out-GridView
           break;
         }
        6 {
           "Uptime";
           Write-Host Susteemi uptime on ((Get-Date)  ([WMI]“”).ConverttoDateTime((Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime)).Days Days ((Get-Date)  ([WMI]“”).ConverttoDateTime((Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime)).Hours Hrs ((Get-Date)  ([WMI]“”).ConverttoDateTime((Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime)).minutes Min
           break;
         }
        7 {
           "OS Information";
           Get-WmiObject Win32_OperatingSystem | Select Name, OSArchitecture, CSName | Out-GridView
           break;
        }
        default {
          "Valige 6iget numbrit";
          break;
          }
    }