From: dsleath on
I have an .hta script that works locally, but will not work remotely.
I've created the same path as I'm checking locally on a remote server
and changed the "." to the name of the remote device. I get error
80041002 on line 32 (the For Each objItem In colItems). I looked up
the error and it appears to be a problem retrieving my object
information. Any clues? Thanks!!!:
<html>
<head>
<title>GridAC - List Folder Sizes</title>
<HTA:APPLICATION
ID="GridAC"
APPLICATIONNAME="GridAC"
SCROLL="yes"
SINGLEINSTANCE="yes"
>
</head>

<SCRIPT LANGUAGE="VBScript">
Sub Window_OnLoad()
Window.ResizeTo 300, 600
Window.moveTo (screen.width-240)/2, (screen.height-600)/2
End Sub

Sub FileOwner
strComputer = "."
strFolder = "C:\Tools\Scripts\"

Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set fso = CreateObject("Scripting.fileSystemObject")
Set aFolders = fso.getFolder(strFolder)


For Each strFile in aFolders.files
strHTML = strHTML & "File Name:," & strFile.name & ","
set colItems = objWMI.ExecQuery _
("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile &
"'}" _
& " WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")

For Each objItem In colItems
strHTML = strHTML & "File Owner:," & objItem.ReferencedDomainName
& "\" & objItem.AccountName & "<br>"
Next
Next
passHTML.innerhtml = strHTML
End Sub
</SCRIPT>

<body>

<input type="button" value="Run Script" name="run_button"
onClick="FileOwner"><p>

<p>
<span id="passHTML"></span>

</body>

From: dNagel on
Did you give IIS the necessary permissions to the folder?

D?

dsleath wrote:
> I have an .hta script that works locally, but will not work remotely.
> I've created the same path as I'm checking locally on a remote server
> and changed the "." to the name of the remote device. I get error
> 80041002 on line 32 (the For Each objItem In colItems). I looked up
> the error and it appears to be a problem retrieving my object
> information. Any clues? Thanks!!!:
> <html>
> <head>
> <title>GridAC - List Folder Sizes</title>
> <HTA:APPLICATION
> ID="GridAC"
> APPLICATIONNAME="GridAC"
> SCROLL="yes"
> SINGLEINSTANCE="yes"
>
> </head>
>
> <SCRIPT LANGUAGE="VBScript">
> Sub Window_OnLoad()
> Window.ResizeTo 300, 600
> Window.moveTo (screen.width-240)/2, (screen.height-600)/2
> End Sub
>
> Sub FileOwner
> strComputer = "."
> strFolder = "C:\Tools\Scripts\"
>
> Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
> Set fso = CreateObject("Scripting.fileSystemObject")
> Set aFolders = fso.getFolder(strFolder)
>
>
> For Each strFile in aFolders.files
> strHTML = strHTML & "File Name:," & strFile.name & ","
> set colItems = objWMI.ExecQuery _
> ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile &
> "'}" _
> & " WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
>
> For Each objItem In colItems
> strHTML = strHTML & "File Owner:," & objItem.ReferencedDomainName
> & "\" & objItem.AccountName & "<br>"
> Next
> Next
> passHTML.innerhtml = strHTML
> End Sub
> </SCRIPT>
>
> <body>
>
> <input type="button" value="Run Script" name="run_button"
> onClick="FileOwner"><p>
>
> <p>
> <span id="passHTML"></span>
>
> </body>
>
>
From: dsleath on
I'm not sure how this would work - I didn't apply any permissions. I
just assumed it worked like a vbscript and used my permissions
(administrator) on the server. Can you explain what needs to be done?

dNagel wrote:
> Did you give IIS the necessary permissions to the folder?
>
> D?
>
> dsleath wrote:
> > I have an .hta script that works locally, but will not work remotely.
> > I've created the same path as I'm checking locally on a remote server
> > and changed the "." to the name of the remote device. I get error
> > 80041002 on line 32 (the For Each objItem In colItems). I looked up
> > the error and it appears to be a problem retrieving my object
> > information. Any clues? Thanks!!!:
> > <html>
> > <head>
> > <title>GridAC - List Folder Sizes</title>
> > <HTA:APPLICATION
> > ID="GridAC"
> > APPLICATIONNAME="GridAC"
> > SCROLL="yes"
> > SINGLEINSTANCE="yes"
> >
> > </head>
> >
> > <SCRIPT LANGUAGE="VBScript">
> > Sub Window_OnLoad()
> > Window.ResizeTo 300, 600
> > Window.moveTo (screen.width-240)/2, (screen.height-600)/2
> > End Sub
> >
> > Sub FileOwner
> > strComputer = "."
> > strFolder = "C:\Tools\Scripts\"
> >
> > Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
> > Set fso = CreateObject("Scripting.fileSystemObject")
> > Set aFolders = fso.getFolder(strFolder)
> >
> >
> > For Each strFile in aFolders.files
> > strHTML = strHTML & "File Name:," & strFile.name & ","
> > set colItems = objWMI.ExecQuery _
> > ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile &
> > "'}" _
> > & " WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
> >
> > For Each objItem In colItems
> > strHTML = strHTML & "File Owner:," & objItem.ReferencedDomainName
> > & "\" & objItem.AccountName & "<br>"
> > Next
> > Next
> > passHTML.innerhtml = strHTML
> > End Sub
> > </SCRIPT>
> >
> > <body>
> >
> > <input type="button" value="Run Script" name="run_button"
> > onClick="FileOwner"><p>
> >
> > <p>
> > <span id="passHTML"></span>
> >
> > </body>
> >
> >

