Archive for the ‘SQL’ Category

Remote manage a SQL environment with PowerShell

woensdag, augustus 26th, 2015

downloadIn this article I want to talk about managing a SQL 2012 Server with PowerShell from a remote computer. As I’ve mentioned in an earlier blog post PowerShell is becoming more and more important in the day to day task of a system administrator.

I am using PowerShell ISE as scripting application. It is a simple scripting tool but it does everything I need at this time to make my PowerShell work easy.


$fldr = "C:\users\robin\Documents\PowerShell\data"
$credential = Get-Credential
$credential.Password | ConvertFrom-SecureString | Set-Content "$fldr\adminpassword.bin"
$password = Get-Content "$fldr\adminpassword.bin" | ConvertTo-SecureString
$cred = New-Object System.Management.Automation.PSCredential("contoso\adminrobin", $password)
New-PSSession -Name SQL -ComputerName -Credential $cred
Enter-PSSession -Name SQL


How to add a SQL database without the LDF file

dinsdag, januari 6th, 2015

SQL-Server-2012 Today I want to add a SQL database to the SQL server in my lab environment. The database I want to add is a sample database that I want to import in my environment to test some query’s.