-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243 from silversword411/main
Template add folder function. WIP: Add dell RAID and asus debloat
- Loading branch information
Showing
3 changed files
with
160 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<# | ||
.SYNOPSIS | ||
Stop and disable specified ASUS services | ||
.DESCRIPTION | ||
This script stops and disables a list of specified ASUS services on the local machine. | ||
It loops through each service name provided, attempts to stop the service, and then disables it. | ||
The script outputs the status of each operation. | ||
.EXAMPLE | ||
"asusappservice", "asusoptimization", "ASUSSoftwareManager", "ASUSSwitch", "ASUSSystemAnalysis", "ASUSSystemDiagnosis" | ||
.NOTES | ||
v1.0 7/17/2024 silversword411 Initial release Get rid of that ASUS crap that installs because of Armoury-crate autoinstaller that's enabled in BIOS | ||
#> | ||
|
||
# Define the variable containing the service names | ||
$serviceNames = "asusappservice", "asusoptimization", "ASUSSoftwareManager", "ASUSSwitch", "ASUSSystemAnalysis", "ASUSSystemDiagnosis" | ||
|
||
# Loop through each service name in the variable | ||
foreach ($serviceName in $serviceNames) { | ||
# Stop the service | ||
Stop-Service -Name $serviceName -Force -ErrorAction SilentlyContinue | ||
|
||
# Disable the service | ||
Set-Service -Name $serviceName -StartupType Disabled -ErrorAction SilentlyContinue | ||
|
||
# Output the status of the operation | ||
if ((Get-Service -Name $serviceName).Status -eq 'Stopped') { | ||
Write-Output "$serviceName has been stopped and disabled successfully." | ||
} | ||
else { | ||
Write-Output "Failed to stop and disable $serviceName." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<# | ||
.SYNOPSIS | ||
Check Dell RAID status using OpenManage command-line interface (OMSA). | ||
.DESCRIPTION | ||
This script checks the RAID status of Dell systems using OMSA. It scans for issues in both virtual and physical disks on all controllers and outputs the results. If the `-debug` switch is provided, detailed disk information is also displayed. | ||
.PARAMETER debug | ||
Switch to enable debug output. | ||
.NOTES | ||
v1.3 7/17/2024 silversword411 Adding exit conditions, debug, cleaned output | ||
#> | ||
|
||
param ( | ||
[switch]$debug | ||
) | ||
|
||
|
||
# For setting debug output level. -debug switch will set $debug to true | ||
if ($debug) { | ||
$DebugPreference = "Continue" | ||
} | ||
else { | ||
$DebugPreference = "SilentlyContinue" | ||
$ErrorActionPreference = 'silentlycontinue' | ||
} | ||
|
||
# Check Dell RAID status using OpenManage command-line interface (OMSA) | ||
|
||
# Define the OMSA installation directory | ||
$omsaDir = "C:\Program Files\Dell\SysMgt\oma\bin" | ||
|
||
# Change to the OMSA installation directory | ||
Set-Location $omsaDir | ||
|
||
# Initialize variables to track if there are any issues and their reasons | ||
$hasProblems = $false | ||
$problemReasons = @() | ||
|
||
# Get a list of all controllers | ||
$controllerOutput = .\omreport storage controller | ||
|
||
# Extract controller IDs | ||
$controllerIds = $controllerOutput | Select-String "ID" -Context 0, 1 | ForEach-Object { | ||
if ($_.Line -match 'ID\s+:\s+(\d+)') { | ||
$matches[1] | ||
} | ||
} | ||
|
||
# Iterate through each controller ID to list its vdisks and physical disks | ||
foreach ($controllerId in $controllerIds) { | ||
# List vdisks for the current controller | ||
$vdiskList = .\omreport storage vdisk controller=$controllerId | ||
# List physical disks for the current controller | ||
$pdiskList = .\omreport storage pdisk controller=$controllerId | ||
|
||
# Check for issues in the virtual disks | ||
$vdiskList -split "`r`n" | ForEach-Object { | ||
if ($_ -match "Status\s+:\s+Failure Predicted\s+:\s+Yes|State\s+:\s+Failed") { | ||
$hasProblems = $true | ||
$problemReasons += "Virtual Disk issue on Controller ID ${controllerId}: $_" | ||
} | ||
} | ||
|
||
# Check for issues in the physical disks | ||
$pdiskList -split "`r`n" | ForEach-Object { | ||
if ($_ -match "Status\s+:\s+Failure Predicted\s+:\s+Yes|State\s+:\s+Failed") { | ||
$hasProblems = $true | ||
$problemReasons += "Physical Disk issue on Controller ID ${controllerId}: $_" | ||
} | ||
} | ||
} | ||
|
||
function Display-ControllerDisks { | ||
# Display the details after the check | ||
Write-Debug "-----------------------" | ||
foreach ($controllerId in $controllerIds) { | ||
# List vdisks for the current controller | ||
$vdiskList = .\omreport storage vdisk controller=$controllerId | ||
# List physical disks for the current controller | ||
$pdiskList = .\omreport storage pdisk controller=$controllerId | ||
|
||
# Format and display the vdisk list with the controller ID | ||
Write-Host "Controller ID: $controllerId" | ||
Write-Host "Virtual Disks:" | ||
$vdiskList -split "`r`n" | ForEach-Object { " $_" } | ||
|
||
# Format and display the physical disk list for the controller | ||
Write-Host "Physical Disks:" | ||
$pdiskList -split "`r`n" | ForEach-Object { " $_" } | ||
|
||
Write-Host "-----------------------" | ||
} | ||
} | ||
|
||
# Output error or success message at the beginning | ||
if ($hasProblems) { | ||
Write-Host "Problems detected in RAID configuration. Exiting with status code 1." | ||
Write-Host "Reasons:" | ||
$problemReasons | ForEach-Object { Write-Host " $_" } | ||
if ($debug) { Display-ControllerDisks } | ||
exit 1 | ||
} | ||
else { | ||
Write-Host "No problems detected in RAID configuration. Exiting with status code 0." | ||
if ($debug) { Display-ControllerDisks } | ||
exit 0 | ||
} |