diff --git a/IsOOBEComplete.ps1 b/IsOOBEComplete.ps1 new file mode 100644 index 0000000..70a0fa6 --- /dev/null +++ b/IsOOBEComplete.ps1 @@ -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 \ No newline at end of file