From: dNagel on
I assumed a remote call to the HTA was through a web server...

maybe this applies... (The action suggested should be done on the
remote machine)


An error message of 0x80041010 means that you are trying to reference a
WMI class that does not exist. This error typically occurs when:
• You misspell the name of a class. For example, you try to connect
to a class named Win32_Services (with an s on the end) when the actual
class name is Win32_Service (without an s on the end).
• You reference the wrong namespace. Often-times script writers
connect to the root\cimv2 namespace and then try to access the
StdRegProv class. Unfortunately, StdRegProv actually resides in the
root\default namespace.
• You try to access a class that is not supported by a particular
operating system. For example, the SystemRestore class (found in the
root\default namespace) is supported only on Windows XP. If you try to
access that class on, say, a computer running Windows 2000 you will
probably get an “Invalid Class” error.

Note. Instead of an error 0x80041010, you might get error 0x80041002
(“Object could not be found”) or error 0x80041006 (“Insufficient
memory”) when trying to connect to a nonexistent class.

If you are getting an error regarding an invalid class, then once again
it's Scriptomatic to the rescue. After downloading and installing
Scriptomatic, start the utility and wait for the WMI namespace
information to load. When it does, click the drop-down labeled WMI
Namespace and select the appropriate namespace. (For example, if your
class is ostensibly in the root\wmi namespace then select root\wmi.)
After the class information loads, click the WMI Class drop-down and
verify whether or not the class exists and, if it does, whether or not
you have spelled the name correctly:

http://www.microsoft.com/technet/scriptcenter/topics/help/wmi.mspx

your class in in the root\cimv2 namespace.
It would sound like maybe WMI is not installed on that box.

hth,

D.

