Skip to content

Instantly share code, notes, and snippets.

View adbertram's full-sized avatar

Adam Bertram adbertram

View GitHub Profile
## 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 = @();
###################################################
# This is an associated snippet on learning Azure Functions by Jeff Brown at:
# https://adamtheatuomator.com/azure-functions-tutorial
###################################################
# The function URL appends the function name with a question mark and a code. This code is the function key and
# authenticates to the function for execution. Without this key, you would not be able to trigger the function.
# This key provides security so not just anyone can start the function.
$functionKey = '' ## Fill this in from the Get function URL page
$functionAppName = 'ata-powershell-functions'
###################################################
# This is an associated snippet on learning Azure Functions by Jeff Brown at:
# https://adamtheatuomator.com/azure-functions-tutorial
###################################################
## The using statement imports the System.Net namespace, and param() defines the function's parameters.
using namespace System.Net
## Input bindings are passed in via param block.
## The *$Request* parameter contains the information passed to the function during the HTTP request. This information includes the request headers, request body, HTTP method, parameters, and URL of the request.
#Requires -RunAsAdministrator
<#
.SYNOPSIS
This parses the native netstat.exe's output using the command line "netstat -anb" to find
all of the network ports in use on a local machine and all associated processes and services
.NOTES
Created on: 2/15/2015
Created by: Adam Bertram
Filename: Get-LocalPort.ps1
#Requires -Version 3
<#
.SYNOPSIS
This script checks a ConfigMgr site backup to ensure success and performs various post-backup functions that
back up other critical data that the built-in ConfigMgr site backup task does not.
.DESCRIPTION
This script checks any previous backup attempt ran within the last hour of this script running for a
a successful run if backup check is selected. It assumes you also have SSRS installed on the site DB server
and backs up both SSRS databases, exports out the SSRS encryption keys, backs up the export file and the
<#
.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'
@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
function Get-InstalledSoftware {
<#
.SYNOPSIS
Retrieves a list of all software installed
.EXAMPLE
Get-InstalledSoftware
This example retrieves all software installed on the local computer
.PARAMETER Name
The software title you'd like to limit the query to.
## 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"