Skip to content

Instantly share code, notes, and snippets.

caveatlector

  • Joined Jun 6, 2019
Block or report user

Report or block caveatlector

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@caveatlector
caveatlector / gist:eca31bb464c19e9bb70bbbc7f6fe1ad2
Last active Jun 17, 2019
Azure: provision an IaaS AD DS domain controller
View gist:eca31bb464c19e9bb70bbbc7f6fe1ad2
# Create a Windows Server 2016 VM with a private IP in a specific subnet.
az network nic create \
-g ctrlitws-s-rg \
-n ctrl-s-ad-nic \
--private-ip-address ${IP} \
--subnet "/subscriptions/${SUBSCRIPTION}/resourceGroups/${RG}/providers/Microsoft.Network/virtualNetworks/${NET}/subnets/${SUBNET}"
az vm create \
-g ${RG} \
@caveatlector
caveatlector / gist:1f081a3f82c7057baa35f5650cf3cbb5
Created Jun 17, 2019
PowerShell: add user to local group
View gist:1f081a3f82c7057baa35f5650cf3cbb5
Add-LocalGroupMember -Group ${GROUP} -Member ${USER}
@caveatlector
caveatlector / gist:0aca83cfd97948266ae920051c13286b
Created Jun 12, 2019
Robocopy: copy directory recursively
View gist:0aca83cfd97948266ae920051c13286b
robocopy \${SOURCE} \${TARGET} /E
View gist:44044741d97a0203500d9d6fe0911de3
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/attach-managed-disk-portal
@caveatlector
caveatlector / sqlcmd_test_getdate.bash
Created Jun 7, 2019
sqlcmd: test connection via getdate()
View sqlcmd_test_getdate.bash
#!/usr/bin/env bash
# Requires: sqlcmd
IP=
sqlcmd -S tcp:${IP},1433 -Q "select getdate()"
@caveatlector
caveatlector / azure_create_windows_vm.bash
Last active Jun 7, 2019
Azure: create Windows VM (from existing disks)
View azure_create_windows_vm.bash
#!/usr/bin/env bash
# Requires: az-cli
DATA_DISK= # Existing data disk (by name)
NSG= # Existing NSG (by name)
OS_DISK # Existing OS disk (by name)
PRIVATE_IP= # Available private IP address, e.g. 10.0.0.10
PUBLIC_IP= # Existing public IP address (by name)
RG_TARGET= # Existing resource group (by name) for deployment
@caveatlector
caveatlector / azure_copy_storage-account_container.bash
Last active Jun 7, 2019
Azure: copy Storage Accounts container
View azure_copy_storage-account_container.bash
#!/usr/bin/env bash
# Requires: az-cli, azcopy, jp
SOURCE= # Source Storage Account name
TARGET= # Target Storage Account name
SOURCE_KEY= # Source Storage Account key
TARGET_KEY= # Target Storage Account key
for CONTAINER in $(az storage container list --account-name ${SOURCE} | jp [].name)
@caveatlector
caveatlector / nmap_scan_array.bash
Last active Jun 7, 2019
nmap: TCP/UDP port scan array of IPs
View nmap_scan_array.bash
#!/usr/bin/env bash
# Requires: nmap
TIMESTAMP=$(date +"%Y%m%d%M")
TARGETS=( ) # E.g. TARGETS=( 1.0.0.1 1.1.1.1 )
for TARGET in "${TARGETS[@]}"
do
echo "Begin scan: ${TARGET}" | tee -a nmap_${TIMESTAMP}.log
You can’t perform that action at this time.