elements = []
for x in range(10000):
elements.append(x)
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
<# | |
.SYNOPSIS | |
Get-SqlErrorLog is designed to quickly retrieve data from SQL Server error logs, negating the slowness of SSMS and awkwardness of manually crawling files. | |
.DESCRIPTION | |
Get-SqlErrorLog is designed to quickly retrieve data from SQL Server error logs, negating the slowness of SSMS and awkwardness of manually crawling files. | |
It is designed to be quite light in it's process, and should be quick (loading SQLPLS being the exception. |
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
{ | |
"Write Verbose": { | |
"prefix": "wv", | |
"body": [ | |
"Write-Verbose \"[${TM_FILENAME/(.*)\\..+$/$1/}] $0\"" | |
], | |
"description": "Write-Verbose with base name of filename." | |
}, | |
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
#region setup | |
$WorkingDir = $psISE.CurrentFile.FullPath | Split-Path | |
Set-Location $WorkingDir | |
Add-AzureRmAccount | |
$AAAcct = Get-AzureRmAutomationAccount -Name DSCDemo01 -ResourceGroupName DSCDemo01 | |
#endregion | |
#region list local VMs | |
Get-VM | Where-Object -FilterScript {$_.State -eq 'Running'} | |
#endregion |
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
#region setup | |
$WorkingDir = $psISE.CurrentFile.FullPath | Split-Path | |
Set-Location $WorkingDir | |
#Add-AzureRmAccount | |
$AAAcct = Get-AzureRmAutomationAccount -Name DSCDemo01 -ResourceGroupName DSCDemo01 | |
function Wait-AADSCCompileJob { | |
param ( | |
[parameter(Mandatory,ValueFromPipeline)] | |
[Microsoft.Azure.Commands.Automation.Model.CompilationJob] $CompileJob, |
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
# Get credentials and store them securely in an encrypted xml file | |
if (-NOT (Test-Path "${env:\userprofile}\DBA001.Cred")){ | |
$Credential = Get-Credential | |
$Credential | Export-CliXml -Path "${env:\userprofile}\DBA001.Cred" | |
} | |
#Load the credentials | |
$SqlCredential = Import-CliXml -Path "${env:\userprofile}\DBA001.Cred" | |
# Create a CSV of all the databases that are in the availability group. This updates each time to be complete |
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
<# | |
Listing of the required information to install SQL Server Management Studio via the Package resource with PowerShell DSC. | |
# Example config: | |
Configuration InstallSSMS { | |
Package InstallSsms { | |
Ensure = "Present" | |
ProductID = <GUID value> | |
Name = Full SSMS Name that displays in Program Features | |
Path = SSMS-Setup-ENU.exe |
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 findshit ($str) { | |
$str = [regex]::escape($str) | |
Select-String -Pattern $str -Path (Get-ChildItem C:\github\dbatools\*.ps* -Recurse -Exclude 'allcommands.ps1', '*.dll', "*psproj") | |
} |
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
([adsi]'WinNT://domain/username,user').ChangePassword('oldpassword','newpassword') |
OlderNewer