In the code you provided you're attempting to use the Indexing service interface. The indexing service is no longer available in Windows 8. From the documentation:
Indexing Service is no longer supported as of Windows XP and is
unavailable for use as of Windows 8. Instead, use Windows Search for
client side search and Microsoft Search Server Express for server side
search.
As the documentation states, you will want to look into Windows Search.
UPDATE:
I've not done this, but to accomplish what you are seeking the documentation states
Before you can use any of the Crawl Scope Manager (CSM) interfaces,
you must perform the following prerequisite steps:
- Create the CrawlSearchManager object and obtain its ISearchManager interface.
- Call ISearchManager::GetCatalog for "SystemIndex" to obtain an instance of an ISearchCatalogManager interface.
- Call ISearchCatalogManager::GetCrawlScopeManager to obtain an instance of ISearchCrawlScopeManager interface.
After making any changes to the Crawl Scope Manager (CSM), you must
call ISearchCrawlScopeManager::SaveAll. This method takes no
parameters and returns S_OK on success.
Here's one example and another for doing this.
Unfortunately, I don't think this can be done from VBScript, because the COM interfaces provided by the Windows Search API don't implement the IDispatch interface, which allows scripting languages like VBScript to call COM objects via late binding.
Does it have to be from VBScript, or can you do it in .NET? If it has to be from VBScript then one approach would be to write a wrapper in .NET and expose it as a COM object.
powershell -executionpolicy unrestricted d:\unattend\userfiles\addscope.ps1
The purpose of the execution policy is to not unknowingly execute a script. – Lymphoid