Additional Script Updates

This commit is contained in:
Andrew Amason
2025-05-19 15:19:36 -04:00
parent ec2b22290a
commit 9c8438d7d1
136 changed files with 1595 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
##Enter the path to the registry key
$regpath = "HKCU:\Software\Policies\Microsoft\Windows\WindowsAI"
##Enter the name of the registry key
$regname = "DisableAIDataAnalysis"
##Enter the value of the registry key
$regvalue = "1"
Try {
$Registry = Get-ItemProperty -Path $regpath -Name $regname -ErrorAction Stop | Select-Object -ExpandProperty $regname
If ($Registry -eq $regvalue){
Write-Output "Compliant"
Exit 0
}
Write-Warning "Not Compliant"
Exit 1
}
Catch {
Write-Output "RegKey Not Found, Compliant"
Exit 0
}

View File

@@ -0,0 +1,20 @@
##Enter the path to the registry key
$regpath = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WindowsAI"
##Enter the name of the registry key
$regname = "DisableAIDataAnalysis"
##Enter the value of the registry key
$regvalue = "1"
Try {
$Registry = Get-ItemProperty -Path $regpath -Name $regname -ErrorAction Stop | Select-Object -ExpandProperty $regname
If ($Registry -eq $regvalue){
Write-Output "Compliant"
Exit 0
}
Write-Warning "Not Compliant"
Exit 1
}
Catch {
Write-Output "RegKey Not Found, Compliant"
Exit 0
}

View File

@@ -0,0 +1,10 @@
##Enter the path to the registry key
$regpath = "HKCU:\Software\Policies\Microsoft\Windows\WindowsAI"
##Enter the name of the registry key
$regname = "DisableAIDataAnalysis"
##Enter the value of the registry key
$regvalue = "1"
##Enter the type of the registry key
$regtype = "DWord"
New-ItemProperty -Path $regpath -Name $regname -Value $regvalue -PropertyType $regtype -Force

View File

@@ -0,0 +1,10 @@
##Enter the path to the registry key
$regpath = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WindowsAI"
##Enter the name of the registry key
$regname = "DisableAIDataAnalysis"
##Enter the value of the registry key
$regvalue = "1"
##Enter the type of the registry key
$regtype = "DWord"
New-ItemProperty -Path $regpath -Name $regname -Value $regvalue -PropertyType $regtype -Force

View File

@@ -0,0 +1,3 @@
# (Detect_CustomScript.ps1)
exit 1

View File

@@ -0,0 +1,2 @@
# (Remediate_CustomScript.ps1)
# Enter your script contents here

View File

@@ -0,0 +1,11 @@
# (Detect_GenericRegistryChange.ps1)
# Detect if the registry key exists
$RegistryPath = "HKLM:\SOFTWARE\Microsoft\IntuneManagementExtension\SideCarPolicies\Scripts"
if (Test-Path -Path $RegistryPath) {
Write-Host "Registry key exists: $RegistryPath"
exit 0
} else {
Write-Host "Registry key not found: $RegistryPath"
exit 1
}

View File

@@ -0,0 +1,4 @@
# (Remediate_GenericRegistryChange.ps1)
# Modify a registry value
Set-ItemProperty -Path "HKLM:\Software\MyApp" -Name "MySetting" -Value "NewValue"

View File

@@ -0,0 +1,3 @@
# (Detect_GenericRestartService.ps1)
exit 1

View File

@@ -0,0 +1,4 @@
# (Remediate_GenericRestartService.ps1)
# Restart a service
Restart-Service -Name "wuauserv"

View File

@@ -0,0 +1,4 @@
if (Test-Path C:\Windows\SoftwareDistribution.old)
{exit 0}
else
{exit 1}

View File

@@ -0,0 +1,3 @@
Get-Service -Name wuauserv | Stop-Service
Rename-Item -Path C:\Windows\SoftwareDistribution -NewName SoftwareDistribution.old
Get-Service -Name wuauserv | Start-Service

View File

@@ -0,0 +1,7 @@
if (Test-Path C:\Windows\SoftwareDistribution.old)
{Write-Output "Folder Exist"
exit 1
} else {
Write-Output "Folder Doesnt Exists"
exit 0
}

View File

@@ -0,0 +1 @@
Remove-Item -Path C:\Windows\SoftwareDistribution.old

View File

@@ -0,0 +1,27 @@
## Miscellaneous
### Disable-WindowsAI-Registry
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/Miscellaneous/Disable-WindowsAI-Registry)
- **Detection**: Checks the registry keys used by Windows AI.
- **Remediation**: Disables the registry keys if they are enabled.
### Get-CustomScript
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/Miscellaneous/Get-CustomScript)
- **Detection**: Includes only 'Exit 1', which will automatically run the Remediation Script.
- **Remediation**: Include the contents of your PowerShell Script you wish to run on a schedule.
### Get-GenericRegistryChange
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/Miscellaneous/Get-GenericRegistryChange)
- **Detection**: Checks for a specified registry key in the environment.
- **Remediation**: If the registry key is not found, creates the registry key.
### Get-GenericRestartService
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/Miscellaneous/Get-GenericRestartService)
- **Detection**: Includes only 'Exit 1', which will automatically run the Remediation Script.
- **Remediation**: Will restart the specified service. Example include '**wuauserv**'.
### Get-SoftwareDistributionFolder and Get-SoftwareDistributionFolderPT2
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/Miscellaneous/Get-SoftwareDistributionFolder)
[Link - PT2](https://github.com/AntoPorter/Intune-Remediations/tree/main/Miscellaneous/Get-SoftwareDistributionFolderPT2)
- **Part 1**: Resets the device's SoftwareDistribution folder by stopping the WUAUSERV service, renaming the 'C:\Windows\SoftwareDistribution' folder to "SoftwareDistribution.old," and then starting the service.
- **Part 2**: Deletes the 'C:\Windows\SoftwareDistribution.old' folder as a cleanup step following the successful deployment of 'Reset-SoftwareDistributionFolder.'