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

PowerShell: Set Enhanced Protected Mode of Internet Explorer

function changeIeProtectedMode{ # $hives = 0..4|%{"HKLM:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\$_"} $hives = 0..4|%{"HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\$_"} $keyName='2500' # Key Name…

PowerShell: Obtain Domain Admin Credential

function obtainDomainAdminCredentials{ # Legacy domain binding function function isValidCred($u,$p){ # Get current domain using logged-on…

PowerShell: Create New Hybrid On Prem Active Directory User with Office 365 Integration

# createNewHybridUser_v0.0.1.ps1# .Description: this script automates the creation of a user account in a hybrid…