Skip to content

Instantly share code, notes, and snippets.

View gravcat's full-sized avatar

poppoppop gravcat

View GitHub Profile
@gravcat
gravcat / war3_install.ps1
Created March 2, 2018 21:36
random wc3 lan install script. not done nor quality
#Requires -Version 4.0
#Requires -RunAsAdministrator
$ErrorActionPreference = "Stop"
$userHome = (Get-ChildItem Env:USERPROFILE).Value
cd $PSScriptRoot
$confirmation = Read-Host "This script will extract files to your Documents and Program Files (x86) folders, proceed? [y/n]"
while($confirmation -ne "y")
{
@gravcat
gravcat / ansible_win_module_ideas
Last active February 22, 2018 19:28
informal list of things i think would make good ansible modules
"Unblocking" file(s) in Windows via PowerShell
@gravcat
gravcat / ansible_winrm_check_feature_enabled.yml
Created February 22, 2018 17:54
via Ansible, check whether or not a Windows feature is in an "Enabled" state. Conditional to enable feature if it is determined to not be in an Enabled state
---
- hosts: all
tasks:
- name: Check for WSL feature enablement
win_shell: "(Get-WindowsOptionalFeature -Online -FeatureName 'Microsoft-Windows-Subsystem-Linux').State"
register: wsl_check
- name: Install WSL Feature
win_shell: "{{ item }}"
with_items:
New-Item -ItemType File C:\helloworld.txt
#!/bin/bash
# export deployment info from mcp
timestamp=$(date +"%Y%m%d-%H%M")
# create directory in home based on timestamp like 20180221-1058, cd into
mkdir ~/$timestamp
cd ~/$timestamp
# export data from mongo
@gravcat
gravcat / ping_windows_hosts.yml
Created January 29, 2018 23:38
Use the built-in win_ping module in Ansible to confirm proper connectivity and credential success for manipulating Windows hosts
---
- hosts: windows
tasks:
- name: ping
win_ping:

Keybase proof

I hereby claim:

  • I am gravcat on github.
  • I am nthieling (https://keybase.io/nthieling) on keybase.
  • I have a public key ASBh5RivFs-YlicPCROrBXDSOmilWh6Sr67-_ucBdHkXSQo

To claim this, I am signing this object:

Write-Output "Configuring UAC to not prompt Administrators"
REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0x0 /f
Write-Output "Creating directories"
if (!(Test-Path "C:\_maintainer")) {
New-Item -Type Directory "C:\_maintainer"
}
cd "C:\_maintainer"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1" -OutFile "ConfigureRemotingForAnsible.ps1"
function New-RandomComplexPassword ($length=12)
{
$Assembly = Add-Type -AssemblyName System.Web
$password = [System.Web.Security.Membership]::GeneratePassword($length,2)
return $password
}
# https://blogs.technet.microsoft.com/stefan_stranger/2017/07/31/using-azure-custom-script-extension-to-execute-scripts-on-azure-vms/
Enter-PSSession -ComputerName $comp -Credential $credential -UseSSL -SessionOption (New-PsSessionOption -SkipCACheck -SkipCNCheck)