Fix: The term ‘Get-MsolUser’ is not recognized as the name of a cmdlet

When connecting to your Office 365 services, you might get the below error saying for any Msol cmdlet like new-msoluser, connect-msolservices and other.

The term 'Get-MsolUser' is not recognized as the name of a cmdlet

To fix this, download and install the Microsoft Online Services Sign-In Assistant for IT Professionals RTW which can be downloaded from this link.

After the installation you can check the installation of the assistant from your control panel. After that open a PowerShell window As Administrator and type.

Install-Module MSOnline -Force

Once done, enter the below

Connect-MsolService

Sign in with your global admin account and presto!

FIX: WINDOWS 10 HOME TO PRO UPGRADE ERROR 0X803FA067

I came across an upgrade issue when I was upgrading Windows 10 Home to Windows 10 Pro using the Change Product Key feature. I first entered the default Windows 10 key from Microsoft VK7JG-NPHTM-C97JM-9MPGT-3V66T to convert the Windows 10 Home to Windows 10 Pro and when I clicked the start button to start the upgrade, I get the error saying that the the installation does not have a valid digital license with the error code Unable to upgrade your edition (0x803fa067).

The solution is very simple

– Boot the computer
– Open the activation screen
– Change the Product Key to VK7JG-NPHTM-C97JM-9MPGT-3V66T
– Disable internet connectivity by disabling network card
– Click start for the upgrade

FIX: RDP ERROR THE FUNCTION REQUESTED IS NOT SUPPORTED

When trying to connect to a server or machine via Remote Desktop Connection you will get the below error which is strange as one would normally connect without any issues.

“Remote Desktop Connection
An authentication error has occurred.
The function requested is not supported
Remote computer: XXX.XXX.XXX.XXX”

After some research I found that this is due to a Windows Update patch which was released recently that is CVE-2018-0886 for RDP. So if the workstation was updated and the server was not yet.

There are two options for this.

Patch the server with the CVE-2018-0886 (Recommended)

Update the policy on the local computer (Not recommended but in case of emergency)

On the computer open Group Policy
Go to Computer Configuration > Administrative Templates > System > Credentials Delegation
Change Encryption Oracle to Remedition to Enabled
Change Protection Level to Vulnerable

Open MSTSC and you will be able to connect to the server.

Review: Kernel for OST to PST

Today I am reviewing Kernel for OST to PST application which in my Opinion, it should be renamed to OST to anything as apart from recovering from corrupted OST files and converting them to PST, you can export to practically anything including Office 365, Google Apps/Gmail, Live/Outlook/Hotmail, Lotus Domino and others. Bearing in mind the fact that there is a good number of businesses going to cloud, it’s a must to have such feature.

Conversion is pretty straight forward, all you need is to select either an OST file with the option to bulk input the file selection. The rest is done with the application. The first pass will just open the file and the other passes on the file will try to recover deleted or corrupted messages, which if you have a healthy file can skip easily. The conversion is pretty fast and reliable keeping in mind it can run on any platform being Windows 7/ 8/ 10 to server editions as well.

You can export to either PST, DBX or MBOX apart from saving to MSG, EML, PDF and other common extensions. The best part of the application was the ability to save directly to email servers such as Office 365, Lotus Domino, various Exchange server versions, Yahoo, Gmail and other. All in one console and with a user friendly interface. This really saves a lot of time as using the conventional way, you would need to use Outlook, export using Outlook to PST. This of course does not recover from corrupted OST so it’s a show stopper. Adding to this then if you want to import to Exchange, you would need to transfer all the exported PSTs to a central location and use the NewMailboxImportRequest keeping in mind that you have Exchange 2010 upwards and this must be done one by one. As stated above with Kernel for OST to PST you will can easily do this with a bulk job and you can also directly import to Exchange of any version or any cloud service of your choice. Adding to this, the application also scans the OST file for deleted and recoverable items from corruption.

From my experience I have gone through a number of problem-solving with regards to Exchange, but one time I was called in to assist with a corrupted EDB file and broken down Exchange server. Rebuilding the Exchange server was an easy task but re-importing the data was going to be an issue. With Kernel for OST to PST, I was able to copy all OST files from the computers to a central location and I was able to convert the OST files and import them directly to Exchange using Kernel for OST to PST. This incident had 20 mailboxes, but the software has saved me a lot of time and costs which would ended up in more downtime and recovery time for the client.

