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
<# Script out all SQL Agent jobs #> | |
$ServerInstance = "MY_SERVER" | |
$OutputPath ="G:\BACKUPS\MY_SERVER\MY_SERVERAgentJobs\" | |
$jobs = Get-DbaAgentJob -SqlInstance $serverInstance | |
foreach ($job in $jobs) | |
{ | |
$jobnameclean = $job.Name | |
#Write-Host "Job Name before clean: " $jobnameclean |
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
$ServerName = "Myserver.mydomain.co.uk" | |
$OutputPath = "G:\Backups\SRV01Users\" | |
$Dt = Get-Date -f yyyyMMdd #-hhmmss | |
$Databases = Get-DbaDatabase -sqlinstance localhost | |
$Counter = 1 | |
$DBCount = $Databases.Count |
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
## Use Windows Credentials encrypted and stored in a file to invoke a PS command. Using the concept at: | |
## https://interworks.com/blog/trhymer/2013/07/08/powershell-how-encrypt-and-store-credentials-securely-use-automation-scripts | |
## Useful to run in situations where double-hop authentication is a problem | |
$Username = 'p_service_account' | |
$passfile = 'D:\scripts\p_service_account_password.txt' | |
$encrypted = Get-Content $passfile | ConvertTo-SecureString | |
$Cred = New-Object System.Management.Automation.PsCredential($Username, $encrypted) | |
$ServerName = 'SVR01.mydomain.com' |
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 script will retrieve a stored encrypted password to ensure the PS session has been started under the correct | |
## user context. This should only be needed for debugging/testing as the password will be exposed as plaintext | |
## (Note the same account password must be entered before the stored version will be decrypted) | |
## | |
## If the p/w does not come out as expected, try opening the PS session using 'Run as a different user' then | |
## entering the creds of the account the encrypted password belongs to (usually a service acct). Or enter the following: | |
## start powershell_ise -credential "" | |
## | |
"User: " + $env:UserName |
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
## Encrypt a password/key in a file using Windows Credentials | |
## To log on as another user (e.g. a service acct), use: | |
## start powershell_ise -credential "" | |
$filename = 'D:\scripts\p_ssas_backup_password.txt' | |
$credential = Get-Credential -Message "Enter password" -UserName $env:username ## e.g. mydomain\p_ssas_backup' | |
$credential.Password | ConvertFrom-SecureString | Set-Content $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
CREATE PROCEDURE usp_GetSPParameters @SPName VARCHAR(50) | |
AS | |
BEGIN | |
SET NOCOUNT ON; | |
SELECT | |
Name AS ParameterName, | |
TYPE_NAME(user_type_id) AS DataType, | |
max_length AS CharacterMaxLength, | |
scale AS NumericScale, | |
precision AS NumericPrecision |
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
'Module containing generic functions. Any requisite functions/variables are now annotated | |
'in the routine header, allowing this module to be swapped out more easily | |
' | |
' (c) R Shenoy 30/07/2013 | |
' | |
' Last Updated 16/11/2018 | |
Option Explicit | |
'Used for function that gets screen size |
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
//''------------------------- Language Functions | |
function setLanguage(){ | |
var lang = {dialog.object}.appVars.currentLanguage; | |
if(lang == 'English') { | |
A5.msgBox.buttons.cancel = {html: "Cancel"}; | |
A5.msgBox.buttons.yes = {html: "Yes"}; | |
A5.msgBox.buttons.no = {html: "No"}; | |
} else { |
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
//''------------------------- Validation Functions | |
function isValidDate(s) { | |
var bits = s.split('/'); | |
var d = new Date(bits[2], bits[1] - 1, bits[0]); | |
return d && (d.getMonth() + 1) == bits[1] && d.getDate() == Number(bits[0]); | |
} | |
function validate(data, type, maxLen, req){ | |
//debugger; | |
req = (typeof(req) == 'undefined') ? true : req; |
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
//''------------------------- Authentication Functions | |
function authenticate(){ | |
var data = getLoginDetails(); | |
jQuery.ajax({ | |
type: "GET", | |
url: {dialog.object}.appVars.appURL + "ajax.a5w", | |
timeout: 30000, |
NewerOlder