Bekijk een demo×
×

Zie NinjaOne in actie!

Door dit formulier in te dienen geef ik aan akkoord te gaan met het privacybeleid van NinjaOne.

Hoe Windows 10 Data Collection in- of uitschakelen (PowerShell Script)

In het digitale tijdperk zijn privacy en beveiliging van gegevens van het grootste belang. Naarmate Windows 10 populairder is geworden, is ook de bezorgdheid over de functies voor het verzamelen van gegevens toegenomen. Voor IT-professionals en Managed Service Providers (MSP’s) is het van cruciaal belang om deze functies te begrijpen en te beheren. Dit artikel gaat in op een PowerShell-script dat is ontworpen om de gegevensverzamelingsmogelijkheden van Windows 10 in of uit te schakelen.

Achtergrond

Windows 10 heeft, net als veel moderne besturingssystemen, ingebouwde functies voor telemetrie en gegevensverzameling. Deze zijn bedoeld om de gebruikerservaring te verbeteren door gegevens te verzamelen over gebruikspatronen, fouten en meer. Om verschillende redenen, waaronder privacy en naleving van regelgeving, moeten IT-professionals en MSP’s deze functies echter vaak controleren. Het meegeleverde script biedt een gestroomlijnde manier om deze instellingen te beheren.

Het Script

#Requires -Version 5.1

<#
.SYNOPSIS
    Enables or Disabled Windows 10 Linguistic Data Collection, Advertising ID, and Telemetry
.DESCRIPTION
    Enables or Disabled Windows 10 Linguistic Data Collection, Advertising ID, and Telemetry
.EXAMPLE
    No Params needed to Disable Windows 10 Linguistic Data Collection, Advertising ID, and Telemetry
.EXAMPLE
     -Enable
    Enables Linguistic Data Collection, Advertising ID, and Telemetry
.EXAMPLE
    PS C:> Set-Windows10KeyLogger.ps1
    Disables Windows 10 Linguistic Data Collection, Advertising ID, and Telemetry
.EXAMPLE
    PS C:> Set-Windows10KeyLogger.ps1 -Enable
    Enables Windows 10 Linguistic Data Collection, Advertising ID, and Telemetry
.OUTPUTS
    None
.NOTES
    Minimum OS Architecture Supported: Windows 10
    Release Notes:
    Initial Release
By using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https://www.ninjaone.com/terms-of-use.
    Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. 
    Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. 
    Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. 
    Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. 
    Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. 
    Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. 
    EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).
.COMPONENT
    OSSecurity
#>

[CmdletBinding()]
param (
    [Parameter()]
    [Switch]
    $Enable
)

