2024-01-23

PowerShell SMO by SqlServer module

Install SqlServer module:

Install-Module -Name sqlserver

Typical warning:

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y


See installed module:

Get-Module -Name SqlServer -ListAvailable


Import SqlServer module in PowerShell session:

Import-Module -Name SqlServer


Create SMO Server object:

$smoServer = New-Object Microsoft.SqlServer.Management.Smo.Server '(local)\SSDB2019'

See SMO Server object information:

$smoServer.Information

2024-01-01

Top-ten posts 2023

2023 was – again – a year with far less posts than planned. Fortunately some elder posts still generate some activity on this blog.

The top-ten 2023 post list is something like Top-ten posts 2022.

RankMoveRank 2022TitleViewsCreated
101SqlBulkCopy with PowerShell1.9502017-07-30
2>9>10High performance script timer8142020-01-03
3+14ISO 8601 date formatting using PowerShell4792008-08-14
4>7>10ISO 4217 Currency list4252012-06-26
5+38SQL Server Agent schedule owner3602010-02-08
6>5>10Team Foundation Server on a single server3502018-09-19
7-16DBCC CHECKDB with PowerShell3062014-10-09
8>3>10Start shared HTA with PowerShell2712012-09-13
9>2>10VLF count2472011-01-11
10010Audit Log for Analysis Services2042014-01-08

This year there are several new items on the Top-ten. My personal biggest surprise is the item on ISO 4217.
But – still my favority ISO is 8601. The oldest post is more than ten years old, which is I find both interesting and disturbing.

The posts in this blog are personal notes rather than public presentations. This is why I am fine with the low number of views.

2023-11-02

Activate AMD-V in Gigabyte BIOS

 I have replaced my old 1st generation Threadripper with a new Ryzen 9. It was surprisingly smooth and works really good.

The only thing I had to take a minute to fix was a error when starting VMware Workstation about AMD-V not being enabled as required.

Going through the menus in the BIOS on the Gigabyte motherboard I found nothing about "AMD-V". But a quick search on AMD-V revealed that AMD-V has been published as AMD Secure Virtual Machine (SVM). And this I could find in the BIOS menus:

  1. During startup press <Delete> to enter the BIOS.
  2. Select "Advanced Mode (F2)".
  3. Go to "Advanced CPU Settings".
  4. In the Tweeker menu you pick "SVM Mode" and select "Enabled". Then press <Enter>.
  5. Select "Save & Exit" then click "Save & Exit Setup" and finally "Yes".
Now VMware Workstation works like a charm.

2023-09-21

Sandbox Windows Server in VMware Workstation

To create a sandbox installation in VMware Workstation I usually have to start with a Windows Server. I am using VMware Workstation Pro as it makes it possible to build more complex sandbox installations with multiple servers like SQL Server AlwaysOn Availability Groups.

This is a description of the installation and configuration of a general Windows Server to be used in different roles. When the configuration is completed I can clone the virtual machine to build the desired sandbox.

First I download the ISO installation image from Microsoft. Currently it is Windows Server 2023 Standard Edition. To use it I also have to get a license key from my Visual Studio subscription.

Then a new virtual machine is created on the ISO image with the license key. The VM is created with 16 GB memory, 4 vCores and 64 GB hard disk. After installation Windows Update is executed.

Configurations

  • Network adapter: Change to paravirtual adapter „vmxnet3“. This is a off-line operation I have described earlier.
  • Network adapter: Do not allow to turn off device to save energy.
  • Network adapter: Show hidden devices in Device Manager and remove old Intel Gigabit Network Connection.
  • Keyboard: Add Danish keyboard to English profile and remove English keyboard. This is as I live in Denmark.
  • Location: Change to UK and set to UTC to avoid daylight savings etc.
  • Server Manager: Do not start automatic.
  • Print Spooler: Stop and disable service.

Script to do all this will be in SQLAdmin Github.

2023-08-08

Being Effective

Being Effective is often said to be a good thing. And naturally we have an idea of what is effective. But in english there are three different words on different aspects of being effective:

Effectiveness

"Doing the right thing". That is getting the desired result. I usually think of this as not goofing around but focus on the main task.

Efficiency

"Doing things right". That is without waste of time, materials, energy and other resources. And still with success.

Efficacy

"Doing with maximum response". Usually this term is used in pharmacology when maximum response is achieved.

In Danish we only have one word on being effective (Effektiv)...

The three terms are also discussed in the article "The difference between efficacy, effectiveness and efficiency".