Author: Bastiaan van Leeuwen

Test GPO WMI filter using Powershell

To test a GPO WMI query, use the following command: gwmi -Query ‘WMI Query’ To check the WMI filters needed for operating systems, check this Microsoft article: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc947846(v=ws.10)?redirectedfrom=MSDN

Read More »

Backup all SQL databases

The following script can be used to backup all databases from a SQL server. The system databases are excluded. If any other database should be excluded, add them to the “NOT IN” section. For different date formats in…

Read More »

Administer WID instance with SQL Server Management Studio

Windows Server Update Services (WSUS) can use a Windows Internal Database (WID). This database is manged through WSUS, but occasionally you want to administer this with SQL Server Management Studio. Install SQL Server Management Studion (Express) on the…

Read More »

Reset 120 Day Grace Period for Windows RDS Server with PowerShell

Use the following Powershell script to reset the Grace Period of a Windows RDS Server Because the original script has been removed from the script center ( https://gallery.technet.microsoft.com/scriptcenter/Reset-Terminal-Server-RDS-44922d91), a copy can be found below:

Read More »

NetApp & Powershell – Snapshot Report

source: https://nmanzi.com/netapp-powershell-snapshot-report/ Nathan Manzi has created a powershell script for reporting snapshots on a Netapp. The script below has been altered for a cluster mode instead of a 7 mode. Also, a few parameters have been set to…

Read More »

MsSQL – Backup all SQL Server Databases

source: https://www.mssqltips.com/sqlservertip/1070/simple-script-to-backup-all-sql-server-databases/ Change @Path for the location of the backups. DECLARE @name VARCHAR(50) — database name  DECLARE @path VARCHAR(256) — path for backup files  DECLARE @fileName VARCHAR(256) — filename for backup  DECLARE @fileDate VARCHAR(20) — used for file…

Read More »

MsSQL Backup a Database

Use the following query to backup a MsSQL database. Fill in the correct database name (@name) and backup location (@path). This script uses the date for the filename, so if multiple backups are needed on the same day…

Read More »

Last Logon Date AD Users

source: https://gallery.technet.microsoft.com/scriptcenter/Get-Last-Logon-for-Users-c8e3eab2 The “lastLogon” Active Directory attribute is a property that is not replicated throughout the Domain Controllers.  This attribute is stored on the domain controller that received the authentication request and updated its property accordingly.  Because of…

Read More »

Get Office 365 users with a specific license type via Powershell

It can sometimes be useful to get a list of Office 365 users with a specific license type via PowerShell. Instead of logging into the Office 365 portal and using a filtered view in the admin center, you…

Read More »

Terminal Server Inactive Printer Ports

During the restart of a Terminal Server, inactive TS ports should be deleted. When these inactive ports are not deleted, over time, a server can become sluggish or even hang because of this. When there are a lot…

Read More »