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
Import-Module SQLPS -DisableNameChecking -EA 0 | |
# Get the current date | |
$date = Get-Date -Format yyyyMMdd | |
# Set location of backup files | |
$backupPath = "J:\Backups" | |
$sqlInstance = $env:COMPUTERNAME | |
# Grab the Databases | |
$dbNames = Get-ChildItem "SQLSERVER:\SQL\$sqlInstance\DEFAULT\Databases" | Select Name | |
# Backup the Databases | |
foreach ($dbName in $dbNames) { |
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
Import-Module SQLPS -DisableNameChecking -EA 0 | |
$dbName = "deleteme" | |
$mdfNewLocation = "G:\Data" | |
$ldfNewLocation = "H:\Logs" | |
$sqlSA = "sqlSA" | |
$domain = $env:USERDOMAIN | |
$sqlSA = $domain + "\" + $sqlSA | |
$location = Get-Location |
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
$destPath = "C:\tempDownloads" | |
$sp2016preReqPath = Get-Content "$destPath\sp2016preReqPath.txt" | |
Start-Process "$sp2016preReqPath\PrerequisiteInstaller.exe" -ArgumentList ("/continue /unattended") -Wait |
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
# set varibles | |
$sp2016Location = "D:\" # Change to folder location of SharePoint prerequisiteinstaller.exe file | |
$destPath = "C:\tempDownloads" | |
$sp2016preReqPath = Get-Content "$destPath\sp2016preReqPath.txt" | |
Import-Module Servermanager | |
#region Create variable paths and copy files | |
$sp2016preReqPath = $sp2016preReqPath.TrimEnd('\') | |
$sp2016Location = $sp2016Location.TrimEnd('\') |
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
Import-Module BitsTransfer | |
$destPath = "C:\tempDownloads" # Change this to desired download destination path | |
$destPath = $destPath.TrimEnd('\') | |
#region validate download path | |
function validatePath($destFolder){ | |
## Check that the path entered is valid | |
If (!(Test-Path $destFolder -Verbose)) { | |
New-Item -Path $destFolder -ItemType Directory |
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
#region Create Server 2012R2 Features Array | |
function getServer2012R2Features { | |
$windows2012R2Features = @( | |
"Application-Server", | |
"AS-NET-Framework", | |
"AS-Web-Support", | |
"FileAndStorage-Services", | |
"Storage-Services", | |
"Web-Server", | |
"Web-WebServer", |
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
$serverName = "SQL03" | |
$vmName = "3- SQL03" | |
$vmDest= "G:\VMs\$serverName\" | |
$isoName = "z_Master-Server2012R2-Standard.vhdx" | |
$isoPath = "D:\_Images\" | |
# VM Host Name | |
$computerName = "Host-HP-01" | |
# Network | |
$switchName = "pcDemo-1" |
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
$domain = "contoso.local" | |
$newName ="SQL03" | |
$OUPath = # to put computer in specific OU | |
$prefixLength = 24 # PrefixLength of 24 equals a subnet mask of 255.255.255.0 | |
# Update Description | |
Write-Host -ForegroundColor Green "Updating server description..." | |
$desc = Get-WmiObject -Class Win32_OperatingSystem | |
$desc.Description = $newName | |
$desc.put() |
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
# Active Directory Module for PowerShell feature needs to be installed | |
# spAccounts.csv can be downloaded from: http://1drv.ms/1bHTZC0 | |
Import-Module ActiveDirectory -EA 0 | |
# Create AD Users and Groups | |
#region Parameters | |
$file = "C:\DevOps\Microsoft\SQL Server 2014\config\spAccounts.csv" |