Skip to content

Instantly share code, notes, and snippets.

View gravcat's full-sized avatar

poppoppop gravcat

View GitHub Profile
# @manojampalam - authored initial script
# @friism - Fixed issue with invalid SDDL on Set-Acl
# @manojampalam - removed ntrights.exe dependency
# @bingbing8 - removed secedit.exe dependency
$scriptpath = $MyInvocation.MyCommand.Path
$scriptdir = Split-Path $scriptpath
$sshdpath = Join-Path $scriptdir "sshd.exe"
$sshagentpath = Join-Path $scriptdir "ssh-agent.exe"
function Create-Shortcut {
param (
[String]
$target,
[String]
$shortcutFile,
[Switch]
$admin,
Start-Transcript "C:\enable-wsl-feature.txt"
Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName Microsoft-Windows-Subsystem-Linux
Restart-Computer
Stop-Transcript
#Requires -RunAsAdministrator
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
& choco install -y sysinternals googlechrome 7zip teamviewer tightvnc notepadplusplus msiafterburner
Invoke-WebRequest -Uri "https://miner.nicehash.com/installer/windows/setup/nhm_setup_2.0.1.2.exe" -OutFile "$env:USERPROFILE\Downloads\nhm_setup_2.0.1.2.exe"
Write-Output "Heads-up, you need display drivers! On nvidia this is 'geforce-game-ready-driver-win10'"
# 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)
function New-RandomComplexPassword ($length=12)
{
$Assembly = Add-Type -AssemblyName System.Web
$password = [System.Web.Security.Membership]::GeneratePassword($length,2)
return $password
}
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"

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:

@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:
#!/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