Files
PowerShell/IsOOBEComplete.ps1
2026-03-28 05:56:53 +00:00

36 lines
934 B
PowerShell

#Settings for Win32 application requirements
#A: If you want the setup to run only when OOBE is NOT active, you would set the output value to 1.
#B: If you want the setup to run only when OOBE is active, you would set the output value to 0.
#Settings:
#Run script as 32-bit process on 64-bit clients: No
#Run this script using the logged on credentials: No
#Enforce script signature check: No
#Select output data type: Integer
#Operator: Equals
#Value: 1 or 0
$TypeDef = @"
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Api
{
public class Kernel32
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int OOBEComplete(ref int bIsOOBEComplete);
}
}
"@
Add-Type -TypeDefinition $TypeDef -Language CSharp
$IsOOBEComplete = $false
$hr = [Api.Kernel32]::OOBEComplete([ref] $IsOOBEComplete)
$IsOOBEComplete