Posted On December 28, 2020

PowerShell: Reset Windows 10 to Default Factory Settings

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: Reset Windows 10 to Default Factory Settings
The easiest (GUI) method:
systemreset -cleanpc

The automated method:
# Experimental code: not working yet
$computerName=$env:computername
$namespaceName = "root\cimv2\mdm\dmmap"
$className = "MDM_RemoteWipe"
$methodName = "doWipeMethod"
$params = New-Object Microsoft.Management.Infrastructure.CimMethodParametersCollection
$newParam = [Microsoft.Management.Infrastructure.CimMethodParameter]::Create("param", "", "String", "In")
$params.Add($newParam)
$instance = Get-CimInstance -Namespace $namespaceName -ClassName $className -Filter "ParentID='./Vendor/MSFT' and InstanceID='RemoteWipe'"
$session = New-CimSession -computername $computerName
$session.InvokeMethod($namespaceName, $instance, $methodName, $params)

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Linux: How to Display the SSL Certificate of a Remote Server URL

Command: server=test.kimconnect.comecho | openssl s_client -showcerts -servername $server -connect $server:443 2>/dev/null | openssl x509 -inform…

One-Liner: Capture Report of Logons in AD

echo %date%,%time%,%username%,logon,%computername% >> \\FILESERVER01\IT\scripts\logons.csv

PowerShell: Discover Environment

One of the most common tasks of Active Directory cleanup is to perform a discovery…