The software is easy to use and the export features are straight forward with minimal administration effort. It saved me a lot of time and stress and it is recommended for such operations. Pricing varies depending on what features you would need. The Personal license costs $99 with the option to go for Home license which give you the ability to install on various computers respectively costing $199. These two version will give you the ability to convert OST files to PST. If you want to upload OST files directly to Exchange and cloud, you would need to purchase the Corporate license for $299 and if you want all features including conversion of multiple OST files in bulk you need to purchase the Technician version which costs $399. More information on the website of Kernel For OST to PST.

Fix: BEGIN TRY does not work with BULK INSERT on SQL

I have created a stored procedure that does a BULK IMPORT. I wanted to add a bit of fault checking and added a BEGIN TRY and a BEGIN CATCH so that it sends an email with the error message if the T-SQL fails. The problem is that the BEGIN CATCH was being skipped and the procedure stops processing with the below error message.

Msg 4860, Level 16, State 1, Line 2
Cannot bulk load. The file "C:\temp\fileimport.txt" does not exist.

To fix the issue what I did is to add the BULK INSERT command in a variable and execute it. This way, the BEGIN CATCH is not ignored or skipped.

Fix below

BEGIN TRY
DECLARE @bulkimport varchar(1000)
SET @bulkimport = 'BULK INSERT mytable FROM ''C:\temp\fileimport.txt''
WITH (FIELDTERMINATOR = ''*'', ROWTERMINATOR = ''\n'')'
EXECUTE (@bulkimport)
END TRY

BEGIN CATCH
SELECT error_message()
END CATCH

Fix: Windows 10 Home to Pro upgrade error 0x803fa067

I came across an upgrade issue when I was upgrading Windows 10 Home to Windows 10 Pro using the Change Product Key feature. I first entered the default Windows 10 key from Microsoft VK7JG-NPHTM-C97JM-9MPGT-3V66T to convert the Windows 10 Home to Windows 10 Pro and when I clicked the start button to start the upgrade, I get the error saying that the the installation does not have a valid digital license with the error code Unable to upgrade your edition (0x803fa067).

The solution is very simple

– Boot the computer
– Open the activation screen
– Change the Product Key to VK7JG-NPHTM-C97JM-9MPGT-3V66T
– Disable internet connectivity by disabling network card
– Click start for the upgrage

How to: Execute DOS commands from T-SQL

Sometimes you might have the need to execute a copy, delete or run a batch file from a stored procedure. This can be done by using the xp_cmdshell and execute your command line.

This can be done as below

EXECUTE master..xp_cmdshell 'copy c:\test.txt c:\test1.txt'

You can run it using parameters as below

DECLARE @sql VARCHAR(200)
SET @sql = 'copy c:\test.txt c:\test1.txt'
EXECUTE master..xp_cmdshell @sql

If you are running the xp_cmdshell and get the error "SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server." Follow the code below to enable the feature.

EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'xp_cmdshell', 1;
GO
RECONFIGURE;
GO

How to: Sync SQL users from one server to another

When you have SQL Clustering with Always On, the databases are sycnhronised and the failover works like a charm. The only problem is that the logins are not synchronized from one server to another. To export the current users and import to another server, on the main server execute the below T-SQL.

