Skip to content

Instantly share code, notes, and snippets.

crshnbrn66 / Get-WebAppPoolStatus.ps1
Created Nov 13, 2015
Get the last time app pool was Restarted.
View Get-WebAppPoolStatus.ps1
function get-webApppoolstatus($pool)
$poolReturn = @()
$poolStatus = gwmi win32_process -filter "Name like '%w3wp%'" | select name, Processid, commandline, creationdate
foreach($status in $poolStatus)
if(($status.commandline) -like "*$pool*" -and ($pool -ne $null))
$status.creationdate = [System.Management.ManagementDateTimeConverter]::ToDateTime($status.creationdate)
View gui-localuser.ps1
#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)
View Test-FileOpen
function Test-FileOpen
Tests to see if a file is locked
Returns true if the file can be opened. False if the file is open already.
.PARAMETER path to file
crshnbrn66 / SQLJob.ps1
Last active Jan 11, 2016
Script to create Sql jobs / query them and steps
View SQLJob.ps1
#Requires -Version 3.0
function Get-SqlJobs
param([string]$sqlServer, [string]$sqlinstance = $null)
$s = New-SqlServerConnection -sqlServer $sqlServer -sqlinstance $sqlinstance
$jobs = $s.JobServer.Jobs
View setup-arr.ps1
# 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
View Gui-SSRS-Deploy.ps1
# Source File Information (DO NOT MODIFY)
# Source ID: 9ad32074-7adb-4822-a049-93600f966aa9
# Source File: ..\Documents\SAPIEN\Projects\Gui-SSRS-Deploy\Gui-SSRS-Deploy.psproj
#region Project Recovery Data (DO NOT MODIFY)
View deployspapp.ps1
$Destination ,
crshnbrn66 / backupBuildRelease.ps1
Created Feb 9, 2017
Backup TFS 2013 release 3 build and release definitions
View backupBuildRelease.ps1
function Backup-TFSReleaseDefinitions
param([object]$tfsprojs,$tfsurl = '', $tfscollection = 'Defaultcollection', $apiversion = '3.0-preview',[string]$Path = 'c:\temp\tfsprojects')
$tfsInstance = "http://$($tfsurl):8080/tfs/$tfsCollection"
foreach($tfsproj in $tfsprojs.value)
$tfsProjName = $
$tfsdev = "$tfsInstance/$tfsProjName"
$projectIds = Invoke-RestMethod -Method Get -UseDefaultCredentials -uri "$tfsdev/_apis/release/definitions?api-version=$apiversion" -ContentType application/json
View CreateProfile.ps1
function CreateProfile
param([String]$UserSid, [String]$UserName, [system.uint32]$ProfilePath)
Add-Type -TypeDefinition '
using System;
using System.Runtime.InteropServices;
public static class PInvoke {
[DllImport("userenv.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern int CreateProfile( [MarshalAs(UnmanagedType.LPWStr)] String pszUserSid, [MarshalAs(UnmanagedType.LPWStr)] String pszUserName, [Out, MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszProfilePath, uint cchProfilePath);
View create-SSRSDataDrivenSub.ps1
$reportExportPath = 'C:\temp\reports'
$reportFiles = Get-ChildItem $reportExportPath -Filter *.xml
foreach($file in $reportFiles)
$reportobject = Import-Clixml -path ($file.fullname)
#$extensionsettings = [SSRSProxy.ExtensionSettings]::new()
$extensionSettings = New-Object -typename 'SSRSProxy.ExtensionSettings'
$extensionSettings.Extension = $
$paramvalues = @()
foreach($parameterField in $