Infrastructure at your Service

PowerShell Archives - Blog dbi services

Stéphane Savorgnano

Pass Summit 2017

By | Database Administration & Monitoring | No Comments

Today starts the Pass Summit 2017 taking place in Seattle. After a small fly over the Ocean, more than 10 hours… yesterday, and a nice jet lag which avoid me to sleep later than 4AM this morning, I arrived to the Convention Center in Seattle where the Pass takes place. I start this first day by the session of Itzik Ben-Gan: T-SQL Tips and Tricks. As part of the session, Itzik spoke about batch processing…

 
Read More
Stéphane Haby

Live from SQL Saturday Slovenia 2016!

By | Technology Survey | No Comments

After a little trip, just 1-hour flying from Zürich to Ljubljana yesterday, the SQL Saturday Slovenia 2016 begins this morning at the Faculty of Computer and Information Science of the University of Ljubljana… I needed to wake up very fast because my session was the first of the day at 9:00 AM. I also very happy to meet and to share my expertise with Slovenian and other SQL Server experts. My session was about the…

 
Read More
Nathan Courtine

Manage Azure in PowerShell (RM)

By | Database Administration & Monitoring, Hardware & Storage, Operation systems | No Comments

Azure offers two deployment models for cloud components: Resource Manager (RM) and Classic deployment model. Newer and more easier to manage, Microsoft recommends to use the Resource Manager. Even if these two models can exist at the same time in Azure, they are different and managed differently: in PowerShell cmdlets are specific to RM. In order to be able to communicate with Azure from On-Premises in PowerShell, you need to download and install the Azure…

 
Read More
Nathan Courtine

Generate Azure VM with Resource Manager deployment in PowerShell

By | Database Administration & Monitoring, Hardware & Storage, Operation systems | No Comments

Recently, there is a new way to manage the Azure infrastructure with Resource Manager. It brings many advantages regarding the classic deployment. The differences between these two deployments will not be covered in this blog because it is not the initial goal, and it already exists a very good Microsoft topic on this subject. In this blog, we will generate a new Windows Azure Virtual Machine using Resource Manager deployment with PowerShell from On-Premise. Remember,…

 
Read More
Stéphane Haby

SQL Server 2016: New SQL PowerShell CMDLETs for ErrorLog

By | Database Administration & Monitoring | No Comments

With the latest release of SQL Server Management Studio(SSMS) 2016 (13.0.15500.91), downloadable here, was introduced new CMDLETs for Always Encrypted, SQL Agent and the  ErrorLog. In this article, I will present you the 2 new CMDLETs for the Error Logs: Get-SqlErrorLog: Retrieves the SQL Server Logs. Set-SqlErrorLog: Sets or resets the maximum number of error log files before recycling. My first step is to search all commands with “Sql”: Get-Command | Select Name |Where-Object {$_.Name…

 
Read More
Stéphane Haby

Set the SQL Native Client Default Port with PowerShell

By | Database Administration & Monitoring | No Comments

I written an article about “SQL Server 2012: Configuring your TCP Port via PowerShell” and I received a question from PaulJ: “How do you set the port for the SQL Native Client 11.0 Configuration (32bit) – as seen in the SQL Configuration Manager?” This is a very good question and I decide to write this blog as an answer to this question. The first step is always the same, initialization of my object: [reflection.assembly]::LoadWithPartialName(“Microsoft.SqlServer.SqlWmiManagement”) |…

 
Read More
Stéphane Savorgnano

SCOM: schedule group maintenance task with PowerShell

By | Database Administration & Monitoring, Operation systems, Technology Survey | No Comments

In my last blog post, here, I spoke about how to place SCOM group in maintenance mode. This script is really interesting with an integration in Windows Task Scheduler. At the end, the main purpose is to plan a maintenance window of our different servers. Let’s see how we can do that with PowerShell script. First, I try to use the cmdlet Register-ScheduledTask, which can be used to register a scheduled task definition on a…

 
Read More
Stéphane Savorgnano

SCOM: change group state to maintenance mode with PowerShell

By | Database Administration & Monitoring, Database management, Operation systems, Technology Survey | No Comments

Some weeks ago, I wrote a blog post about the creation of SCOM groups in order to subscribe to alerts. Subscribe to alert is mandatory, of course, to be able to receive alerts concerning our group. But during operations like an update, a patching, …, we don’t want to be spoiled by lots of alerts. To avoid those unexpected Emails, we need to place our group and so, objects contained in this group, in maintenance…

 
Read More
Nathan Courtine

syspolicy_purge_history job and PowerShell ExecutionPolicy

By | Database Administration & Monitoring | No Comments

Since SQL Server 2008, Microsoft has introduced a system job called “syspolicy_purge_history”. This job is installed and enabled by default, and it contains three steps scheduled at 02:00 AM:   What is this job? And what is it for? Since SQL Server 2008, a new feature called Policy Based Management has been added. When your policies are run, the results are stored in the msdb. But without a purge mechanism, msdb will keep growing. So…

 
Read More
Nathan Courtine

Configurer les “Bonnes Pratiques” de Windows Server avec PowerShell

By | Database Administration & Monitoring | No Comments

PowerShell est un outil en ligne de commande dorénavant intégré à tous les environnements Windows. Cet outil est extrêmement puissant, et avec le vent en poupe, puisqu’il permet de simplifier l’exécution et l’automatisation des tâches de configuration et d’administration. Dans mon travail d’Administrateur de bases de données, j’effectue de nombreux Audits d’environnements afin de vérifier, par exemple, si les bonnes pratiques sont bien appliquées. C’est pourquoi j’ai été très vite confronté à PowerShell, afin de…

 
Read More