Hardening Powershell security

#@
#starting trancsript for all possible powershell sessions.
#if the profile is not there i create it first
#i also redirect the logs to a more “hiden” folder.
New-Item -Name PSlogs -Path c:\windows -ItemType Directory
if (test-path $profile.AllUsersAllHosts -ErrorAction SilentlyContinue)
{
“start-transcript” | out-file $profile.AllUsersAllHosts
}

else {
set-location c:\
new-item $PROFILE.CurrentUserAllHosts -ItemType file -Force
“start-transcript” | out-file $profile.AllUsersAllHosts
}

#@
#uninstall powershell v 2.0
disable-WindowsOptionalFeature -online -FeatureName MicrosoftWindowsPowerShellV2
disable-WindowsOptionalFeature -online -FeatureName MicrosoftWindowsPowerShellV2Root

Leave a Reply

Your email address will not be published. Required fields are marked *