Scripting Files
CMD Batch Files (.bat)
PowerShell (.ps1)
Python (.py)
JavaScript (.js)
Linux Bash Shell (.sh)
Use Cases
-Automation
-Remapping network drives
-Move user data
-Install applications
-Automated backups
-Information gathering

Python

# Quick Web Server ~/Folder$ python3 -m http.server 8000 http://HOST_IP:8000

Proxmox script

import requests # Set API endpoint and credentials api_url = "https://your-proxmox-host:8006/api2/json" api_token = "YOUR_API_TOKEN" api_username = "YOUR_API_USERNAME" # Set VM parameters vm_id = 100 # Choose an unused ID vm_name = "MyNewVM" vm_template = "local:vztmpl/debian-11-standard_11.6-1_amd64.tar.gz" vm_cpus = 2 vm_memory = 4096 vm_disk = "local-lvm" # Create the VM response = requests.post( f"{api_url}/nodes/{api_username}/qemu", headers={"Authorization": f"Bearer {api_token}"}, json={ "vmid": vm_id, "name": vm_name, "template": vm_template, "cpus": vm_cpus, "memory": vm_memory, "disk": vm_disk } ) # Check the response if response.status_code == 201: print(f"VM {vm_name} created successfully!") else: print(f"Error creating VM: {response.text}") # Save as create_vm.py
Windows
net use G: \\STATION\folder
Shell Scripting
#!/bin/bash Shell Scripting
$ echo $0 # what language is this terminal running? $ which $SHELL # what language is this terminal running? # Sharpbang ("Shebang") indicating the interpreter used #!/bin/bash #!/bin/sh #!/bin/zsh $ touch helloworld.sh # Create file $ bash helloworld.sh # execute shell script without changing permissions $ chmod 0755 helloworld.sh # change the file mode and permissions $ chmod +x helloworld.sh # change or add execution permissions $ ./helloworld.sh # execute shell script after changing permissions $ Hello World # output #!/bin/bash echo "Hello World" #!/bin/bash NAME="Markus" MESSAGE="Hola ${NAME}" echo $MESSAGE #!/bin/bash NAME=$1 COMPLIMENT=$2 ADJECTIVE=$3 echo "Good morning $NAME!" sleep 1 echo "Your $COMPLIMENT looks $ADJECTIVE today"