Skip to content

Instantly share code, notes, and snippets.

View crshnbrn66's full-sized avatar

Thom Schumacher crshnbrn66

View GitHub Profile
@crshnbrn66
crshnbrn66 / Invoke-RestSPO.ps1
Last active July 3, 2018 19:13 — forked from vgrem/Invoke-RestSPO.ps1
SharePoint Online REST request
Add-Type –Path 'C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll'
Add-Type –Path 'C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll'
#http://www.codeproject.com/Articles/990131/CRUD-Operation-to-List-Using-SharePoint-Rest-API
#https://msdn.microsoft.com/en-us/library/office/fp142380.
#http://paulryan.com.au/2013/odata-in-sharepoint/
#https://wmostafaw.wordpress.com/2012/11/17/odata-in-sharepoint-2013-lists-and-items/
#http://blogs.msdn.com/b/uksharepoint/archive/2013/02/22/manipulating-list-items-in-sharepoint-hosted-apps-using-the-rest-api.aspx
#http://www.odata.org/getting-started/basic-tutorial/
@crshnbrn66
crshnbrn66 / Get-WebAppPoolStatus.ps1
Created November 13, 2015 22:31
Get the last time app pool was Restarted.
function get-webApppoolstatus($pool)
{
$poolReturn = @()
$poolStatus = gwmi win32_process -filter "Name like '%w3wp%'" | select name, Processid, commandline, creationdate
#$poolstatus.converttodatetime($poolStatus.creationdate)
foreach($status in $poolStatus)
{
if(($status.commandline) -like "*$pool*" -and ($pool -ne $null))
{
$status.creationdate = [System.Management.ManagementDateTimeConverter]::ToDateTime($status.creationdate)
#This gets the group information in a functioncall used by two other functions
function getComputerGroup
{ param($strComputer, $strGroup)
$computer = [ADSI]('WinNT://' + $strComputer + ',computer')
$Group = $computer.psbase.children.find($strGroup)
return $Group
}
# This will list what’s currently in a Group so you can verify the result
function listUsers
{ param($strComputer, $strGroup)
#http://nakedalm.com/powershell-tfs-2013-api-1-get-tfscollection-and-tfs-services/
#http://blogs.msdn.com/b/alming/archive/2013/03/07/using-powershell-and-tfs-api-to-list-users-in-tfs-2010.aspx
#http://www.mikepoulson.com/2014/04/enumerating-tfs-permissions-for-items.html
function Connect-ToTfs
{
Param([string] $Collectionurl)
#the collection url will be cast as a uri to the getteamproject collection.
write-host $Collectionurl
if ($CollectionUrl -ne '')
{
# http://stackoverflow.com/a/13519264
#http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemrights%28v=vs.110%29.aspx
function Remove-PermissionsForGroup
{
<#
.Synopsis
Removes Ntfs permissions for the directory specified..
.DESCRIPTION
This script sets the ntfs permissions for the directory passed.
function Test-FileOpen
{
<#
.SYNOPSIS
Tests to see if a file is locked
.DESCRIPTION
Returns true if the file can be opened. False if the file is open already.
.PARAMETER path to file
@crshnbrn66
crshnbrn66 / SQLJob.ps1
Last active January 11, 2016 16:51
Script to create Sql jobs / query them and steps
#http://sqlblog.com/blogs/allen_white/archive/2008/01/09/create-agent-jobs-to-run-powershell-scripts.aspx
#https://msdn.microsoft.com/en-us/library/ms162162.aspx
#Requires -Version 3.0
function Get-SqlJobs
{
param([string]$sqlServer, [string]$sqlinstance = $null)
$s = New-SqlServerConnection -sqlServer $sqlServer -sqlinstance $sqlinstance
$jobs = $s.JobServer.Jobs
$jobs
}
#http://www.iis.net/learn/extensions/configuring-application-request-routing-(arr)/achieving-high-availability-and-scalability-arr-and-nlb
# This script is used in octopus to deploy ARR to host targetted for it.
#
function stop-WAS
{
$i = 0
$service = get-service WAS -ErrorAction SilentlyContinue
if($service)
{
@crshnbrn66
crshnbrn66 / Compare-iisSites.ps1
Last active June 16, 2020 11:04
Retrieves IIS settings from remote machines and presents difference view in winmerge
#Requires -Modules webadministration
#Requires -RunAsAdministrator
#Requires -version 3.0
<#
.SYNOPSIS
Provides a means to get the current backup location for iis changes
.DESCRIPTION
Changes made to the IIS instance are recorded in a history config file. This function provides the means to retreive where it is on the machine
# SQLReporting.psm1 Version 0.9
# Written by Trond Hindenes
#http://hindenes.com/powershell/SQLReporting.psm1
#Import-Module Pester
#http://stackoverflow.com/questions/9178685/change-datasource-of-ssrs-report-with-powershell
<#
.SYNOPSIS
Gets SSRS instances on ComputerName
.DESCRIPTION