diff --git a/scripts_staging/Win_Template.ps1 b/scripts_staging/Win_Template.ps1 index 49652b3..ef96665 100644 --- a/scripts_staging/Win_Template.ps1 +++ b/scripts_staging/Win_Template.ps1 @@ -233,7 +233,7 @@ if (Test-IsAdmin) { function Test-IsInteractiveShell { # https://stackoverflow.com/questions/9738535/powershell-test-for-noninteractive-mode # Test each Arg for match of abbreviated '-NonInteractive' command. - $NonInteractive = [Environment]::GetCommandLineArgs() | Where-Object{ $_ -like '-NonI*' } + $NonInteractive = [Environment]::GetCommandLineArgs() | Where-Object { $_ -like '-NonI*' } if ([Environment]::UserInteractive -and -not$NonInteractive) { # We are in an interactive shell. @@ -298,3 +298,18 @@ If ("SetRegistryValue" -Match "true") { # Set-RegistryValue -registryPath $RegistryPath -name "PersonalizationReportingEnabled" -value 0 #Set-RegistryValue } + +<# ================================================================================ #> +Function Foldercreate { + param ( + [Parameter(Mandatory = $false)] + [String[]]$Paths + ) + + foreach ($Path in $Paths) { + if (!(Test-Path $Path)) { + New-Item -ItemType Directory -Force -Path $Path + } + } +} +Foldercreate -Paths "$env:ProgramData\TacticalRMM\temp", "C:\Temp" \ No newline at end of file diff --git a/scripts_wip/Win_ASUS_debloater.ps1 b/scripts_wip/Win_ASUS_debloater.ps1 new file mode 100644 index 0000000..738a023 --- /dev/null +++ b/scripts_wip/Win_ASUS_debloater.ps1 @@ -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." + } +} \ No newline at end of file diff --git a/scripts_wip/Win_Dell_RAIDmonitor.ps1 b/scripts_wip/Win_Dell_RAIDmonitor.ps1 new file mode 100644 index 0000000..b2f031c --- /dev/null +++ b/scripts_wip/Win_Dell_RAIDmonitor.ps1 @@ -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 +} \ No newline at end of file