Views:

NOTE: This is intended for  customers who have full SQL Support resources from IT professionals. This article provides steps to check-in a Mobile workstation when the customer sees this error message:

The error occurs because the Mobile license has been released on the server, which is known to happen when a MET/TEAM administrator has forcefully kicked off Mobile users from the Help -> About screen.

1) Backup the METTEAM-Mobile Database on the Mobile Laptop to a secure location that won't be overwritten. Follow this article for instructions: 

How to manually back up a MET/TEAM database

2) Get the Export Date for the Check-Out

Open SSMS and connect to the server's SQL Instance. Execute the script below, making sure to enter the computer name of the mobile workstation within the single quotes on the first line. Save the value that is returned; it will be used later on in this guide.

DECLARE @computer_name NVARCHAR(15) = 'mobile_laptop_name_here'
SELECT TOP 1 ph.nPackageHistoryUID
FROM dbo.PackageHistory ph
    INNER JOIN dbo.Workstations w
    ON ph.nWorkstationUID = w.nWorkstationUID
WHERE ph.nPackageType = 3
  AND tExportDate IS NOT NULL
  AND ph.lActive <> 0
  AND ph.lDeleted = 0
  AND w.cWorkstationName = @computer_name
ORDER BY ph.tAddTime DESC

3) Use the following query in SSMS to determine the Workstation record we need to update.

SELECT *
FROM Workstations
WHERE tCheckoutDate IS NOT NULL
  AND lDeleted = 0
ORDER BY tUpdateTime DESC

4) Use the query below to update the record using appropriate nWorkstationUID from step 3 above and replacing the “###”.

UPDATE Workstations
SET tCheckoutDate = NULL, tUpdateTime = GETUTCDATE(),
    tMobileTime = GETUTCDATE()
WHERE nWorkstationUID = ### 

Now that the important data is backed up and we have the workstations unique identifier we can clean up the Mobile Workstation.  These next few steps are done on the Mobile Laptop: 

5) Delete the MET/TEAM MOBILE Database from the database list in SSMS

6) Remove The MET/TEAM mobile website  from the workstation

  1. Open Internet Information Services (IIS) on the laptop.
  2. Expand out the computer name (TEST-PC in the screen shot below).
  3. Expand the Sites folder.
  4. Right-click on the “MetTeam-Mobile-###” site and select “Remove”.

7) Remove The MET/TEAM mobile entry from the Application Pools

  1. a)  In IIS, select Application Pools in the tree on the top left.
  2. b) Select “MetTeam-Mobile ###” in the Application Pools grid and then click “Remove” in the actions on the right (see screen shot below).

 

8) Confirm deletion of site and its files using file explorer by browsing to C:\inetpub\wwwroot – if METTEAM-Mobile #### still exists, delete the folder.

9) Delete the Desktop Shortcut for MET/TEAM Mobile

10) Perform a Fresh Mobile Check-Out

Now that the mobile workstation has been cleaned up, perform a new check-out on the device. It does not matter what facilities are selected for this since we ultimately just want the server to assign a fresh license to the workstation and a new Mobile website to be installed.

11) Restore the database

Once the new check-out has completed, restore the METMOBILE backup that was taken in step 1 over the new mobile workstation database. Follow this guide for further instructions:

 How to manually restore a MET/TEAM database

12) Set the tExportDate

Open SSMS and connect to the server's SQL instance. Execute the script below – Making certain to select the right script for the version running (<2.2.0 or 2.2.0 and above) and replacing the ### on the first line with the UID value that was copied in step 3. Running this will trick the server into thinking that this new check-out occurred during the time frame of the original check-out.

STOP HERE – Verify the version you are running:

This script should be used ONLY for MET/TEAM 2.2.0 and later, where <PackageHistoryUID> is replaced with the UID from Step #3

--start script

DECLARE @prev_uid uniqueidentifier = '<PackageHistoryUID>'
DECLARE @computer_name NVARCHAR(15) =

(
SELECT w.cWorkstationName
FROM dbo.Workstations w
INNER JOIN dbo.PackageHistory ph
ON w.nWorkstationUID = ph.nWorkstationUID
WHERE ph.nPackageHistoryUID = @prev_uid
)

UPDATE curr
SET tExportDate = prev.tExportDate
FROM dbo.PackageHistory curr
INNER JOIN dbo.PackageHistory prev
ON curr.nPackageHistoryUID =

 (
SELECT TOP 1 ph.nPackageHistoryUID
FROM dbo.PackageHistory ph
INNER JOIN dbo.Workstations w
ON ph.nWorkstationUID = w.nWorkstationUID
WHERE ph.nPackageType = 3
AND tExportDate IS NOT NULL
AND ph.lActive <> 0
AND ph.lDeleted = 0
AND w.cWorkstationName = @computer_name
ORDER BY ph.tAddTime DESC
)

 AND prev.nPackageHistoryUID = @prev_uid

--end script

This script should be used ONLY on for MET/TEAM Version 2.1.2 and earlier where <PackageHistoryUID> is replaced with the UID from Step #3:

--start script

DECLARE @prev_uid NUMERIC(18) = ###
DECLARE @computer_name NVARCHAR(15) = (
    SELECT w.cWorkstationName
    FROM dbo.Workstations w
        INNER JOIN dbo.PackageHistory ph
        ON w.nWorkstationUID = ph.nWorkstationUID
    WHERE ph.nPackageHistoryUID = @prev_uid
)
UPDATE curr
SET tExportDate = prev.tExportDate
FROM dbo.PackageHistory curr
    INNER JOIN dbo.PackageHistory prev
    ON curr.nPackageHistoryUID = (
        SELECT TOP 1 ph.nPackageHistoryUID
        FROM dbo.PackageHistory ph
            INNER JOIN dbo.Workstations w
            ON ph.nWorkstationUID = w.nWorkstationUID
        WHERE ph.nPackageType = 3
          AND tExportDate IS NOT NULL
          AND ph.lActive <> 0
          AND ph.lDeleted = 0
          AND w.cWorkstationName = @computer_name
        ORDER BY ph.tAddTime DESC
    ) AND prev.nPackageHistoryUID = @prev_uid

--end script

  

13) Attempt a Check-In

Perform a check-in on the mobile workstation. After it has completed, confirm with the customer that the mobile data has been added to the server's database.