begin {
    function Test-IsElevated {
        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
        $p = New-Object System.Security.Principal.WindowsPrincipal($id)
        if ($p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator))
        { Write-Output $true }
        else
        { Write-Output $false }
    }
    function Set-ItemProp {
        param (
            $Path,
            $Name,
            $Value,
            [ValidateSet('DWord', 'QWord', 'String', 'ExpandedString', 'Binary', 'MultiString', 'Unknown')]
            $PropertyType = 'DWord'
        )
        New-Item -Path $Path -Force | Out-Null
        if ((Get-ItemProperty -Path $Path -Name $Name -ErrorAction SilentlyContinue)) {
            Set-ItemProperty -Path $Path -Name $Name -Value $Value -Force -Confirm:$false | Out-Null
        }
        else {
            New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $PropertyType -Force -Confirm:$false | Out-Null
        }
    }
    $Type = "DWORD"
}
process {
    if (-not (Test-IsElevated)) {
        Write-Error -Message "Access Denied. Please run with Administrator privileges."
        exit 1
    }

    $Value = if ($PSBoundParameters.ContainsKey("Enable") -and $Enable) { 1 }else { 0 }

    try {
        @(
            # Linguistic Data Collection
            [PSCustomObject]@{
                Path = "HKLM:SOFTWAREMicrosoftWindowsCurrentVersionPoliciesTextInput"
                Name = "AllowLinguisticDataCollection"
            }
            # Advertising ID
            [PSCustomObject]@{
                Path = "HKLM:SOFTWAREMicrosoftWindowsCurrentVersionAdvertisingInfo"
                Name = "Enabled"
            }
            # Telemetry
            [PSCustomObject]@{
                Path = "HKLM:SOFTWAREPoliciesMicrosoftWindowsDataCollection"
                Name = "AllowTelemetry"
            }
        ) | ForEach-Object {
            Set-ItemProp -Path $_.Path -Name $_.Name -Value $Value -PropertyType $Type
            Write-Host "$($_.Path)$($_.Name) set to $(Get-ItemPropertyValue -Path $_.Path -Name $_.Name)"
        }

        if ($PSBoundParameters.ContainsKey("Enable") -and $Enable) {
            Write-Host "Enabling DiagTrack Services"
            Get-Service -Name DiagTrack | Set-Service -StartupType Automatic | Start-Service
        }
        else { 
            Write-Host "Disabling DiagTrack Services"
            Get-Service -Name DiagTrack | Set-Service -StartupType Disabled | Stop-Service
        }

        Write-Host "DiagTrack Service status: $(Get-Service -Name DiagTrack | Select-Object -Property Status -ExpandProperty Status)"
        Write-Host "DiagTrack Service is set to: $(Get-Service -Name dmwappushservice | Select-Object -Property StartType -ExpandProperty StartType)"

        if ($PSBoundParameters.ContainsKey("Enable") -and $Enable) {
            Get-Service -Name dmwappushservice | Set-Service -StartupType Manual
        }
        else { 
            Get-Service -Name dmwappushservice | Set-Service -StartupType Disabled | Stop-Service
        }

        Write-Host "dmwappushservice Service status: $(Get-Service -Name dmwappushservice | Select-Object -Property Status -ExpandProperty Status)"
        Write-Host "dmwappushservice Service is set to: $(Get-Service -Name dmwappushservice | Select-Object -Property StartType -ExpandProperty StartType)"

        $tasks = "SmartScreenSpecific", "ProgramDataUpdater", "Microsoft Compatibility Appraiser", "AitAgent", "Proxy", "Consolidator",
        "KernelCeipTask", "BthSQM", "CreateObjectTask", "WinSAT", #"Microsoft-Windows-DiskDiagnosticDataCollector", # This is disabled by default
        "GatherNetworkInfo", "FamilySafetyMonitor", "FamilySafetyRefresh", "SQM data sender", "OfficeTelemetryAgentFallBack",
        "OfficeTelemetryAgentLogOn"
        
        if ($PSBoundParameters.ContainsKey("Enable") -and $Enable) {
            Write-Host "Enabling telemetry scheduled tasks"
            $tasks | ForEach-Object {
                Write-Host "Enabling $_ Scheduled Task"
                # Note: ErrorAction set to SilentlyContinue so as to skip over any missing tasks. Enable-ScheduledTask will still error if it can't be enabled.
                Get-ScheduledTask -TaskName $_ -ErrorAction SilentlyContinue | Enable-ScheduledTask
                $State = Get-ScheduledTask -TaskName $_ -ErrorAction SilentlyContinue | Select-Object State -ExpandProperty State
                Write-Host "Scheduled Task: $_ is $State"
            }
        }
        else { 
            Write-Host "Disabling telemetry scheduled tasks"
            $tasks | ForEach-Object {
                Write-Host "Disabling $_ Scheduled Task"
                # Note: ErrorAction set to SilentlyContinue so as to skip over any missing tasks. Disable-ScheduledTask will still error if it can't be disabled.
                Get-ScheduledTask -TaskName $_ -ErrorAction SilentlyContinue | Disable-ScheduledTask
                $State = Get-ScheduledTask -TaskName $_ -ErrorAction SilentlyContinue | Select-Object State -ExpandProperty State
                Write-Host "Scheduled Task: $_ is $State"
            }
        }
    }
    catch {
        Write-Error $_
        exit 1
    }
    
    gpupdate.exe /force
    exit 0
}
end {}

 

Toegang tot 300+ scripts in de NinjaOne Dojo

Toegang Krijgen

Gedetailleerd overzicht

