Eerst Windows PowerShell-scripts uitvoeren bij aanmelden en afmelden van gebruiker: registerwaarde RunUserPSScriptsFirstComputerHKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System

Beleids-ID
Run_User_PS_Scripts_First
Bereik
Computerconfiguratie, Gebruikersconfiguratie
Ondersteund op
Minimaal Windows Server 2008 R2 of Windows 7
Bron
Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (versie 1.0)
Categorie
Systeem › Scripts

Register

RunUserPSScriptsFirst

REG_DWORDComputerGebruiker
Waarde bij ingeschakeld
1
Waarde bij uitgeschakeld
0
Toepassen met .reg · CMD · PowerShell
ComputerInstelling voor de hele computer
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System]

; Opties (gebruik er maar één)
; Ingeschakeld
"RunUserPSScriptsFirst"=dword:00000001
; Uitgeschakeld
"RunUserPSScriptsFirst"=dword:00000000
CMD
:: Opties (gebruik er maar één)

:: Ingeschakeld
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v "RunUserPSScriptsFirst" /t REG_DWORD /d 1 /f
:: Uitgeschakeld
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v "RunUserPSScriptsFirst" /t REG_DWORD /d 0 /f
PowerShell
# Algemeen: sleutel maken
New-Item -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System' -Force | Out-Null

# Opties (gebruik er maar één)
# Ingeschakeld
New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System' -Name 'RunUserPSScriptsFirst' -PropertyType DWord -Value 1 -Force | Out-Null
# Uitgeschakeld
New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System' -Name 'RunUserPSScriptsFirst' -PropertyType DWord -Value 0 -Force | Out-Null
GebruikerInstelling per account
.reg
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]

; Opties (gebruik er maar één)
; Ingeschakeld
"RunUserPSScriptsFirst"=dword:00000001
; Uitgeschakeld
"RunUserPSScriptsFirst"=dword:00000000
CMD
:: Opties (gebruik er maar één)

:: Ingeschakeld
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v "RunUserPSScriptsFirst" /t REG_DWORD /d 1 /f
:: Uitgeschakeld
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v "RunUserPSScriptsFirst" /t REG_DWORD /d 0 /f
PowerShell
# Algemeen: sleutel maken
New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System' -Force | Out-Null

# Opties (gebruik er maar één)
# Ingeschakeld
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System' -Name 'RunUserPSScriptsFirst' -PropertyType DWord -Value 1 -Force | Out-Null
# Uitgeschakeld
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System' -Name 'RunUserPSScriptsFirst' -PropertyType DWord -Value 0 -Force | Out-Null