winhttp.winhttprequest.5.1 the server name or address could not be resolved

Problem: When using POST or GET with sp_OAMethod in SQL Server, you receive the following error:

Error Source Description
0x80072EE7 WinHttp.WinHttpRequest The server name or address could not be resolved 

An example of a HTTP Post function is provided below:

Create function GetHttp
    @url varchar(8000)      
returns varchar(8000)
    DECLARE @win int 
    DECLARE @hr  int 
    DECLARE @text varchar(8000)

    EXEC @hr=sp_OACreate 'WinHttp.WinHttpRequest.5.1',@win OUT 
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win

    EXEC @hr=sp_OAMethod @win, 'Open',NULL,'GET',@url,'false'
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win

    EXEC @hr=sp_OAMethod @win,'SEND'
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win

    EXEC @hr=sp_OAGetProperty @win,'ResponseText',@text OUTPUT
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win

    EXEC @hr=sp_OADestroy @win 
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win 
    RETURN @text

The function is then called with a URL Variable:

SET @url = ''
exec GetHttp @url

Although there are many reasons for the error, if the simpler solutions have not worked (eg: Making sure the URL is correct, that the DNS resolves, Firewall is correctly configured) then the issue may be a hidden proxy.

WinHTTP uses its own proxy and depending on how your servers are configured, it may need to be set or unset.

For me, the proxy was enabled and i needed direct access.

Open an Elavated Powershell window:

> netsh winhttp show proxy

Current WinHTTP proxy settings:

    Proxy Server(s) :

    Bypass List     :  (none)

> netsh winhttp reset proxy

Current WinHTTP proxy settings:

    Direct access (no proxy server).

> netsh winhttp show proxy

Current WinHTTP proxy settings:

    Direct access (no proxy server).

Should I be using COM Objects post SQL 2000??!?

We did this for an old system, but my recommendation would be to use SQL Server CLR’s to access REST Services.

Great post here on MSDN of how to do this –

Using DISM to enable features

From windows 2012, pkgmgr has been deprecated and cannot be used from the command line to install features on windows server.

Use the following instead to install a feature with a one line command:

dism /online /Enable-Feature /FeatureName:TelnetClient

Ive previously blogged about pkgmgr here –

Is my Windows OS 32-bit or 64-bit?

Cool little query to retrieve OS architecture version

wmic os get osarchitecture

Returns something like this:

H:0_ORA_SETUP\sql>wmic os get osarchitecture

the wmic os get command has more variables to search on. eg:

H:0_ORA_SETUP\sql>WMIC OS GET osarchitecture, caption /value
Caption=Microsoft Windows 7 Enterprise

A lot more commands available –

Get CPU/Core/HT Count

Several different methods available.


  cpu_count AS NumberOfLogicalCPUs
, hyperthread_ratio
, ( cpu_count / hyperthread_ratio ) AS NumberOfPhysicalCPUs
      WHEN hyperthread_ratio = cpu_count THEN cpu_count
      ELSE ( ( cpu_count - hyperthread_ratio ) / 
             ( cpu_count / hyperthread_ratio ) )
 END AS NumberOfCoresInEachCPU
    WHEN hyperthread_ratio = cpu_count THEN cpu_count
    ELSE ( cpu_count / hyperthread_ratio ) 
    * ( ( cpu_count - hyperthread_ratio ) / 
            ( cpu_count / hyperthread_ratio ) )
  END AS TotalNumberOfCores
FROM sys.dm_os_sys_info

Powershell – Get Cores:

Get-WmiObject -namespace "root\CIMV2" -class Win32_Processor -Property NumberOfCores | select NumberOfCores

CMD Line:

wmic cpu get NumberofCores, NumberofLogicalProcessors

Useful Links:

Pkgmgr utility to install windows features including Telnet

Install Telnet Client by using a command line

On Windows 7, Windows Server 2008 R2, Windows Server 2008 or Windows Vista you can use the following command line procedure to install Telnet Client.

Open a command prompt window. Click Start, type cmd in the Start Search box, and then press ENTER.
Type the following command:

pkgmgr /iu:"TelnetClient"

If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue. When the command prompt appears again, the installation is complete.

Pkgmgr options:

Full list of windows server packages

View the members of an Active Directory group…Without being an Admin

From a computer that’s a member of the domain, open a command-prompt and run:

NET GROUP "group name" /DOMAIN

Unless your administrators have changed the permissions on the group object you will be able to view the membership that way.

You can use AD Users and Computers (dsa.msc) even if you’re not an administrator, but this, at least, can be done w/o installing anything.

Virtual Box Error Code 0xc0000225 when installing Windows Server 2012 VM

Got the following error when attempting to Install Windows Server 2012 in Virtual box:

Windows failed to start.
A recent hardware or software change might be the cause.
Status: 0xc0000225


To fix, Open the settings for the virtual machine:

System > Enable IO APIC

The following was taken from the Virtualbox manual, chapter 3:

In any host, you should enable the I/O APIC for virtual machines that you intend to use in 64-bit mode. This is especially true for 64-bit Windows VMs. See the section called “"Advanced" tab”. In addition, for 64-bit Windows guests, you should make sure that the VM uses the Intel networking device, since there is no 64-bit driver support for the AMD PCNet card; see the section called “Virtual networking hardware”.

I probably came across this issue because i select [Other Windows] as a template for creating my VM as Windows Server 2012 was not on the list, so none of the options were pre-selected.

Free eBooks from Microsoft

Came across this the other day –

Some great content :


Cluster log in Windows Server 2008

In Windows 2003, The cluster log could be access from C:\Windows\Cluster\Cluster.log.

In Windows 2008, the logging architecture has been replaced with a event based tracing system.

The Vista\Windows Server 2008 Event Model is the next generation of Windows Event Logging and replaces the current version of the Event Log shipped in Microsoft® Windows® 2003 Server, Microsoft® Windows® XP, Windows 2000, and previous versions of Microsoft® Windows NT®.

The new model is a major update to the NT Event Log service. It maintains 100% backwards compatibility with the existing APIs and functionality and fully leverages the existing NT Event Log instrumentation in the applications and services. At the same time, it eliminates some of the limitations of the NT Event Log and provides additional features to better support monitoring and diagnostics of Windows applications, services, components, and drivers.

To extract the Cluster log in WIndows 2008, do the following:

1. Open Cmd Prompt

2. Type the following command

Cluster /Cluster:yourclustername log /gen


The cluster log will be available in C:\Windows\Cluster\Reports

To send to a specific directory, for example C:\temp do:

Cluster /Cluster:yourclustername log /gen /copy:"C:\temp"

Brilliant in depth article on the cluster log here –