USE master
GO
IF OBJECT_ID ('sp_hexadecimal') IS NOT NULL
DROP PROCEDURE sp_hexadecimal
GO
CREATE PROCEDURE sp_hexadecimal
@binvalue varbinary(256),
@hexvalue varchar (514) OUTPUT
AS
DECLARE @charvalue varchar (514)
DECLARE @i int
DECLARE @length int
DECLARE @hexstring char(16)
SELECT @charvalue = '0x'
SELECT @i = 1
SELECT @length = DATALENGTH (@binvalue)
SELECT @hexstring = '0123456789ABCDEF'
WHILE (@i <= @length) BEGIN DECLARE @tempint int DECLARE @firstint int DECLARE @secondint int SELECT @tempint = CONVERT(int, SUBSTRING(@binvalue,@i,1)) SELECT @firstint = FLOOR(@tempint/16) SELECT @secondint = @tempint - (@firstint*16) SELECT @charvalue = @charvalue + SUBSTRING(@hexstring, @firstint+1, 1) + SUBSTRING(@hexstring, @secondint+1, 1) SELECT @i = @i + 1 END SELECT @hexvalue = @charvalue GO IF OBJECT_ID ('sp_help_revlogin') IS NOT NULL DROP PROCEDURE sp_help_revlogin GO CREATE PROCEDURE sp_help_revlogin @login_name sysname = NULL AS DECLARE @name sysname DECLARE @type varchar (1) DECLARE @hasaccess int DECLARE @denylogin int DECLARE @is_disabled int DECLARE @PWD_varbinary varbinary (256) DECLARE @PWD_string varchar (514) DECLARE @SID_varbinary varbinary (85) DECLARE @SID_string varchar (514) DECLARE @tmpstr varchar (1024) DECLARE @is_policy_checked varchar (3) DECLARE @is_expiration_checked varchar (3) DECLARE @defaultdb sysname IF (@login_name IS NULL) DECLARE login_curs CURSOR FOR SELECT p.sid, p.name, p.type, p.is_disabled, p.default_database_name, l.hasaccess, l.denylogin FROM sys.server_principals p LEFT JOIN sys.syslogins l ON ( l.name = p.name ) WHERE p.type IN ( 'S', 'G', 'U' ) AND p.name <> 'sa'
ELSE
DECLARE login_curs CURSOR FOR

SELECT p.sid, p.name, p.type, p.is_disabled, p.default_database_name, l.hasaccess, l.denylogin FROM
sys.server_principals p LEFT JOIN sys.syslogins l
ON ( l.name = p.name ) WHERE p.type IN ( 'S', 'G', 'U' ) AND p.name = @login_name
OPEN login_curs

FETCH NEXT FROM login_curs INTO @SID_varbinary, @name, @type, @is_disabled, @defaultdb, @hasaccess, @denylogin
IF (@@fetch_status = -1)
BEGIN
PRINT 'No login(s) found.'
CLOSE login_curs
DEALLOCATE login_curs
RETURN -1
END
SET @tmpstr = '/* sp_help_revlogin script '
PRINT @tmpstr
SET @tmpstr = '** Generated ' + CONVERT (varchar, GETDATE()) + ' on ' + @@SERVERNAME + ' */'
PRINT @tmpstr
PRINT ''
WHILE (@@fetch_status <> -1)
BEGIN
IF (@@fetch_status <> -2)
BEGIN
PRINT ''
SET @tmpstr = '-- Login: ' + @name
PRINT @tmpstr
IF (@type IN ( 'G', 'U'))
BEGIN -- NT authenticated account/group

SET @tmpstr = 'CREATE LOGIN ' + QUOTENAME( @name ) + ' FROM WINDOWS WITH DEFAULT_DATABASE = [' + @defaultdb + ']'
END
ELSE BEGIN -- SQL Server authentication
-- obtain password and sid
SET @PWD_varbinary = CAST( LOGINPROPERTY( @name, 'PasswordHash' ) AS varbinary (256) )
EXEC sp_hexadecimal @PWD_varbinary, @PWD_string OUT
EXEC sp_hexadecimal @SID_varbinary,@SID_string OUT

-- obtain password policy state
SELECT @is_policy_checked = CASE is_policy_checked WHEN 1 THEN 'ON' WHEN 0 THEN 'OFF' ELSE NULL END FROM sys.sql_logins WHERE name = @name
SELECT @is_expiration_checked = CASE is_expiration_checked WHEN 1 THEN 'ON' WHEN 0 THEN 'OFF' ELSE NULL END FROM sys.sql_logins WHERE name = @name

SET @tmpstr = 'CREATE LOGIN ' + QUOTENAME( @name ) + ' WITH PASSWORD = ' + @PWD_string + ' HASHED, SID = ' + @SID_string + ', DEFAULT_DATABASE = [' + @defaultdb + ']'

IF ( @is_policy_checked IS NOT NULL )
BEGIN
SET @tmpstr = @tmpstr + ', CHECK_POLICY = ' + @is_policy_checked
END
IF ( @is_expiration_checked IS NOT NULL )
BEGIN
SET @tmpstr = @tmpstr + ', CHECK_EXPIRATION = ' + @is_expiration_checked
END
END
IF (@denylogin = 1)
BEGIN -- login is denied access
SET @tmpstr = @tmpstr + '; DENY CONNECT SQL TO ' + QUOTENAME( @name )
END
ELSE IF (@hasaccess = 0)
BEGIN -- login exists but does not have access
SET @tmpstr = @tmpstr + '; REVOKE CONNECT SQL TO ' + QUOTENAME( @name )
END
IF (@is_disabled = 1)
BEGIN -- login is disabled
SET @tmpstr = @tmpstr + '; ALTER LOGIN ' + QUOTENAME( @name ) + ' DISABLE'
END
PRINT @tmpstr
END

