Is there any way to load wininet.dll using macros, scripts, or PowerShell??

Marcelo Buarque (Nokia) 0 Reputation points
2023-02-02T14:21:29.1933333+00:00

Hi guys ! I use a couple of macros that handle files in SharePoint thru commands like "Dir" , "Save" , "open" etc. Many of these commands (Dir for instance) do not work if wininet.dll is not "loaded".
In the same way, if this DLL is not loaded, you cannot open the file in Windows Explorer using his SharePoint address (as a server address). Unfortunately, this DLL used to be "loaded" by Internet Explorer and, when IE got discontinued, all stopped working because Edge does not load this DLL.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,687 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,950 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,792 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,575 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. S.Sengupta 19,261 Reputation points MVP
    2023-02-03T01:12:20.51+00:00

    Run the sfc /scannow System File Checker command to replace a missing or corrupt copy of the wininet.dll file.

    Alternatively, you may go for a system restore.

    0 comments No comments

  2. Limitless Technology 44,376 Reputation points
    2023-02-03T16:53:48.3566667+00:00

    Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query.

    Yes, you can load wininet.dll using macros, scripts, or PowerShell.

    In a macro, you can use the LoadLibrary function in the Windows API to load wininet.dll dynamically. Here is an example in VBA:

    Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long

    Sub LoadWininet()

    LoadLibrary "wininet.dll"

    End Sub

    In PowerShell, you can use the Add-Type cmdlet to load wininet.dll dynamically. Here is an example:

    Add-Type -Path "C:\Windows\System32\wininet.dll"

    You can also use the LoadLibrary function in C# or any other .NET language to load wininet.dll dynamically in your scripts.

    Note: Modifying system files and loading DLLs manually can have unintended consequences and can affect the stability and security of your system. Therefore, it is recommended to seek the assistance of a knowledgeable professional or to use a supported method to access SharePoint files.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.