1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
$DeniedCommands = @(
"Stop-Process",
"Restart-Computer"
)
$ExecutionContext.SessionState.Applications.Clear()
$ExecutionContext.SessionState.Scripts.Clear()
#Accès indirect au cmdlet
function Reboot {Restart-Computer -WhatIf}
Get-Command -CommandType Cmdlet, alias, function |
Where {$DeniedCommands -contains $_.Name} |
Foreach {$_.Visibility="Private"}
#$ExecutionContext.SessionState.LanguageMode="NoLanguage"
$ExecutionContext.SessionState.LanguageMode="RestrictedLanguage"
# Stop-Process 'introuvable'
gcm -Noun process
#Ceci n'est pas persistant
#Fermer et relancer une autre session. |