Question [Fonction] Activer les logs Powershell
- Laurent Dardenne
- Auteur du sujet
- Hors Ligne
- Modérateur
-
Réduire
Plus d'informations
- Messages : 6302
- Remerciements reçus 68
il y a 3 ans 10 mois #30646
par Laurent Dardenne
Tutoriels PowerShell
[Fonction] Activer les logs Powershell a été créé par Laurent Dardenne
The following PowerShell functions let you enable and disable the system-wide transcription policies.
function Enable-PSTranscription {
#https://devblogs.microsoft.com/powershell/powershell-the-blue-team/
[CmdletBinding()]
param(
$OutputDirectory,
[Switch] $IncludeInvocationHeader
)
# Ensure the base path exists
$basePath = "HKLM:\Software\Policies\Microsoft\Windows\PowerShell\Transcription"
if (-not (Test-Path $basePath))
{ New-Item $basePath -Force > $NULL}
# Enable transcription
Set-ItemProperty $basePath -Name EnableTranscripting -Value 1
# Set the output directory
if($PSCmdlet.MyInvocation.BoundParameters.ContainsKey("OutputDirectory"))
{ Set-ItemProperty $basePath -Name OutputDirectory -Value $OutputDirectory }
# Set the invocation header
if($IncludeInvocationHeader)
{ Set-ItemProperty $basePath -Name IncludeInvocationHeader -Value 1 }
}
function Disable-PSTranscription {
Remove-Item HKLM:\Software\Policies\Microsoft\Windows\PowerShell\Transcription -Force -Recurse
}
Tutoriels PowerShell
Connexion ou Créer un compte pour participer à la conversation.
Temps de génération de la page : 0.100 secondes
- Vous êtes ici :
-
Accueil
-
forum
-
PowerShell
-
Contributions à la communauté
- [Fonction] Activer les logs Powershell