Simple RAID Cheat Sheet
| Level | Redundancy | Disk Required | Faster Reads | Faster Writes |
| RAID 0 | No | N | Yes | Yes |
| RAID 1 | Yes | 2 | Yes | No |
| RAID 5 | Yes | N+1 | Yes | No |
| RAID 10 | Yes | N*2 | Yes | Yes |
| JBOD | No | N/A | No | No |
by Alphnix
| Level | Redundancy | Disk Required | Faster Reads | Faster Writes |
| RAID 0 | No | N | Yes | Yes |
| RAID 1 | Yes | 2 | Yes | No |
| RAID 5 | Yes | N+1 | Yes | No |
| RAID 10 | Yes | N*2 | Yes | Yes |
| JBOD | No | N/A | No | No |
Powershell - hotfixes WannaCry
List of all the hotfixes from Microsofthttps://technet.microsoft.com/en-us/library/security/ms17-010.aspx
$hotfixes = "KB3205409", "KB3210720", "KB3210721", "KB3212646", "KB3213986", "KB4012212", "KB4012213", "KB4012214", "KB4012215", "KB4012216", "KB4012217", "KB4012218", "KB4012220", "KB4012598", "KB4012606", "KB4013198", "KB4013389", "KB4013429", "KB4015217", "KB4015438", "KB4015546", "KB4015547", "KB4015548", "KB4015549", "KB4015550", "KB4015551", "KB4015552", "KB4015553", "KB4015554", "KB4016635", "KB4019213", "KB4019214", "KB4019215", "KB4019216", "KB4019263", "KB4019264", "KB4019472", "KB4015221", "KB4019474", "KB4015219", "KB4019473"
#checks the computer it's run on if any of the listed hotfixes are present
$hotfix = Get-HotFix -ComputerName $env:computername | Where-Object {$hotfixes -contains $_.HotfixID} | Select-Object -property "HotFixID"
#confirms whether hotfix is found or not
if (Get-HotFix | Where-Object {$hotfixes -contains $_.HotfixID})
{
"Found HotFix: " + $hotfix.HotFixID
} else {
"Didn't Find HotFix"
}
Read-Host "Enter Password" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "\\DomainName\netlogon\cred.txt"
Add these next lines to the beginning of scripts
$pass = get-content "\\DomainName\netlogon\creds.txt" | ConvertTo-SecureString $credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist "DomainName\administrator",$pass
Open up your Microsoft.PowerShellISE_profile.ps1 file and add the following lines:
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Run with -Verbose', { Invoke-Expression -Command ". '$($psISE.CurrentFile.FullPath)' -Verbose" }, 'Ctrl+F5') | Out-Null
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Run with -Debug', { Invoke-Expression -Command ". '$($psISE.CurrentFile.FullPath)' -Debug" }, 'Ctrl+F6') | Out-Null
restart ISE you should see the options under the Add-Ons menu.
Spiceworks Link
https://community.spiceworks.com/scripts/show/3707-get-powershell-ise-to-run-scripts-with-verbose-flag
[CmdletBinding()]
PARAM (
$maxBootAgeDays = 35,
$restartTimeOut = (9 * 60), # 9 hours
$restartMaxPostpone = (48 * 60), # 48 hours
$restartDescriptions = @{
"en-US" = "Your computer needs to restart to receive the latest updates.";
},
$defaultLanguage = "en-US"
)
Function Get-PendingReboot {
# Local HKLM
$HKLM = [UInt32] "0x80000002"
$wmiRegistry = [WMIClass] "\\.\root\default:StdRegProv"
#Default
$PendingReboot = $false
# CBS - Reboot Required ?
$RegSubKeysCBS = $wmiRegistry.EnumKey($HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\")
if ($RegSubKeysCBS.sNames -contains "RebootPending") {
Write-Verbose "Component Based Servicing have a reboot pending"
$PendingReboot = $true
}
# Windows Update - Reboot Required?
$RegistryWUAU = $wmiRegistry.EnumKey($HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\")
if ($RegistryWUAU.sNames -contains "RebootRequired") {
Write-Verbose "Windows Update have a reboot required"
$PendingReboot = $true
}
## Pending FileRenameOperations ?
$RegSubKeySM = $wmiRegistry.GetMultiStringValue($HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\","PendingFileRenameOperations")
If ($RegSubKeySM.sValue) {
$RegSubKeySM.sValue | ForEach-Object {
If ($_.Trim() -ne '') {
Write-Verbose "Pending FileRename operation: $($_)"
}
}
$PendingReboot = $true
}
# ConfigMgr - Pending reboot ?
TRY {
$CCMClientSDK = Invoke-WmiMethod -NameSpace "ROOT\ccm\ClientSDK" -Class "CCM_ClientUtilities" -Name "DetermineIfRebootPending" -ErrorAction Stop
If ($CCMClientSDK.IsHardRebootPending -or $CCMClientSDK.RebootPending) {
Write-Verbose "ConfigMgr have reboot pending"
$PendingReboot = $true
}
} CATCH {
Write-Verbose "Cant talk to ConfigMgr Agent"
}
Write-Verbose "Pending reboot: $($PendingReboot)"
Return $PendingReboot
}
Function Check-OldBootAge {
PARAM (
$maxAgeDays = 35
)
$BootTime = Get-WmiObject Win32_Operatingsystem
[Int]$days = (New-TimeSpan -Start $boottime.ConvertToDateTime($boottime.LastBootUpTime) -End (Get-Date)).TotalDays
if ($days -ge $maxAgeDays) {
Write-Verbose "Boot age is $($days) days (more than $($maxBootAgeDays)), reboot required"
Return $true
} else {
Write-Verbose "Boot age is $($days) days (less than $($maxBootAgeDays))"
Return $false
}
Return $days
}
Function Get-UserLanguage {
Return [String] ([System.Threading.Thread]::CurrentThread).CurrentUICulture.Name
}
# ------------------------------------------------------------------------------------------------------------
# Main script
if ( (Get-WmiObject -Query "SELECT ProductType FROM Win32_OperatingSystem").ProductType -eq 1) {
If ( (Get-Process "ShutdownTool" -ErrorAction SilentlyContinue) ) {
Write-Host "Already running ShutdownTool"
} else {
If ((Check-OldBootAge -maxAgeDays $maxBootAgeDays) -or (Get-PendingReboot)) {
Write-Host "Reboot is required, calling restart utility"
$userLanguage = Get-UserLanguage
Write-Verbose "Language: $($userLanguage)"
# Find description
$Description = $restartDescriptions[$userLanguage]
if ($Description -eq $null) {
$Description = $restartDescriptions[$defaultLanguage]
}
$timeOutSeconds = ($restartTimeOut*60) - 1
Write-Verbose "Restart timeout: $($timeOutSeconds) seconds"
Write-Verbose "Max postpone: $($restartMaxPostpone) minutes"
Write-Verbose "Description: $($Description)"
If ((Test-Path ".\ShutdownTool.exe") -eq $false) {
Throw "Cant find ShutdownTool.exe"
} else {
Write-Verbose "Calling restart with ShutdownTool"
.\ShutdownTool.exe /g:$userLanguage /d:"$Description" /t:$timeOutSeconds /m:$restartMaxPostpone /r /c
}
# /g - Language
# /d - description
# /t - countdown in sec
# /m - max postpone in min
# /r - reboot instead of shutdown
# /c - force & remove abort-btn
}
}
} else {
Write-Verbose "Not a client OS"
}
# Done!
Spiceworks Link
https://community.spiceworks.com/scripts/show/3706-silent-windows-patching-and-controlled-reboots