Skip to content

Instantly share code, notes, and snippets.

View adbertram's full-sized avatar

Adam Bertram adbertram

View GitHub Profile
<#
.NOTES
Created on: 5/22/2014 10:56 AM
Created by: Adam Bertram
Filename: Remove-CMDirectoryMembershipRule.ps1
Credits: http://www.david-obrien.net/2013/02/24/remove-direct-membership-rules-configmgr/
.DESCRIPTION
This script removes all direct membership rules from a specified collection name
.EXAMPLE
.\Remove-CMDirectMembershipRule.ps1 -SiteCode 'CON' -SiteServer 'SERVERNAME' -CollectionName 'NAMEHERE'
## From the adamtheautomator.com blog
Function Get-SccmClientLog ($ComputerName,$LogName) {
try {
Write-Debug "Initiating the $($MyInvocation.MyCommand.Name) function...";
$output_properties = @{'ComputerName'=$ComputerName;'Log'=$LogName}
if ($LogName -ne 'setup') {
$sPath = "\\$ComputerName\admin$\ccm\logs"
$aLogData = @();
@adbertram
adbertram / Get-EventsInTimeframe.ps1
Last active December 14, 2020 16:34
events in timeframe
## Found at https://adamtheautomator.com/get-eventlog-powershell/
<#
.SYNOPSIS
This script searches a Windows computer for all event log or text log entries
between a specified start and end time.
.DESCRIPTION
This script enumerates all event logs within a specified timeframe and all text logs
that have a last write time in the timeframe or contains a line that has a date/time
reference within the timeframe. It records this information to a set of files and copies
---
- hosts: azurevms
gather_facts: no
tasks:
- name: Install IIS features
win_feature:
name:
- Web-Server
- Web-Common-Http
- Web-Mgmt-Service
## Ensure you're using 2.0+ of the azurevm provider to get the azurerm_windows_virtual_machine reosurce and
## the other resources and capabilities
provider "azurerm" {
version = "2.0.0"
features {}
}
## Create an Azure resource group using the value of resource_group and the location of the location variable
## defined in the terraform.tfvars file.
resource "azurerm_resource_group" "monolithRG" {
#region Ensure the WinRm service is running
Set-Service -Name "WinRM" -StartupType Automatic
Start-Service -Name "WinRM"
#endregion
#region Enable PS remoting
if (-not (Get-PSSessionConfiguration) -or (-not (Get-ChildItem WSMan:\localhost\Listener))) {
Enable-PSRemoting -SkipNetworkProfileCheck -Force
}
#endregion
## Define each computer you'd like to run the install on
$computers = 'COMP1','COMP2','COMP3'
## This is the path that contains the installer file for the software you'd like to install on the servers
$softwarePath = '\\MEMBERSRV1\Software'
## Read each of the computers in the $computers array defined above
foreach ($pc in $computers) {
## Copy \\MEMBERSRV1\Software to each target computers' C:\Windows\Temp folder
Copy-Item -Path $softwarePath -Destination "\\$pc\c$\Windows\Temp"
#region Var setup
## Be sure to fill in your values here
$resourceGroupName = 'AcmeApp'
$region = 'xxxxxxx'
$localVMAdminPw = 'I like azure.' ## a single password for demo purposes
$sqlAdminUsername = 'sqladmin'
$sqlAdminPw = 'I like azure.'
$projectName = 'AcmeApp' ## common term used through set up
$resourceGoupName = 'skylinespsdemo'
$azureRegion = 'East US'
$vmName = 'MYVM'
#region Create the resource group
New-AzResourceGroup -Name $resourceGoupName -Location $azureRegion
#endregion
#region Create the vNet for the VM
$newSubnetParams = @{
<script>
var contentsTitle = "Table of Contents"; // Set your title here, to avoid making a heading for it later
var ToC = "<h2>"+contentsTitle+"</h2>";
ToC += "<nav role='navigation' class='table-of-contents'><ul>";
var first = false;
$("h2,h3").each(function() {
var el = $(this);
if (first === false) {
first = true;
$('<span id="dynamictoc"></span>').insertBefore(el);