FETCH NEXT FROM login_curs INTO @SID_varbinary, @name, @type, @is_disabled, @defaultdb, @hasaccess, @denylogin
END
CLOSE login_curs
DEALLOCATE login_curs
RETURN 0
GO

Once this is done, run the below T-SQL on the main SQL server

EXEC sp_help_revlogin

This will output the script to be used on the replica server. Copy the output and paste it on the connection to the replica server. After executing you will find the users with the same password from the main server.

Review: Stellar Phoenix Mailbox Exchange Recovery

Recovering data and mailboxes from Microsoft Exchange EDB databases can sometime be a nightmare. I came across the software from Stellar Phoenix called Mailbox Exchange Recovery and for a small software, I managed to solve huge problems while minimising the time of recovery and the time effort to recover the mailboxes/items or EDB databases versus the conventional tools available.

Apart from solving the problems I had, Stellar Phoenix Mailbox Exchange Recovery is a simple to use software. When you open it, you just point the software to the EDB file and it will automatically scan the EDB file to list the mailboxes. Depending on the corruption of the EDB database you can choose between Quick Scan or Extensive Scan. Once the scan is complete, you will get a full preview of all mailboxes in the database with the facility to browse in the actual folders. Apart from that you can also have a preview of the email you are looking at in the right pane. With this software you can also scan and export from multiple EDB files if you have multiple departments and create an EDB for each one.

If you have a specific recovery criteria from the user, you can easily filter by To, From, CC, Subject, Body, Attachment, Importance and Item Type; apart from the date range. There are various export options you ca use which some are PST, MSG, EMAIL. It came very useful when I had to recovery mails or mailboxes from a decommissioned Exchange Server, where I just restored the EDB file and exported all the mailboxes to PST in one go. This version of Stellar Phoenix Mailbox Exchange Recovery can server also in migration projects to Office 365, where for example I found it very useful with Exchange 2007 clients migration to Office 365 and apart from exporting all mailboxes to PST was very easy and fast. On the other hand, you can easily restore the mailboxes to a live EDB file or directly to an Office 365 tenant. Really came in handy for a client who was migrating to Office 365 from a Exchange 2007. The solution was to export all mailboxes to PST, upload them and importing them through Office 365 portal but then this software allowed me to open the EDB file and export/import the mailbox directly to Office 365 without any hassle with all the calendar, tasks ad folder structure the user had in his on-premise solution. So apart from a recovery tool, I found it an excellent tool for migration tasks.

To cut story short, you can go with the repair, scan and use other applications to recover a corrupted EDB, but to be honest why would you end up with a huge amount of time scanning and repairing where you can easily use this software to recover you data and not having raging users waiting to access their precious emails? With Stellar Phoenix Mailbox Exchange Recovery, one can easily create a new EDB file containing new mailboxes, export all mailboxes to PST using the application and restore business in no time.

In conclusion this is a great tool to have if you have Microsoft Exchange servers or if you are in a position to migrate to Office 365. The software is so easy to use and for the price, it’s really worth the money starting from $399 to $999 depending on the license needs. If you are still indecisive, you can always download the trial to check if your EDB file is recoverable. The software supports Exchange 2016 downwards to Exchange 5.5.

Check the software on the link below and get your trial now

https://www.stellarinfo.com/edb-exchange-server-recovery.htm

How to: Find the installation date of an operating system

Sometimes I would need to find the date when the operating system was installed. Thou it’s difficult to have everything in shape with your inventory, if you have missed this part when an Operating System was installed, here’s a PowerShell solution to that.

Open PowerShell as admin
Type $osdate = get-wmiobject win32_operatingsystem
Type $osdate.ConvertToDateTime($os.InstallDate) -f "MM/dd/yyyy"

This will give you the date when the Operating System was installed

On the other hand, if you wish to go through registry yourself, browse to the location below

HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate

The result is in timestamp, so you need to convert it with this link.