2

today I had to check if in-transit Encryption was up and running in a particular server (sql server) and if not then set it up.

the way it is done is:

In SQL Server Configuration Manager, expand SQL Server Network Configuration, right-click Protocols for , and then select Properties. On the Flags tab, in the ForceEncryption box, select Yes, and then select OK to close the dialog box. Restart the SQL Server service.

the picture below is after I restarted the sql server service.

enter image description here

now, I am one DBA that likes DBA paradise, and all automation and things done through scripts.

How could I get this done through scripts? partial solutions also valid. and it could be powershell,T-SQL, or any other scripting language.

Marcello Miorelli
  • 17,274
  • 53
  • 180
  • 320

1 Answers1

4

Looking at the documentation (I haven't tried this CmdLet myself), it seems like DBATools can do this for you, using below CmdLet. And, since the source for DbaTools is available, you can probably get further hints by reading the source code if you don't like that DbaTools module.

https://docs.dbatools.io/Enable-DbaForceNetworkEncryption

Ronaldo
  • 6,017
  • 2
  • 13
  • 43
Tibor Karaszi
  • 18,269
  • 2
  • 17
  • 30