dsleath wrote:
> I'm not sure how this would work - I didn't apply any permissions. I
> just assumed it worked like a vbscript and used my permissions
> (administrator) on the server. Can you explain what needs to be done?
>
> dNagel wrote:
>
>> Did you give IIS the necessary permissions to the folder?
>>
>> D?
>>
>> dsleath wrote:
>>
>>> I have an .hta script that works locally, but will not work remotely.
>>> I've created the same path as I'm checking locally on a remote server
>>> and changed the "." to the name of the remote device. I get error
>>> 80041002 on line 32 (the For Each objItem In colItems). I looked up
>>> the error and it appears to be a problem retrieving my object
>>> information. Any clues? Thanks!!!:
>>> <html>
>>> <head>
>>> <title>GridAC - List Folder Sizes</title>
>>> <HTA:APPLICATION
>>> ID="GridAC"
>>> APPLICATIONNAME="GridAC"
>>> SCROLL="yes"
>>> SINGLEINSTANCE="yes"
>>>
>>> </head>
>>>
>>> <SCRIPT LANGUAGE="VBScript">
>>> Sub Window_OnLoad()
>>> Window.ResizeTo 300, 600
>>> Window.moveTo (screen.width-240)/2, (screen.height-600)/2
>>> End Sub
>>>
>>> Sub FileOwner
>>> strComputer = "."
>>> strFolder = "C:\Tools\Scripts\"
>>>
>>> Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
>>> Set fso = CreateObject("Scripting.fileSystemObject")
>>> Set aFolders = fso.getFolder(strFolder)
>>>
>>>
>>> For Each strFile in aFolders.files
>>> strHTML = strHTML & "File Name:," & strFile.name & ","
>>> set colItems = objWMI.ExecQuery _
>>> ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile &
>>> "'}" _
>>> & " WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
>>>
>>> For Each objItem In colItems
>>> strHTML = strHTML & "File Owner:," & objItem.ReferencedDomainName
>>> & "\" & objItem.AccountName & "<br>"
>>> Next
>>> Next
>>> passHTML.innerhtml = strHTML
>>> End Sub
>>> </SCRIPT>
>>>
>>> <body>
>>>
>>> <input type="button" value="Run Script" name="run_button"
>>> onClick="FileOwner"><p>
>>>
>>> <p>
>>> <span id="passHTML"></span>
>>>
>>> </body>
>>>
>>>
>>>
>
>
From: dsleath on
Thanks, I'll give that a try. I must say that is an awesome way to use
scriptomatic that I had never thought of!
dNagel wrote:
> I assumed a remote call to the HTA was through a web server...
>
> maybe this applies... (The action suggested should be done on the
> remote machine)
>
>
> An error message of 0x80041010 means that you are trying to reference a
> WMI class that does not exist. This error typically occurs when:
> · You misspell the name of a class. For example, you try to connect
> to a class named Win32_Services (with an s on the end) when the actual
> class name is Win32_Service (without an s on the end).
> · You reference the wrong namespace. Often-times script writers
> connect to the root\cimv2 namespace and then try to access the
> StdRegProv class. Unfortunately, StdRegProv actually resides in the
> root\default namespace.
> · You try to access a class that is not supported by a particular
> operating system. For example, the SystemRestore class (found in the
> root\default namespace) is supported only on Windows XP. If you try to
> access that class on, say, a computer running Windows 2000 you will
> probably get an "Invalid Class" error.
>
> Note. Instead of an error 0x80041010, you might get error 0x80041002
> ("Object could not be found") or error 0x80041006 ("Insufficient
> memory") when trying to connect to a nonexistent class.
>
> If you are getting an error regarding an invalid class, then once again
> it's Scriptomatic to the rescue. After downloading and installing
> Scriptomatic, start the utility and wait for the WMI namespace
> information to load. When it does, click the drop-down labeled WMI
> Namespace and select the appropriate namespace. (For example, if your
> class is ostensibly in the root\wmi namespace then select root\wmi.)
> After the class information loads, click the WMI Class drop-down and
> verify whether or not the class exists and, if it does, whether or not
> you have spelled the name correctly:
>
> http://www.microsoft.com/technet/scriptcenter/topics/help/wmi.mspx
>
> your class in in the root\cimv2 namespace.
> It would sound like maybe WMI is not installed on that box.
>
> hth,
>
> D.
>
> dsleath wrote:
> > I'm not sure how this would work - I didn't apply any permissions. I
> > just assumed it worked like a vbscript and used my permissions
> > (administrator) on the server. Can you explain what needs to be done?
> >
> > dNagel wrote:
> >
> >> Did you give IIS the necessary permissions to the folder?
> >>
> >> D?
> >>
> >> dsleath wrote:
> >>
> >>> I have an .hta script that works locally, but will not work remotely.
> >>> I've created the same path as I'm checking locally on a remote server
> >>> and changed the "." to the name of the remote device. I get error
> >>> 80041002 on line 32 (the For Each objItem In colItems). I looked up
> >>> the error and it appears to be a problem retrieving my object
> >>> information. Any clues? Thanks!!!:
> >>> <html>
> >>> <head>
> >>> <title>GridAC - List Folder Sizes</title>
> >>> <HTA:APPLICATION
> >>> ID="GridAC"
> >>> APPLICATIONNAME="GridAC"
> >>> SCROLL="yes"
> >>> SINGLEINSTANCE="yes"
> >>>
> >>> </head>
> >>>
> >>> <SCRIPT LANGUAGE="VBScript">
> >>> Sub Window_OnLoad()
> >>> Window.ResizeTo 300, 600
> >>> Window.moveTo (screen.width-240)/2, (screen.height-600)/2
> >>> End Sub
> >>>
> >>> Sub FileOwner
> >>> strComputer = "."
> >>> strFolder = "C:\Tools\Scripts\"
> >>>
> >>> Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
> >>> Set fso = CreateObject("Scripting.fileSystemObject")
> >>> Set aFolders = fso.getFolder(strFolder)
> >>>
> >>>
> >>> For Each strFile in aFolders.files
> >>> strHTML = strHTML & "File Name:," & strFile.name & ","
> >>> set colItems = objWMI.ExecQuery _
> >>> ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile &
> >>> "'}" _
> >>> & " WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
> >>>
> >>> For Each objItem In colItems
> >>> strHTML = strHTML & "File Owner:," & objItem.ReferencedDomainName
> >>> & "\" & objItem.AccountName & "<br>"
> >>> Next
> >>> Next
> >>> passHTML.innerhtml = strHTML
> >>> End Sub
> >>> </SCRIPT>
> >>>
> >>> <body>
> >>>
> >>> <input type="button" value="Run Script" name="run_button"
> >>> onClick="FileOwner"><p>
> >>>
> >>> <p>
> >>> <span id="passHTML"></span>
> >>>
> >>> </body>
> >>>
> >>>
> >>>
> >
> >