{"id":1040,"date":"2023-05-23T08:28:00","date_gmt":"2023-05-23T08:28:00","guid":{"rendered":"https:\/\/mustafauzun.co\/blog\/?p=1040"},"modified":"2023-05-23T08:29:00","modified_gmt":"2023-05-23T08:29:00","slug":"powershell-system-checker-script","status":"publish","type":"post","link":"https:\/\/mustafauzun.co\/blog\/powershell-system-checker-script\/","title":{"rendered":"Powershell, System Checker Script"},"content":{"rendered":"\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\" data-file=\"Checker.ps1\"><code>Write-Host &quot;[System Checker]&quot;\n$informationTexts = @{\n    Success = @{Text = &quot;Success&quot;; BackgroundColor = &quot;DarkGreen&quot;}\n    Error = @{Text = &quot;Error&quot;; BackgroundColor = &quot;DarkRed&quot;}\n    Warning = @{Text=&quot;Warning&quot;; BackgroundColor = &quot;DarkCyan&quot;}\n}\n$getRam = (Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum).sum \/ 1GB\n$getDisks = (Get-CimInstance -ClassName Win32_LogicalDisk)\n$getWindowsType = (Get-ComputerInfo).OsProductType\n$getWindowsVersion = (Get-ComputerInfo).WindowsVersion\n\nWrite-Host RAM: $getRam GB -NoNewline\nWrite-Host &quot; - &quot; -NoNewline\n\nif($getRam -ge 16)\n{\n    Write-Host $informationTexts.Success.Text -BackgroundColor $informationTexts.Success.BackgroundColor\n}\nelse\n{\n    Write-Host $informationTexts.Error.Text &quot;-&quot; &quot;Minimum RAM must be 16 GB&quot; -BackgroundColor $informationTexts.Error.BackgroundColor\n}\n\nforeach($getDisk in $getDisks)\n{\n    $getDiskSpace = ($getDisk |  Measure-Object -Property Size -Sum).sum \/ 1GB\n\n    Write-Host DISK $getDisk.DeviceID $getDiskSpace GB -NoNewline\n    Write-Host &quot; - &quot; -NoNewline\n    \n    if($getDiskSpace -ge 128)\n    {\n        Write-Host $informationTexts.Success.Text -BackgroundColor $informationTexts.Success.BackgroundColor\n    }\n    else\n    {\n        Write-Host $informationTexts.Error.Text &quot;-&quot; &quot;Minimum Disk must be 128 GB&quot; -BackgroundColor $informationTexts.Error.BackgroundColor\n    }\n}\n\nWrite-Host Windows Type: $getWindowsType -NoNewline\nWrite-Host &quot; - &quot; -NoNewline\n\nif($getWindowsType -eq &quot;Server&quot; -Or $getWindowsType -eq &quot;DomainController&quot;)\n{\n    Write-Host $informationTexts.Success.Text -BackgroundColor $informationTexts.Success.BackgroundColor\n}\nelse\n{\n    Write-Host $informationTexts.Error.Text &quot;-&quot; &quot;Windows Type must be Server or DomainController&quot; -BackgroundColor $informationTexts.Error.BackgroundColor\n}\n\nWrite-Host Windows Version: $getWindowsVersion -NoNewline\nWrite-Host &quot; - &quot; -NoNewline\n\nif($getWindowsVersion -ge 2012)\n{\n    Write-Host $informationTexts.Success.Text -BackgroundColor $informationTexts.Success.BackgroundColor\n}\nelse\n{\n    Write-Host $informationTexts.Error.Text &quot;-&quot; &quot;Windows Server version must be equal or greater than 2012&quot; -BackgroundColor $informationTexts.Error.BackgroundColor\n}\n\nWrite-Host Active Directory Version: -NoNewline\ntry\n{\n    $getADVersion = (Get-ADObject (Get-ADRootDSE).schemaNamingContext -Property objectVersion).objectVersion\n\n    Write-Host &quot; &quot; $getADVersion -NoNewline\n\n    if($getADVersion -ge 56)\n    {\n        Write-Host &quot; - &quot; -NoNewline\n        Write-Host $informationTexts.Success.Text -BackgroundColor $informationTexts.Success.BackgroundColor -NoNewline\n    }\n    else\n    {\n        throw\n    }\n}\ncatch\n{\n    Write-Host &quot; - &quot; -NoNewline\n    Write-Host $informationTexts.Error.Text &quot;-&quot; &quot;Active Directory version must be equal or greater than 2012&quot; -BackgroundColor $informationTexts.Error.BackgroundColor -NoNewline\n}\npause<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":1034,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[],"class_list":["post-1040","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"_links":{"self":[{"href":"https:\/\/mustafauzun.co\/blog\/wp-json\/wp\/v2\/posts\/1040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mustafauzun.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mustafauzun.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mustafauzun.co\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mustafauzun.co\/blog\/wp-json\/wp\/v2\/comments?post=1040"}],"version-history":[{"count":2,"href":"https:\/\/mustafauzun.co\/blog\/wp-json\/wp\/v2\/posts\/1040\/revisions"}],"predecessor-version":[{"id":1042,"href":"https:\/\/mustafauzun.co\/blog\/wp-json\/wp\/v2\/posts\/1040\/revisions\/1042"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mustafauzun.co\/blog\/wp-json\/wp\/v2\/media\/1034"}],"wp:attachment":[{"href":"https:\/\/mustafauzun.co\/blog\/wp-json\/wp\/v2\/media?parent=1040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mustafauzun.co\/blog\/wp-json\/wp\/v2\/categories?post=1040"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mustafauzun.co\/blog\/wp-json\/wp\/v2\/tags?post=1040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}