Failing to run ADSI scripts remotely against IIS?

If you are trying to run an ADSI/WMI Script remotely from a client machine which gets information the from IIS web server around websites etc. you may see this:

Invalid syntax” or error code 800401E4

Or

Microsoft VBScript runtime error: The remote server machine does not exist or is unavailable: 'GetObject'

In my script I was using the following

GetObject( "IIS://" & ServerName & "/W3SVC" )

So basically the above error was complaining about the use of GetObject.

Resolution

1. Ensure Firewall is not blocking access to your server from remote access on the client.

2. ADSI provider should be installed on the client as well as the IIS machine for the above script to work. For running ADSI script against IIS we need to ensure the ADSI provider is installed as below.

Windows Server 2003/XP:

Add/Remove windows Components –> Application Server –> Internet Information services (IIS) –> Common Files.

Windows Vista/Windows 7:

Control Panel –> Programs and Features –> Turn Windows Features on or off –>  Internet Information Services –> Web Management tools –> IIS 6 Management Compatibility –> IIS Metabase and IIS 6 configuration compatibility

Windows Server 2008:

Server Manager –> Roles –> web Server (IIS) –> Add Role Services  –> Management Tools –> IIS 6 Management Compatibility –> Select IIS 6 Metabase compatibility, IIS 6 WMI compatibility and IIS 6 Scripting Tools.

Hoping It may help someone who might be struggling with trying to run the script remotely.

Ciao!