Skip to content

Instantly share code, notes, and snippets.

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@lordmuffin
lordmuffin / win-updates.ps1
Last active July 3, 2018 19:12
Win Updates Script with WSUS Checker
param($global:RestartRequired=0,
$global:MoreUpdates=0,
$global:MaxCycles=5,
$MaxUpdatesPerCycle=500,
$WSUSGroup="all",
$WSUSServer="1.1.1.1")
$Logfile = "C:\Windows\Temp\win-updates.log"
function LogWrite {
---
# Be sure to set the following variables for all hosts:
# vars:
# oldsshport: 22
# sshport: 555
# Might fail without setting remote_tmp = /tmp/ansible/$USER in your ansible.cfg. Also fix for directly below.
# Once host is setup most of the checks are skipped and works very quickly.
# Also, be sure to set non-standard shells in a different playbook later. Stick with /bin/bash until you can run apt install.
# Assumes root user has sshkey setup already. Not sure how to utilize the --ask-pass option. For now, use ssh-copy-id prior to running playbook on new host for root user (if needed).
@lordmuffin
lordmuffin / hostname1.yml
Last active July 21, 2017 16:54
Example of nested playbooks and different ip?
- name: this is a play at the top level of a file
hosts: pre-ip
remote_user: root
tasks:
- name: say hi
tags: foo
shell: echo "hi..."

Keybase proof

I hereby claim:

  • I am lordmuffin on github.
  • I am lordmuffin (https://keybase.io/lordmuffin) on keybase.
  • I have a public key ASCk3P_tXHa_U7SIoQYgfdsfi6jVN-Dd-oQCemoIsFvs-Qo

To claim this, I am signing this object:

# This is a remote logoff script intended to logoff any user off of a series of remote systems in a domain.
# This will also generate a logfile in the folder that it is run in. - This should be helpfull for any troubleshooting that maybe required.
# Writtin by: Andrew Jackson
#Import Logging Function
<#
.SYNOPSIS
RemoteLogoffUser
.DESCRIPTION
## Get all distribution list email addresses and output to csv
$dgs = Get-DistributionGroup -ResultSize Unlimited | Select DisplayName, EmailAddresses
$foreach = Foreach($dg in $dgs) {
New-Object PSObject -Property @{
DisplayName = $dg.DisplayName
EmailAddresses = [String]$dg.EmailAddresses
}
}
## Get all mailbox email addresses and output to csv
$mbx = Get-Mailbox -ResultSize Unlimited | Select DisplayName, EmailAddresses
$foreach = Foreach($mailbox in $mbx) {
New-Object PSObject -Property @{
DisplayName = $mailbox.DisplayName
EmailAddresses = [String]$mailbox.EmailAddresses
}
}