This file contains hidden or 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
# There must be a better way to do this | |
$Sps = $srv.Databases['DBA-Admin'].StoredProcedures.Where{$_.Schema -eq 'dbo'}.Name | |
$Return.OlaProcs = $true | |
$I = 4 | |
if($Sps -notcontains 'CommandExecute') | |
{$I --} | |
if($Sps -notcontains 'DatabaseBackup') | |
{$I --} | |
if($Sps -notcontains 'DatabaseIntegrityCheck') | |
{$I --} |
This file contains hidden or 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
#Generic tests at the top - interesting stuff at line 108 | |
$Here = Split-Path -Parent $MyInvocation.MyCommand.Path | |
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace('.Tests.', '.') | |
. "$here\$sut" | |
"$here\$sut" | |
. "$Here\SharedFunctions.ps1" | |
Import-Module PSScriptAnalyzer | |
$Rules = Get-ScriptAnalyzerRule | |
$Name = $sut.Split('.')[0] |
This file contains hidden or 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
USE [DBADatabase] | |
GO | |
/****** Object: Table [Info].[Alerts] Script Date: 21/11/2016 16:50:57 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO |
This file contains hidden or 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
$Webpage = iwr http://tugait.pt/2017/speakers/ | |
$SpeakersImages = $webpage.Images.Where{$_.class -eq 'speaker-image lazyOwl wp-post-image'}.src | |
$Faces = @() | |
foreach($URL in $SpeakersImages) | |
{ | |
$jsonBody = @{url = $URL} | ConvertTo-Json | |
$apiUrl = "https://westus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur" | |
$apiKey = 'c9c98da91bbb4b1490bd24e136353766' | |
$headers = @{ "Ocp-Apim-Subscription-Key" = $apiKey } |
This file contains hidden or 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-SQLDiagRecommendations { | |
[cmdletbinding()] | |
Param() | |
if(!(Get-ChildItem Env:MS_SQLDiag_APIKey -ErrorAction SilentlyContinue)){ | |
Write-Warning "You have not created an Environment Variable MS_SQLDiag_APIKey to hold the APIKey | |
You can do this using [Environment]::SetEnvironmentVariable(`"MS_SQLDiag_APIKey`", `"APIKEYGOESHERE`", `"User`") | |
You can get a key by following the steps here https://ecsapi.portal.azure-api.net/ " | |
} | |
} |
This file contains hidden or 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
## Load assembly | |
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.SqlParser") | Out-Null | |
$ParseOptions = New-Object Microsoft.SqlServer.Management.SqlParser.Parser.ParseOptions | |
$ParseOptions.BatchSeparator = 'GO' | |
## No Errors | |
$Sql = "Select * from sys.sysdatabases" | |
$Script = [Microsoft.SqlServer.Management.SqlParser.Parser.Parser]::Parse($SQL, $ParseOptions) | |
$Script.Errors |
This file contains hidden or 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
$ModuleName = 'BeardAnalysis' | |
$Description = "This is a demo module for demoing Plaster and TDD with Pester and CI with VSTS to the PowerShell Gallery" | |
$plaster = @{ | |
TemplatePath = "GIT:\PlasterTemplate" #(Split-Path $manifestProperties.Path) | |
DestinationPath = "Git:\$ModuleName" | |
FullName = "Rob Sewell" | |
ModuleName = $ModuleName | |
ModuleDesc = $Description | |
Version = '0.9.18' |
This file contains hidden or 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-PsRemoting | |
{ | |
# Written by Lee Holmes - http://www.leeholmes.com/blog/2009/11/20/testing-for-powershell-remoting-test-psremoting/ | |
param( | |
[Parameter(Mandatory = $true)] | |
$computername | |
) | |
try | |
{ |
This file contains hidden or 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
Describe " This is a test"{ | |
Context "Scoping my tests" { | |
$Drives = (Get-PSDrive -PSProvider FileSystem | Where-Object {$_.Name.Length -eq 1}).Name | |
$TestCases = @() | |
$Drives.ForEach{ | |
$Testcases += @{'DriveLetter' = "$($_):"} | |
} | |
It "Checking if bitlocker is fully encrypted on Drive <DriveLetter>" -TestCases $Testcases { | |
Param($DriveLetter) |
This file contains hidden or 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
$file = ## whatever Get-ChildItem or path | |
$Instance | |
$JobName = 'Restore' + (Get-Random).ToString() | |
$Date = (Get-Date).DateTime.ToString() | |
$msg = "$Date - Starting Job $JobName to restore the database" | |
## LoggingFunction $msg | |
$pscmdlet.WriteVerbose($msg) |
OlderNewer