Upload files to "Microsoft"

This commit is contained in:
Timur 2024-06-26 07:37:55 +00:00
parent 64193ccb2a
commit 043ae144d4

View file

@ -0,0 +1,62 @@
# Script by Timur@0x01337.com
# Date: 2023-11-24
<#
.DESCRIPTION
Disables Cortana
Requires administrator privileges.
.PARAMETER help
Displays a detailed usage description of this script.
.EXAMPLE
PS> .\Disable-Cortana.ps1
.EXAMPLE
PS> .\Disable-Cortana.ps1 -help
#>
# Getting command line parameters
param (
[parameter(Mandatory = $false)][switch]$help
)
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$isAdmin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (!$isAdmin) {
Write-Error "This script requires administrator privileges"
exit 1
}
# Writing help message
if ($help) {
get-help $MyInvocation.MyCommand.Path -Full
exit 0
}
$registryKeyPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
$propertyName = 'AllowCortana'
if (!(Test-Path $registryKeyPath)) {
Write-Host "Create registry key path ($registryKeyPath)"
New-Item -Path $registryKeyPath -Force
}
try {
Get-ItemProperty -Path $registryKeyPath -Name $propertyName -ErrorAction Stop | Out-Null
}
catch {
Write-Host "Create property ($propertyName) in ($registryKeyPath)"
New-ItemProperty -Path $registryKeyPath -Name $propertyName -PropertyType DWORD -Value '0'
}
try {
Set-ItemProperty -Path $registryKeyPath -Name $propertyName -Value '0'
}
catch {
Write-Error $_
exit 1
}
Write-Host "Cortana is disabled"
exit 0