IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

How to Find Out When the Last Time Windows Server Was Rebooted

For various reasons such as patch application or software installation, a server needs to be rebooted. This simple step could potentially make or break the availability of your application. Just to have a quick information when your server was rebooted can help you in troubleshooting an issue.

There are several ways to find this information.

Using Command Prompt

A quick way to do this is by executing a systeminfo command from Command Prompt within your Windows Server.

  1. Launch Command Prompt and type in the following:

            systeminfo | find "Boot Time"
            

    There are some other variants you can see, but as far as obtaining the date and time of the server reboot, the final result is still the same.

            systeminfo | find /i "Boot Time"
            

    Command Prompt SystemInfo Boot Time

Using Task Manager

  1. In Task Manager, click on the Performance tab and look for the Up time. This will involve a bit of calculation to determine the exact date and time, but you can see how long the server has been running since its last reboot.

    Windows Server Task Manager Up time

Further Reading

systeminfo

April 14, 2021 Filed Under: How To Tagged With: Microsoft, Windows Server

How to Create Kofax TotalAgility (KTA) SDK API in ASP.NET

Overview

Kofax TotalAgility (KTA) is a Smart Process Application (SPA) platform that transforms and simplifies business interactions. Many people thinks Kofax TotalAgility as merely a document capture software but it actually does more than just an OCR software. KTA is an enterprise solution for document management and business process automation platform with OCR is just part of the whole suite.

As in any enterprise-level application, KTA can be easily customized with the provided SDK. This tutorial will show you how to setup a Visual Studio project to create a KTA Web Service in ASP.NET.

Caveat

At this time, you cannot use ASP.NET Core to call KTA SDK. Hopefully this will be addressed in future version.

Requirements

  1. Visual Studio (2019 is used for this example)
  2. Kofax TotalAgility version 7.7 or later
  3. .NET Framework 4.8 (minimum version 4.7)

Steps to Create Visual Studio Project

  1. Launch Visual Studio and create a new Project.

    Visual Studio New Project

  2. On the Create a new project window, select the following settings: C#, Windows, Web. Click Next.

    Visual Studio Project Web Application .NET Framework selection

  3. On the Configure your project screen, type in your Project Name and the Location for your project. Under Framework select .NET Framwework 4.8. Click Create button.

    Visual Studio configure a project for KTA

  4. Select Web API on the Create a new ASP.NET Web Application and click Create button once again.

    Visual Studio Create a new ASP.NET Web Application

  5. Open File Explorer to the project’s bin folder and add the following KTA DLLs. You can copy them from
    C:\Program Files\Kofax\TotalAgility\Agility.Server.Web\bin folder in your KTA installation.

    1. Agility.Sdk.Model.dll
    2. Agility.Server.Common.dll
    3. Agility.Server.Core.dll
    4. Agility.Server.Core.Model.dll
    5. Agility.Server.Integration.Common.dll
    6. TotalAgility.Sdk.dll

    Depending on the need of your application, you may need to copy other DLLs, but I found that this is the minimum you need in order to make it work.

    Copy KTA DLLs to bin folder

  6. Next, we want to right-click on References on the right window and click Add Reference… to all the above DLLs. From time to time, you will encounter an error such as ReferenceManagerPackage package did not load correctly. Make sure you take care of that issue first by following these steps.

    Visual Studio Add Reference

  7. Select Browse on the left and click on Browse button.

    Visual Studio Add Reference Browse Window

  8. Select all the DLLs you just copied from KTA installation by pressing SHIFT-key while clicking on each of them. Click on Add button when done.

    Visual Studio Add Reference KTA DLLs

  9. Press OK button. Make sure all the DLLs are added under the References.

    Visual Studio Add Reference KTA DLLs OK button
    KTA DLLs Check in Visual Studio

Now you are ready to code KTA Web Service in ASP.NET. Happy coding!

Reference

Kofax Knowledgebase

March 22, 2021 Filed Under: How To Tagged With: ASP.NET, Kofax TotalAgility, Visual Studio

How to Resolve ReferenceManagerPackage Error in Visual Studio 2019

If you encounter this error (see below) when you try to Add Reference in Visual Studio:

Visual Studio ReferenceManagerPackage Error

The 'ReferenceManagerPackage' package did not load correctly.

The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users\[UserID]\AppData\Roaming\Microsoft\VisualStudio\16.0_#####\ActivityLog.xml'

Restarting Visual Studio could help resolve this issue.

Continue to show this error message?

You can take a look at the ActivityLog.xml file, but most of the time it’s not necessary. Just for the sake of this example, let’s open it up:

  <entry>
    <record>2479</record>
    <time>2021/03/12 01:21:02.715</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>CreateInstance failed for package [ReferenceManagerPackage]Source: &apos;mscorlib&apos; Description: Could not load type &apos;Microsoft.VisualStudio.Shell.Interop.IVsReferenceManager2&apos; from assembly &apos;Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;.&#x000D;&#x000A;System.TypeLoadException: Could not load type &apos;Microsoft.VisualStudio.Shell.Interop.IVsReferenceManager2&apos; from assembly &apos;Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;.&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)&#x000D;&#x000A;   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)&#x000D;&#x000A;   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)</description>
    <guid>{48D4A2C2-01AD-4F13-9123-610711CACB5B}</guid>
    <hr>80004005 - E_FAIL</hr>
    <errorinfo></errorinfo>
  </entry>
</activity>

Or you can view it with IE or XML viewer:

VisualStudio ActivityLog.xml viewed with Internet Explorer

For this particular case, Visual Studio cannot load Microsoft.VisualStudio.Shell.Interop.11.0.

There are several things you can try to solve this.