Het script is een PowerShell cmdlet dat Windows 10’s taalgegevensverzameling, advertentie-ID en telemetrie omschakelt. Hier volgt een stap-voor-stap uitleg:

  1. Vereisten: Het script vereist PowerShell versie 5.1.
  2. Parameters: Het script accepteert een optionele schakeloptie -Enable. Indien aanwezig, worden de functies voor gegevensverzameling ingeschakeld, anders worden ze uitgeschakeld.
  3. Functies:
    1. Test-IsElevated: Controleert of het script wordt uitgevoerd met beheerdersrechten.
    2. Set-ItemProp: Stelt een waarde in voor een registersleutel of maakt deze aan.
  4. Proces:
    1. Eerst controleert het script op beheerdersrechten. Als het niet aanwezig is, wordt het afgesloten.
    2. Vervolgens wordt bepaald of de functies worden in- of uitgeschakeld op basis van de schakelaar -Enable.
    3. Het script wijzigt specifieke registersleutels die overeenkomen met de taalgegevensverzameling, advertentie-ID en telemetrie.
    4. Het beheert ook de services DiagTrack en dmwappushservice, die gerelateerd zijn aan telemetrie.
    5. Tenslotte schakelt het verschillende telemetrie-gerelateerde geplande taken in.
  5. Uitvoering: Het script eindigt met het forceren van een groepsbeleid update.

Potentiële Gebruikssituaties

Stel u een MSP voor die IT beheert voor een zorgverlener. Vanwege de HIPAA-regelgeving moeten ze ervoor zorgen dat er zo min mogelijk gegevens uitlekken. Met behulp van dit script kan de MSP snel alle functies voor gegevensverzameling uitschakelen op alle Windows 10-machines in het netwerk, waardoor compliance wordt gewaarborgd en de privacy van patiëntgegevens wordt verbeterd.

Vergelijkingen

Hoewel er GUI-gebaseerde tools en handmatige methodes zijn om deze instellingen te wijzigen, biedt dit script een efficiëntere, herhaalbare en schaalbare oplossing. Handmatige methoden kunnen tijdrovend en foutgevoelig zijn, vooral op meerdere machines. GUI-tools bieden mogelijk niet de granulariteit of automatiseringsmogelijkheden die een PowerShell-script biedt.

FAQs

  • Kan ik dit script uitvoeren op oudere Windows-versies?
    Nee, dit script is speciaal ontworpen voor Windows 10.
  • Heb ik beheerdersrechten nodig om het script uit te voeren?
    Ja, het script vereist beheerdersrechten om registersleutels te wijzigen en services te beheren.

Implicaties

Het gebruik van dit script kan de privacy van gegevens aanzienlijk verbeteren, vooral in sectoren met strenge regelgeving. Het uitschakelen van sommige functies kan echter bepaalde functionaliteiten of feedbackmechanismen in Windows 10 beperken. IT-professionals moeten de voordelen afwegen tegen de mogelijke beperkingen.

Aanbevelingen

  • Maak altijd een back-up van de registerinstellingen voordat je wijzigingen aanbrengt.
  • Test het script in een gecontroleerde omgeving voordat je het op grote schaal inzet.
  • Controleer en update scripts regelmatig om eventuele wijzigingen in toekomstige Windows 10-updates aan te passen.

Slotbeschouwingen:

Voor IT-professionals en MSP’s kunnen tools als NinjaOne van onschatbare waarde zijn bij het beheren en bewaken van IT-omgevingen. In combinatie met scripts zoals het script dat we hebben besproken, kunnen ze zorgen voor een veilige, conforme en efficiënte IT-infrastructuur. Naarmate de functies voor gegevensverzameling van Windows 10 zich verder ontwikkelen, zijn een robuuste toolset en kennisbank essentieel voor succes.

Volgende stappen

Het opbouwen van een efficiënt en effectief IT-team vereist een gecentraliseerde oplossing die fungeert als uw kerndienstleveringstool. NinjaOne stelt IT-teams in staat om al hun apparaten te monitoren, beheren, beveiligen en ondersteunen, waar ze ook zijn, zonder de noodzaak van complexe on-premises infrastructuur.

Leer meer over NinjaOne Endpoint Management, bekijk een live rondleiding, of start uw gratis trial van het NinjaOne-platform

Categorieën:

Dit vindt u misschien ook leuk

NinjaOne Terms & Conditions

By clicking the “I Accept” button below, you indicate your acceptance of the following legal terms as well as our Terms of Use:

  • Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms.
  • Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party.
  • Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library belonging to or under the control of any other software provider.
  • Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations.
  • Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks.
  • Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script.
  • EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).