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 | |
#replace this with your instance name | |
$instanceName = "server\instance"; | |
$srv = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName; | |
$dbName = "DatabaseName" | |
$db = $srv.Databases.Item($dbName) | |
# Stops the all processes on the specified database. |
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
# Prerequisites | |
# Not required for Windows Server 2012 | |
# Custom pre-installation scripts | |
# Create Directories before running setup! | |
MD "X:\Program Files\Microsoft SQL Server" | |
MD "X:\Program Files (x86)\Microsoft SQL Server" | |
# Setup |
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
Gather SMO exception details | |
function SmoException | |
{ | |
$err = $_.Exception | |
while ( $err.InnerException ) | |
{ | |
$err = $err.InnerException; | |
}; | |
Write-Host $err.Message; | |
} |
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
#Gather SMO exception details | |
function SmoException | |
{ | |
$err = $_.Exception | |
while ( $err.InnerException ) | |
{ | |
$err = $err.InnerException; | |
}; | |
Write-Host $err.Message; | |
} |
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 | |
#replace your with your instance name | |
$instanceName = "server\instance"; | |
$srv = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName; |
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
Configuration MyName { | |
Node NameOfTheSystem { | |
#your instructions | |
} | |
} |
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 | |
#replace your with your instance name | |
$instanceName = "server\instance"; | |
$srv = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName; | |
#replace your with your user database name | |
$dbName = "name_user_db" | |
$db = $srv.Databases[$dbName] |
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
$instanceName = "!instanceName" | |
$databaseName = "!databaseName" | |
#import SQL Server module | |
Import-Module SQLPS -DisableNameChecking | |
function ScriptObject($subject, $scripter) | |
{ | |
if ($subject.IsSystemObject -eq $false) | |
{ |
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 | |
#replace your with your instance name | |
$instanceName = "server\instance"; | |
$srv = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName; |
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
#Win Config | |
Install-WindowsUpdate -AcceptEula | |
Update-ExecutionPolicy Unrestricted | |
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions | |
Enable-RemoteDesktop | |
#Base Apps | |
choco install 7zip.commandline | |
choco install 7zip.install | |
choco install dropbox |