1. Delete ComponentModelCache Folder

  1. Exit all instances of Visual Studio.
  2. Open File Explorer and go to %LocalAppData%\Microsoft\VisualStudio\16.0_##### folder and delete ComponentModelCache sub-folder.

    Visual Studio LocalAppData ComponentModelCache folder

  3. Restart Visual Studio with Admin privileges.
  4. Try to open your project and Add References.

If it works at this point, congratulations, but in my case, I got a slightly different error:

Error HRESULT E_FAIL has been returned from a call to a COM component.

Visual Studio Add References HRESULT E_FAIL error

2. Repair Visual Studio

This was suggested by many and it was the easiest to do, so it’s worth to try. Just launch your Visual Studio Intaller and select Repair from the More drop-down for the Visual Studio instance you want to fix.

Visual Studio Installer Repair

I did not have any luck with this either. So I had to do the second step by reinstalling Microsoft.VisualStudio.Shell.Interop.11.0.dll using Global Assembly Cache Tool.

3. Reinstall DLL with Gacutil.exe (Global Assembly Cache Tool)

  1. Open Developer Command Prompt for VS 2019 as administrator.

    Launch Developer Command Prompt for VS 2019 as administrator

    Make sure you see the word Administrator on the top of the command prompt window.

    Administrator Developer Command Prompt for VS 2019 window

  2. Go to the latest .NET Framework version folder you’re using (in this case it’s .NET Framework 4.8) to access the gacutil.exe file.

    C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64>
    
  3. Check where your DLL is located (your active Visual Studio instance). In this case, it is C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies folder.

  4. Type in the following:

    C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64>gacutil.exe /i "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\PublicAssemblies\
    Microsoft.VisualStudio.Shell.Interop.11.0.dll"
    
  5. If it’s successful, you should see a message confirming that the assembly successfully added to the cache.

    GacUtil adds DLL successfully

Check if any of the fix (or the combination of them), launch Visual Studio again, open your project and try to Add References again.

If successful, you should see Reference Manager window opened up.

Visual Studio Reference Manager window

References

“ReferenceManagerPackage” package did not load correctly VS 2019 community
How can I fix the Microsoft Visual Studio error: “package did not load correctly”?
Error HRESULT E_FAIL has been returned from a call to a COM component on Add Reference
Add a reference raise error: Error HRESULT E_FAIL has been returned from a call to a COM component
Gacutil.exe (Global Assembly Cache tool)

March 11, 2021 Filed Under: How To Tagged With: Microsoft, Visual Studio

How to Get Table Definition in SQL Server

Whenever you need to pull a quick definition of a table in SQL Server. Here’s the SQL command (T-SQL) to get the table definition in a database:

USE [MyDB]
GO

SELECT COLUMN_NAME,
  CASE
    WHEN ISNULL(NUMERIC_PRECISION, 200) <> 200 THEN DATA_TYPE + '('
         + CAST(NUMERIC_PRECISION AS VARCHAR(5))
         + ',' + CAST(NUMERIC_SCALE AS VARCHAR(5))
         + ')'
    WHEN ISNULL(CHARACTER_MAXIMUM_LENGTH, 0) = 0 THEN DATA_TYPE
  ELSE
    DATA_TYPE + '('
      + CAST(CHARACTER_MAXIMUM_LENGTH AS VARCHAR(10))
      + ')'
  END AS DATA_TYPE,
  IS_NULLABLE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = '[MyTable]'
GO

The result would be something similar to this:

COLUMN_NAMEDATA_TYPEIS_NULLABLE
AccountNoint(10,0)YES
AccountNamevarchar(50)YES
Balancemoney(10,2)YES
UpdateDatedatetimeNO

You need to substitute [MyDB] and [MyTable] to the database name and table name that you’re querying. That’s all there is to it.

Further Reading

How to Get Names of All Tables in SQL Server
How to Find a Column Name in SQL Server Database
How to Show Field Values as Columns in SQL Server

January 21, 2020 Filed Under: How To Tagged With: Microsoft SQL Server, SQL, SQL Server

How to Use Custom Color in SSMS Using Redgate SQL Prompt

Continuing the two previous posts on employing custom color in SSMS using the built-in feature or SSMS Tools Pack to reduce error in connecting to a wrong environment, if you have access to Redgate SQL Prompt, this might be the easiest and best option to use. It’s so easy to configure as demonstrated that many developers overlook this feature.

You can certainly use the default but for the sake of consistency, we’ll setup the same environment similar to what we did with SSMS and SSMS Tools Pack.

Environment (Hex values)
DEV (#66852E)
STAGING (#808000)
QA (#FF8000)
PROD (#BE0000)

Set Custom Color with SQL Prompt

  1. In the SSMS top menu, click on SQL Prompt and select Options.

    Redgate SQL Prompt in SSMS Menu

  2. On the left pane of SQL Prompt – Options window, under the Tabs, click on Color and you will see another pop-up window with the default colors for typical enterprise environments.

    Redgate SQL Prompt Options Tabs > Color setting

  3. Using the color value above, we can set up our own colors.

    Redgate SQL Prompt Options Color setting customized

That’s all the steps needed to setup custom color coding, and here’s what they look like in SQL Server Management Studio v18.1:

SSMS with custom colors on different environment using Redgate SQL Prompt

Further Reading

How to Use Custom Color in SSMS
Using Connection Coloring in SSMS Tools Pack
Format SQL Using Redgate SQL Prompt

Download

SQL Prompt (FREE Trial)

June 17, 2019 Filed Under: How To Tagged With: SQL Server, SSMS

« Previous Page
Next Page »
Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to Setup WordPress Installation on Linux
  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency

Recent Posts

  • How to Setup WordPress Installation on Linux
  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2026 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure