PowerShell

SQLServerCentral Article

Generate Role Member Reports using dbatools and the ImportExcel PowerShell modules

  • Article

Being able to get information and save it on a Excel as a report can be a common and tedious task. What if we could join dbatools and ImportExcel PorwerShell modules to accomplish this in a easier and fast way? We will see how to export roles and its' member and save that info on a multi spreadsheet Excel file with handy tables ready to be explored.

5 (2)

You rated this post out of 5. Change rating

2020-06-30

6,175 reads

Technical Article

Monitor basic Database parameters like Recovery Model, Page Verify, Auto Close, Auto Shrink, DB Owner, Auto Create Statistics Enabled, DB Create Date etc with PowerShell command.

  • Script

I have created this script for one of our client, the requirement was all the databases should be in full recovery model and should be monitored. Also, I added other important parameters like AutoShrink, AutoClose etc. Output:

5 (2)

You rated this post out of 5. Change rating

2020-06-16

1,027 reads

Technical Article

Powershell Script - Azure cosmos DB(SQL API)

  • Script

Scripts contains 4 following functions. Users can create 3 different script from this for inserting, fetching and deleting a document.
1. Function Generate-MasterKeyAuthorizationSignature - This function is used to create connection to Azure cosmos DB. This function codes were taken from Technet.
2. Function Post-CosmosDb - Insert single document in azure cosmos DB. Same function can be used to perform bulkinsert. This function code was taken from following article. To make it useful i made some modification in it.
(https://www.systemcenterautomation.com/2018/06/cosmos-db-rest-api-powershell/)
3. Function Get-CosmosDocument - Fetch single document from azure cosmos DB. Same function can be used to fetch all documents from Cosmos DB.
4. Function Delete-CosmosDbDocument - Delete single document from cosmos DB. Same function can be used to delete more than one document with some additional codes.

To use any of the function like Post,Get, Delete. you have to comment the other 2 function call. If you are using all 3 functions(Post,Get, Delete), Be cautious while using them.

You rated this post out of 5. Change rating

2020-05-11 (first published: )

3,536 reads

Technical Article

Output multiple datasets from one INVOKE-SQLCMD command

  • Script

A common question that I've seen online is how do I return multiple sql datasets from a single query using INVOKE-SQLCMD. Most of the answers out there say it is not possible, but it is in fact possible by using the OutputAs dataset parameter. This parameter outputs a dataset that has all of the information […]

You rated this post out of 5. Change rating

2020-04-24 (first published: )

6,207 reads

Technical Article

A simple powershell script to look up server hardware and OS information

  • Script

This is a simple powershell script to query and display hardware and OS information from a remote computer.

It uses CIM (Common Information Model) that is available since Powershell version 3 so as long as you have version 3 and up, you should be able to run this script against any server that you have access to.

You rated this post out of 5. Change rating

2019-08-14 (first published: )

2,170 reads

Blogs

Migrate datetime data to datetimeoffset with AT TIME ZONE

By

I recently reviewed, worked on, and added a similar example to the DATETIMEOFFSET Microsoft...

The Comprehensive Guide to Mastering Your SQL DBA Skills

By

Database administrators (DBAs) are the backbone of data-driven organizations. If you're looking to break...

Friday Basics: Authentication vs. Authorization

By

Another security fundamentals topic is authentication versus authorization. For those who have a clear...

Read the latest Blogs

Forums

Thesis help services

By rawiyafarran

Thesis help services offer expert guidance and topic selection to final submission. They provide...

Take Care

By Grant Fritchey

Comments posted to this topic are about the item Take Care

Performance

By LearningDBA

Experts, I am learning some skills so I can troubleshoot some performance-related issues. I...

Visit the forum

Question of the Day

Two Table Hints

What happens when I run this code:

SELECT
  p.ProductName
, p.ProductCategory
FROM dbo.Product AS p WITH (NOLOCK, TABLOCK);

See possible answers