Add IsOOBEComplete.ps1

This commit is contained in:
2026-03-28 05:56:53 +00:00
parent 5aec938a45
commit a23cbf11f2
+36
View File
@@ -0,0 +1,36 @@
#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