Created
April 18, 2019 16:49
-
-
Save vestjoe/0213c359e163a12a7fc4cd50c430291e to your computer and use it in GitHub Desktop.
usersim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param | |
( | |
$username, | |
$password, | |
$domain | |
) | |
# Setup User Simulation | |
"[*] Setting up User Simulation" | Out-File -FilePath C:\Users\Public\usersim.txt -Append | |
$run = 'HKLM:\\\\SOFTWARE\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run' | |
if(Test-Path C:\Users\Public\AdminActions\usersim.exe) | |
{ | |
Set-ItemProperty $run Start_User_Sim "schtasks /create /ru minis\$($username) /rp $($password) /it /tn UserSimulation /sc MINUTE /mo 5 /tr `"cmd /c cd C:\Users\Public\AdminActions && usersim.exe`" /f" | |
} | |
elseif(Test-Path C:\Users\Public\MarketingActions\usersim.exe) | |
{ | |
Set-ItemProperty $run Start_User_Sim "schtasks /create /ru minis\$($username) /rp $($password) /it /tn UserSimulation /sc MINUTE /mo 5 /tr `"cmd /c cd C:\Users\Public\MarketingActions && usersim.exe`" /f" | |
} | |
elseif(Test-Path C:\Users\Public\usersim\usersim.exe) | |
{ | |
Set-ItemProperty $run Start_User_Sim "schtasks /create /ru minis\$($username) /rp $($password) /it /tn UserSimulation /sc MINUTE /mo 5 /tr `"cmd /c cd C:\Users\Public\usersim && usersim.exe`" /f" | |
} | |
"[+] Setting up User Simulation" | Out-File -FilePath C:\Users\Public\usersim.txt -Append | |
# Add User Auto Logon | |
"[*] Setting Auto Logon User" | Out-File -FilePath C:\Users\Public\usersim.txt -Append | |
$key = 'HKLM:\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\Winlogon' | |
Set-ItemProperty $key AutoAdminLogon 1 | |
Set-ItemProperty $key DefaultUserName $username | |
Set-ItemProperty $key DefaultPassword $password | |
Set-ItemProperty $key DefaultDomainName $domain | |
"[+] Setting Auto Logon User" | Out-File -FilePath C:\Users\Public\usersim.txt -Append | |
# Allow all Authenticated Users to use Remote Desktop | |
"[*] Adding Authenticated Users to the Remoted Desktop Users group" | Out-File -FilePath C:\Users\Public\usersim.txt -Append | |
Set-ItemProperty $run Set_RDP_Users "NET LOCALGROUP "Remote Desktop Users" "Authenticated Users" /ADD" | |
"[+] Adding Authenticated Users to the Remoted Desktop Users group" | Out-File -FilePath C:\Users\Public\usersim.txt -Append | |
# Set PSRemoting | |
Enable-PSRemoting -SkipNetworkProfileCheck -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment