This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param | |
( | |
[String] | |
[Parameter(Mandatory)] | |
$SourceFolder, | |
[String] | |
$Destination , | |
[string] | |
$AdminUserName, | |
[string] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Backup-TFSReleaseDefinitions | |
{ | |
param([object]$tfsprojs,$tfsurl = 'mytfsinstance.com', $tfscollection = 'Defaultcollection', $apiversion = '3.0-preview',[string]$Path = 'c:\temp\tfsprojects') | |
$tfsInstance = "http://$($tfsurl):8080/tfs/$tfsCollection" | |
foreach($tfsproj in $tfsprojs.value) | |
{ | |
$tfsProjName = $tfsproj.name | |
$tfsdev = "$tfsInstance/$tfsProjName" | |
$projectIds = Invoke-RestMethod -Method Get -UseDefaultCredentials -uri "$tfsdev/_apis/release/definitions?api-version=$apiversion" -ContentType application/json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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 = $reportobject.Subscriptions.properties.extensionSettings.Extension | |
$paramvalues = @() | |
foreach($parameterField in $reportobject.Subscriptions.properties.extensionSettings.ParameterValues) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -version 5.0 | |
function Get-DataDrivenSubscriptionProperties | |
{ | |
param([object] $Subscription, | |
[object]$ssrsproxy) | |
$ssrsobject = [SSRSObject]::New() | |
$sid = $Subscription.SubscriptionID | |
$ddextensionSettings = $ddDataRetrievalPlan = $ddDescription = $ddactive = $ddstatus = $ddeventtype = $ddmatchdata = $ddparameters = $Null | |
$ddOwner = $ssrsproxy.GetDataDrivenSubscriptionProperties($sid,[ref]$ddextensionSettings,[ref]$ddDataRetrievalPlan` | |
,[ref]$ddDescription,[ref]$ddactive,[ref]$ddstatus,[ref]$ddeventtype,[ref]$ddmatchdata,[ref]$ddparameters) |
OlderNewer