Changing Timezone from command line

It would be the case that you would need to change the time zone on the server but from the Time & Date option, it would be greyed out due to policy. There is a workaround for changing the timezone using the Command Prompt as Administrator.

Type tzutil /g to get the current time zone.





Type tzutil /l to list the available time zones.

Use tzutil /s "<timezone name>" to change the desired timezone.



Fix Remote Desktop Licensing Mode is not configured

Having fully installed Remote Desktop Services (RDS) on a server with the RD Connection Broker and RDS licensing set per user and everything is working with a valid license.

After some time you notice a popup when you connect saying,

Remote Desktop licensing mode is not configured
Remote Desktop Services will stop working in 104 days. On the RD Connection Broker server, use Server Manager to specify the Remote Desktop licensing mode and the license server.

When you open the RD Licensing Diagnoser, you will be prompted with an error saying, The licensing mode for the Remote Desktop Session Host server is not configured.

From the Server Manager under Configure the Deployment and RD licensing, all seem to be configured well.

Open a PowerShell as Administrator on the server and run the following command

$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting

This will show a parameter called SpecifiedLicenseServerList which would be empty as below.

To populate the parameter, use the following command

$obj.SetSpecifiedLicenseServerList("<full fqdn server name>")

After this is done, the RD Licensing Diagnoser parameter should not report any errors. It is suggested to restart the server after this change.

Alternatively, one could do this with registry with the following PowerShell script

# Specify the RDS licensing type: 2 - Per Device CAL, 4 - Per User CAL
$RDSCALMode = 4
$RDSlicServer = "<server full fqdn name>"
# Set the server name and type of licensing in the registry
New-Item "HKLM:\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers"
New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers" -Name SpecifiedLicenseServers -Value $RDSlicServer -PropertyType "MultiString"
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\Licensing Core\" -Name "LicensingMode" -Value $RDSCALMode


Unifi Controller Start-up Failed

When starting up your UniFi controller on your server, you might be prompted with the error saying “Start-up failed” as the screenshot below.

Some might manage to see that the application says that Port 8443 is in use by another application. Some CCTV applications or other web applications installed on the server would use the same port.

Here you would have two choices, you can uninstall the conflicting application or just change the port of the UniFi controller.

To change the port of the UniFi controller, you need to open the file from C:\Users\<user name>\Ubiquiti UniFi\data.

Remove the hash from the below lines and change the port to 8445 and both lines should be as below.


Save the file and close Notepad. Open the UniFi Controller and the issue will be resolved and the service will start with no issues.




PGAdmin, cannot register new server Instance Server at, is not persisted

You might encounter the following error while registering a new server in PG Admin.

Instance '<Server at <guid>>' is not persisted.

The issue is mostly due to uninstalling and re-installing PG Admin or installing a different version of PG Admin.

The resolution would be the following.

  • Close PGAdmin
  • Browse to C:\Users\<your user>\AppData\Roaming
  • Delete the folder PGAdmin
  • Open PGAdmin

This will resolve the issue


SQL How to empty all tables in a database

You might need to purge all the data in all the tables in a particular database. For this we can use the following script.

USE <database name>
DECLARE table_cursor CURSOR
AND TABLE_NAME LIKE '%_Partition%'
OPEN table_cursor
FETCH NEXT FROM table_cursor INTO @TableName
SET @SQLText = 'TRUNCATE TABLE ' + @TableName
EXEC sp_executeSQL @SQLText
FETCH NEXT FROM table_cursor INTO @TableName
CLOSE table_cursor
DEALLOCATE table_cursor


Fix: Storage Replica warning Events 10448 Storage Replica has failed an application IO

When checking the logs of the Storage Replica on a Windows Server 2016, 2019 or 2022, using the below command, you get the error saying that Storage Replica has failed an application IO.

Get-WinEvent -ProviderName Microsoft-Windows-StorageReplica -max 20

In this case, the replication is not working and there are no other issues pointing to what could be the problem. In my case the solution was to restart the Storage Replica service from the services.msc. After this, I ran the Get-WinEvent command again and it was replicating again.



Server Manager refresh failed error

When opening Server Manager on the server, in the notifications you will see an error stating Refresh Failed.

At this stage, you will not be able to add any features to the server and you will not be able to add or remove windows features.

A pop-up about collecting inventory data and a refresh error saying “Configuration refresh failed with the following error: Invalid class” will show.

Before proceeding you can take a backup of this by using the command below
winmgmt /backup %computername%_MM_DD_YEAR.WMI_backup

To fix the problem you would need to do the following in a command prompt as Administrator.

winmgmt /verifyrepository
winmgmt /salvagerepository
winmgmt /resetrepository

This will resolve the problem and when you relaunch the Server Manager, you will be able to add the features with no issues.


Install Module with PowerShell: NuGet Unable to download, check your internet connection

While installing the NuGet PowerShell module, you will get the following error

WARNING: MSG:UnableToDownload «» «»
WARNING: Unable to download the list of available providers. Check your internet connection.
WARNING: Unable to download from URI '' to ''.
Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.
At line:1 char:1
+ Install-PackageProvider -Name NuGet -MinimumVersion -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-PackageProvider], Exception
+ FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider

To resolve the problem open a PowerShell window as Administrator and enter the following command.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

This will resolve the problem temporarily as if you would run the command again, it will still prompt the same problem. To resolve the issue permanently, you need to update the registry by running the below command to update the registry.

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord

Close all PowerShell windows and try again with the following command to confirm that the protocol has been updated.



Search and Restore file from SharePoint Online using PowerShell

When having SharePoint Online, one can easily recover items from the Recycle Bin, but unfortunately, there is no search facility for the Recycle Bin from the web interface. We can use PowerShell to easily search for the item.

To be able to connect, we need to install the new module, Open a PowerShell window and use the below to install the module.

Install-Module -Name PnP.PowerShell

If you would have an older version already installed, you need to use the below command to remove the old module, and then install the module as above.

Uninstall-Module -Name SharePointPnPPowerShellOnline -AllVersions -Force

To connect with the SharePoint Online site, we need to use the following command which will ask us to allow the script to communicate along with the Multi-Function Authentication (MFA).

Connect-PnPOnline -Url "Enter the SharePoint URL here" -Interactive

To extract the specified SharePoint Online Recycle Bin, you need to use the following command to output to the screen. Change the RowLimit to set the maximum results.

Get-PnPRecycleBinItem -RowLimit 50 | Select Title, ItemType, Size, ItemState, DirName, DeletedByName, DeletedDate | Format-table -AutoSize

To export the results to a CSV, you need to add the Export-CSV at the end as below

Get-PnPRecycleBinItem -RowLimit 50 | Select Title, ItemType, Size, ItemState, DirName, DeletedByName, DeletedDate | Export-Csv "C:\Temp\RecycleBin.csv" -NoTypeInformation

To restore a specific file, you cannot just specify the name, as you need to get the item information. We need to use the following commands

$itemtorestore=Get-PnPRecycleBinItem | ? -Property Title -EQ "filename of the deleted file"
Restore-PnpRecycleBinItem -Identity $itemtorestore -Force

This will restore the file to its original location.