From 6e3e8eb4b38ee83113a5693a5d85d7c33b79bfc3 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 6 Aug 2024 14:32:37 +0200 Subject: [PATCH] Add a function for checking whether a setup is being run --- scripts/Windows/Scripts/Config.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/Windows/Scripts/Config.ps1 b/scripts/Windows/Scripts/Config.ps1 index 26f24c0e..aab9778c 100644 --- a/scripts/Windows/Scripts/Config.ps1 +++ b/scripts/Windows/Scripts/Config.ps1 @@ -214,6 +214,14 @@ $null = New-Module { Get-Config "valhalla.software.$Name"; } + <# + .SYNOPSIS + Checks whether the current user is the setup user. + #> + function Test-SetupUser { + $env:UserName -eq (Get-Config "valhalla.windows.setupUser"); + } + <# .SYNOPSIS Checks whether the active session is executed with admin rights.