I am getting an error in my .vbs script. The error is "Could not create
object named "WScript.Network". The code is 8007007E. The source is
WScript.CreateObject. The program errors on the "Set" line of code below.

Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")


However, if I add a drive mapping on my PC to a network share hosting a
company application, the script runs. As soon as I delete the mapping, the
script fails. Why is this happening? Why does mapping this drive allow the
script to run without errors?

--
Thanks!

RE: Error 8007007E WScript.Network Wscript.CreateObject by CoreyThomasMCSEMCSAMCDBA

CoreyThomasMCSEMCSAMCDBA
Mon Mar 10 15:29:09 CDT 2008

Remove any "on error resume next" lines, then run the script to see exactly
what the error and line number is.

If you can post your script, it would also help me troubleshoot for ya. :)

-Corey

"Saucer Man" wrote:

> I am getting an error in my .vbs script. The error is "Could not create
> object named "WScript.Network". The code is 8007007E. The source is
> WScript.CreateObject. The program errors on the "Set" line of code below.
>
> Dim objNetwork
> Set objNetwork = WScript.CreateObject("WScript.Network")
>
>
> However, if I add a drive mapping on my PC to a network share hosting a
> company application, the script runs. As soon as I delete the mapping, the
> script fails. Why is this happening? Why does mapping this drive allow the
> script to run without errors?
>
> --
> Thanks!
>
>
>

Re: Error 8007007E WScript.Network Wscript.CreateObject by Tom

Tom
Mon Mar 10 15:38:38 CDT 2008

On Mar 10, 2:12 pm, "Saucer Man" <saucer...@nospam.com> wrote:
> I am getting an error in my .vbs script. The error is "Could not create
> object named "WScript.Network". The code is 8007007E. The source is
> WScript.CreateObject. The program errors on the "Set" line of code below.
>
> Dim objNetwork
> Set objNetwork = WScript.CreateObject("WScript.Network")
>
> However, if I add a drive mapping on my PC to a network share hosting a
> company application, the script runs. As soon as I delete the mapping, the
> script fails. Why is this happening? Why does mapping this drive allow the
> script to run without errors?
>
> --
> Thanks!

I found this at MSDN:

Error code 0x8007007f or error code 0x8007007e
This problem frequently occurs after you upgrade a service pack. After
you upgrade, there appears to be a corrupted file, a missing file, or
a file mismatch.

Workaround for error code 0x8007007f or error code 0x8007007e
To work around this problem, uninstall the service pack that you
installed. Then, reinstall the service pack.

It seems to be and unhandled exception related to "The specified
module could not be found. (Exception from HRESULT: 0x8007007E)"

I don't know whether that helps.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/

Re: Error 8007007E WScript.Network Wscript.CreateObject by Richard

Richard
Mon Mar 10 21:23:08 CDT 2008


"Tom Lavedas" <tglbatch@cox.net> wrote in message
news:4d07ee89-1ba0-4909-8154-de7dd33be37d@u69g2000hse.googlegroups.com...
> On Mar 10, 2:12 pm, "Saucer Man" <saucer...@nospam.com> wrote:
>> I am getting an error in my .vbs script. The error is "Could not create
>> object named "WScript.Network". The code is 8007007E. The source is
>> WScript.CreateObject. The program errors on the "Set" line of code
>> below.
>>
>> Dim objNetwork
>> Set objNetwork = WScript.CreateObject("WScript.Network")
>>
>> However, if I add a drive mapping on my PC to a network share hosting a
>> company application, the script runs. As soon as I delete the mapping,
>> the
>> script fails. Why is this happening? Why does mapping this drive allow
>> the
>> script to run without errors?
>>
>> --
>> Thanks!
>
> I found this at MSDN:
>
> Error code 0x8007007f or error code 0x8007007e
> This problem frequently occurs after you upgrade a service pack. After
> you upgrade, there appears to be a corrupted file, a missing file, or
> a file mismatch.
>
> Workaround for error code 0x8007007f or error code 0x8007007e
> To work around this problem, uninstall the service pack that you
> installed. Then, reinstall the service pack.
>
> It seems to be and unhandled exception related to "The specified
> module could not be found. (Exception from HRESULT: 0x8007007E)"
>
> I don't know whether that helps.
>
> Tom Lavedas
> ===========
> http://members.cox.net/tglbatch/wsh/

If Tom's suggestion doesn't help, what is the operating system on the
computer. Also, how do you configure the logon scripts to run - using the
"Logon script" field on the "Profile" tab of ADUC or in a Group Policy.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--



Re: Error 8007007E WScript.Network Wscript.CreateObject by Saucer

Saucer
Tue Mar 11 07:44:24 CDT 2008

Thanks Corey, Tom, and Richard.

I remarked out the "on error reume next" statements. It still errors. It
errors on line #7. Same error as in original post. I am using Windows XP
SP2. I never installed SP2 as it was built right into the original XP
install disk. Currently, I am just running this .vbs file from my desktop.
Once it works, I plan on creating a GPO to run it at logon. Here is the
script. It is a modified version of one I found on the internet.

Option Explicit

Dim strLogName, bolWriteLog, bolManagePrinters
Dim objNetwork, objDrives, objDict, objComputer, objShell, objFileSystem,
objLogFile, objRootDSE, objTrans
Dim strComputerName, strDomain, strUser, strAdsPath, strNetBIOSDomain,
strDNSDomain, strTemp, strLogPath, i

Set objNetwork = WScript.CreateObject("WScript.Network")
Set objDrives = objNetwork.EnumNetworkDrives
Set objShell = WScript.CreateObject("WScript.Shell")

strLogName = "logfile.log"
bolWriteLog = True
bolManagePrinters = True
strComputerName = objNetwork.ComputerName
strDomain = objNetwork.UserDomain
strUser = objNetwork.UserName
strAdsPath = strDomain & "/" & strUser
strNetBIOSDomain = strDomain
strTemp = objshell.ExpandEnvironmentStrings("%TEMP%")
strLogPath = strTemp & "\" & strLogName

Set objComputer = GetObject("WinNT://" & strNetBIOSDomain & "/" &
strComputerName & ",computer")
Set objFileSystem = WScript.CreateObject("Scripting.FileSystemObject")


If bolWriteLog then ' Initialize log file
'on error resume next
Set objLogFile = objFileSystem.OpenTextFile(strLogPath, 2, True)
writelog "############### Start Login Script ##################"
If not err.number = 0 then
WScript.quit
End if
on error goto 0
End if


If isMember("System Users") or isMember("Metals - System Users") then
'DriveMapper "U:", "\\server-2\share"
End if

writelog "################ End Login Script ###################"

Set objNetwork = Nothing
Set objDrives = Nothing
Set objComputer = Nothing
Set objShell = Nothing
Set objFileSystem = Nothing
Set objLogFile = Nothing
WScript.Quit



'######################### Subs 'n Functions Below #########################


Function IsMember(sGroup)
Dim oDict, oUser, oGroup
If IsEmpty(oDict) Then
Set oDict = CreateObject("Scripting.Dictionary")
oDict.CompareMode = vbTextCompare
Set oUser = GetObject("WinNT://" & strAdsPath & ",user")
For Each oGroup In oUser.Groups
oDict.Add oGroup.Name, "-"
Next
Set oUser = Nothing
End If
IsMember = CBool(oDict.Exists(sGroup))
If IsMember and bolWriteLog then objLogFile.WriteLine(Now() & ": Success:
User is member of " & sGroup)
End Function

sub WriteLog(sEntry)
If bolWriteLog then objLogFile.WriteLine(Now() & ": Log : " & sEntry)
End Sub


Sub DriveMapper(sDrive, sShare)
For i = 0 to objDrives.Count -1 Step 2
If LCase(sDrive) = LCase(objDrives.Item(i)) then
If not LCase(sShare) = LCase(objDrives.Item(i+1)) then
objNetwork.RemoveNetworkDrive sDrive, true, true
Else
If bolWriteLog then objLogFile.WriteLine(Now() & ": Success: Connect
""" & sDrive & """ to share """ & _
sShare & """ (previously connected)")
Exit Sub
End if
End if
Next
'on error resume next
objNetwork.MapNetworkDrive sDrive, sShare
If Err.Number = 0 Then
If bolWriteLog then objLogFile.WriteLine(Now() & ": Success: Connect """
& sDrive & """ to share """ & sShare & """")
Else
If bolWriteLog then objLogFile.WriteLine(Now() & ": Failed: Connect """ &
sDrive & """ to share """ & sShare & """")
End if
on error goto 0
End Sub




"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:uovpc7xgIHA.3400@TK2MSFTNGP03.phx.gbl...
>
> "Tom Lavedas" <tglbatch@cox.net> wrote in message
> news:4d07ee89-1ba0-4909-8154-de7dd33be37d@u69g2000hse.googlegroups.com...
>> On Mar 10, 2:12 pm, "Saucer Man" <saucer...@nospam.com> wrote:
>>> I am getting an error in my .vbs script. The error is "Could not create
>>> object named "WScript.Network". The code is 8007007E. The source is
>>> WScript.CreateObject. The program errors on the "Set" line of code
>>> below.
>>>
>>> Dim objNetwork
>>> Set objNetwork = WScript.CreateObject("WScript.Network")
>>>
>>> However, if I add a drive mapping on my PC to a network share hosting a
>>> company application, the script runs. As soon as I delete the mapping,
>>> the
>>> script fails. Why is this happening? Why does mapping this drive allow
>>> the
>>> script to run without errors?
>>>
>>> --
>>> Thanks!
>>
>> I found this at MSDN:
>>
>> Error code 0x8007007f or error code 0x8007007e
>> This problem frequently occurs after you upgrade a service pack. After
>> you upgrade, there appears to be a corrupted file, a missing file, or
>> a file mismatch.
>>
>> Workaround for error code 0x8007007f or error code 0x8007007e
>> To work around this problem, uninstall the service pack that you
>> installed. Then, reinstall the service pack.
>>
>> It seems to be and unhandled exception related to "The specified
>> module could not be found. (Exception from HRESULT: 0x8007007E)"
>>
>> I don't know whether that helps.
>>
>> Tom Lavedas
>> ===========
>> http://members.cox.net/tglbatch/wsh/
>
> If Tom's suggestion doesn't help, what is the operating system on the
> computer. Also, how do you configure the logon scripts to run - using the
> "Logon script" field on the "Profile" tab of ADUC or in a Group Policy.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
>
>



Re: script to search text by ekkehard

ekkehard
Tue Mar 11 07:45:18 CDT 2008

ekkehard.horner schrieb:
> I am getting an error in my .vbs script. The error is "Could not create
> object named "WScript.Network". The code is 8007007E. The source is
> WScript.CreateObject. The program errors on the "Set" line of code below.
>
> Dim objNetwork
> Set objNetwork = WScript.CreateObject("WScript.Network")
>
>
> However, if I add a drive mapping on my PC to a network share hosting a
> company application, the script runs. As soon as I delete the mapping, the
> script fails. Why is this happening? Why does mapping this drive allow the
> script to run without errors?
>
This message wasn't send by me; I can't explain how this could happen,
but I apologize for any inconvenience caused by this.

Re: Error 8007007E WScript.Network Wscript.CreateObject by Saucer

Saucer
Tue Mar 11 14:12:55 CDT 2008

Let's make this even simpler. I created a very small script.

Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
msgbox objNetwork.UserDomain
Set objNetwork = Nothing
WScript.quit

The same behavior with this script. If my computer has a U: drive mapping
to a certain share on the network, this script works. If I disconnect the
U: drive, the script fails with the same error.

If the mapping to the share is a different letter than U:, the script FAILS.
By that same token, if U: is mapped to a different share, it fails also. I
need to have the letter U mapped to a certain share for this line....

Set objNetwork = WScript.CreateObject("WScript.Network")

not to error. What the heck is going on here???


"Saucer Man" <saucerman@nospam.com> wrote in message
news:47d67ea7$0$6430$cc2e38e6@news.uslec.net...
> Thanks Corey, Tom, and Richard.
>
> I remarked out the "on error reume next" statements. It still errors. It
> errors on line #7. Same error as in original post. I am using Windows XP
> SP2. I never installed SP2 as it was built right into the original XP
> install disk. Currently, I am just running this .vbs file from my
> desktop. Once it works, I plan on creating a GPO to run it at logon. Here
> is the script. It is a modified version of one I found on the internet.
>
> Option Explicit
>
> Dim strLogName, bolWriteLog, bolManagePrinters
> Dim objNetwork, objDrives, objDict, objComputer, objShell, objFileSystem,
> objLogFile, objRootDSE, objTrans
> Dim strComputerName, strDomain, strUser, strAdsPath, strNetBIOSDomain,
> strDNSDomain, strTemp, strLogPath, i
>
> Set objNetwork = WScript.CreateObject("WScript.Network")
> Set objDrives = objNetwork.EnumNetworkDrives
> Set objShell = WScript.CreateObject("WScript.Shell")
>
> strLogName = "logfile.log"
> bolWriteLog = True
> bolManagePrinters = True
> strComputerName = objNetwork.ComputerName
> strDomain = objNetwork.UserDomain
> strUser = objNetwork.UserName
> strAdsPath = strDomain & "/" & strUser
> strNetBIOSDomain = strDomain
> strTemp = objshell.ExpandEnvironmentStrings("%TEMP%")
> strLogPath = strTemp & "\" & strLogName
>
> Set objComputer = GetObject("WinNT://" & strNetBIOSDomain & "/" &
> strComputerName & ",computer")
> Set objFileSystem = WScript.CreateObject("Scripting.FileSystemObject")
>
>
> If bolWriteLog then ' Initialize log file
> 'on error resume next
> Set objLogFile = objFileSystem.OpenTextFile(strLogPath, 2, True)
> writelog "############### Start Login Script ##################"
> If not err.number = 0 then
> WScript.quit
> End if
> on error goto 0
> End if
>
>
> If isMember("System Users") or isMember("Metals - System Users") then
> 'DriveMapper "U:", "\\server-2\share"
> End if
>
> writelog "################ End Login Script ###################"
>
> Set objNetwork = Nothing
> Set objDrives = Nothing
> Set objComputer = Nothing
> Set objShell = Nothing
> Set objFileSystem = Nothing
> Set objLogFile = Nothing
> WScript.Quit
>
>
>
> '######################### Subs 'n Functions Below
> #########################
>
>
> Function IsMember(sGroup)
> Dim oDict, oUser, oGroup
> If IsEmpty(oDict) Then
> Set oDict = CreateObject("Scripting.Dictionary")
> oDict.CompareMode = vbTextCompare
> Set oUser = GetObject("WinNT://" & strAdsPath & ",user")
> For Each oGroup In oUser.Groups
> oDict.Add oGroup.Name, "-"
> Next
> Set oUser = Nothing
> End If
> IsMember = CBool(oDict.Exists(sGroup))
> If IsMember and bolWriteLog then objLogFile.WriteLine(Now() & ": Success:
> User is member of " & sGroup)
> End Function
>
> sub WriteLog(sEntry)
> If bolWriteLog then objLogFile.WriteLine(Now() & ": Log : " & sEntry)
> End Sub
>
>
> Sub DriveMapper(sDrive, sShare)
> For i = 0 to objDrives.Count -1 Step 2
> If LCase(sDrive) = LCase(objDrives.Item(i)) then
> If not LCase(sShare) = LCase(objDrives.Item(i+1)) then
> objNetwork.RemoveNetworkDrive sDrive, true, true
> Else
> If bolWriteLog then objLogFile.WriteLine(Now() & ": Success: Connect
> """ & sDrive & """ to share """ & _
> sShare & """ (previously connected)")
> Exit Sub
> End if
> End if
> Next
> 'on error resume next
> objNetwork.MapNetworkDrive sDrive, sShare
> If Err.Number = 0 Then
> If bolWriteLog then objLogFile.WriteLine(Now() & ": Success: Connect """
> & sDrive & """ to share """ & sShare & """")
> Else
> If bolWriteLog then objLogFile.WriteLine(Now() & ": Failed: Connect """
> & sDrive & """ to share """ & sShare & """")
> End if
> on error goto 0
> End Sub
>
>
>
>
> "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
> message news:uovpc7xgIHA.3400@TK2MSFTNGP03.phx.gbl...
>>
>> "Tom Lavedas" <tglbatch@cox.net> wrote in message
>> news:4d07ee89-1ba0-4909-8154-de7dd33be37d@u69g2000hse.googlegroups.com...
>>> On Mar 10, 2:12 pm, "Saucer Man" <saucer...@nospam.com> wrote:
>>>> I am getting an error in my .vbs script. The error is "Could not
>>>> create
>>>> object named "WScript.Network". The code is 8007007E. The source is
>>>> WScript.CreateObject. The program errors on the "Set" line of code
>>>> below.
>>>>
>>>> Dim objNetwork
>>>> Set objNetwork = WScript.CreateObject("WScript.Network")
>>>>
>>>> However, if I add a drive mapping on my PC to a network share hosting a
>>>> company application, the script runs. As soon as I delete the mapping,
>>>> the
>>>> script fails. Why is this happening? Why does mapping this drive
>>>> allow the
>>>> script to run without errors?
>>>>
>>>> --
>>>> Thanks!
>>>
>>> I found this at MSDN:
>>>
>>> Error code 0x8007007f or error code 0x8007007e
>>> This problem frequently occurs after you upgrade a service pack. After
>>> you upgrade, there appears to be a corrupted file, a missing file, or
>>> a file mismatch.
>>>
>>> Workaround for error code 0x8007007f or error code 0x8007007e
>>> To work around this problem, uninstall the service pack that you
>>> installed. Then, reinstall the service pack.
>>>
>>> It seems to be and unhandled exception related to "The specified
>>> module could not be found. (Exception from HRESULT: 0x8007007E)"
>>>
>>> I don't know whether that helps.
>>>
>>> Tom Lavedas
>>> ===========
>>> http://members.cox.net/tglbatch/wsh/
>>
>> If Tom's suggestion doesn't help, what is the operating system on the
>> computer. Also, how do you configure the logon scripts to run - using the
>> "Logon script" field on the "Profile" tab of ADUC or in a Group Policy.
>>
>> --
>> Richard Mueller
>> Microsoft MVP Scripting and ADSI
>> Hilltop Lab - http://www.rlmueller.net
>> --
>>
>>
>
>
>



Re: Error 8007007E WScript.Network Wscript.CreateObject by Richard

Richard
Tue Mar 11 14:23:15 CDT 2008

What happens if you use the following?

Set objNetwork = CreateObject("WScript.Network")

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--

"Saucer Man" <saucerman@nospam.com> wrote in message
news:47d6d9b3$0$25836$cc2e38e6@news.uslec.net...
> Let's make this even simpler. I created a very small script.
>
> Dim objNetwork
> Set objNetwork = WScript.CreateObject("WScript.Network")
> msgbox objNetwork.UserDomain
> Set objNetwork = Nothing
> WScript.quit
>
> The same behavior with this script. If my computer has a U: drive mapping
> to a certain share on the network, this script works. If I disconnect the
> U: drive, the script fails with the same error.
>
> If the mapping to the share is a different letter than U:, the script
> FAILS. By that same token, if U: is mapped to a different share, it fails
> also. I need to have the letter U mapped to a certain share for this
> line....
>
> Set objNetwork = WScript.CreateObject("WScript.Network")
>
> not to error. What the heck is going on here???
>
>
> "Saucer Man" <saucerman@nospam.com> wrote in message
> news:47d67ea7$0$6430$cc2e38e6@news.uslec.net...
>> Thanks Corey, Tom, and Richard.
>>
>> I remarked out the "on error reume next" statements. It still errors.
>> It errors on line #7. Same error as in original post. I am using
>> Windows XP SP2. I never installed SP2 as it was built right into the
>> original XP install disk. Currently, I am just running this .vbs file
>> from my desktop. Once it works, I plan on creating a GPO to run it at
>> logon. Here is the script. It is a modified version of one I found on
>> the internet.
>>
>> Option Explicit
>>
>> Dim strLogName, bolWriteLog, bolManagePrinters
>> Dim objNetwork, objDrives, objDict, objComputer, objShell, objFileSystem,
>> objLogFile, objRootDSE, objTrans
>> Dim strComputerName, strDomain, strUser, strAdsPath, strNetBIOSDomain,
>> strDNSDomain, strTemp, strLogPath, i
>>
>> Set objNetwork = WScript.CreateObject("WScript.Network")
>> Set objDrives = objNetwork.EnumNetworkDrives
>> Set objShell = WScript.CreateObject("WScript.Shell")
>>
>> strLogName = "logfile.log"
>> bolWriteLog = True
>> bolManagePrinters = True
>> strComputerName = objNetwork.ComputerName
>> strDomain = objNetwork.UserDomain
>> strUser = objNetwork.UserName
>> strAdsPath = strDomain & "/" & strUser
>> strNetBIOSDomain = strDomain
>> strTemp = objshell.ExpandEnvironmentStrings("%TEMP%")
>> strLogPath = strTemp & "\" & strLogName
>>
>> Set objComputer = GetObject("WinNT://" & strNetBIOSDomain & "/" &
>> strComputerName & ",computer")
>> Set objFileSystem = WScript.CreateObject("Scripting.FileSystemObject")
>>
>>
>> If bolWriteLog then ' Initialize log file
>> 'on error resume next
>> Set objLogFile = objFileSystem.OpenTextFile(strLogPath, 2, True)
>> writelog "############### Start Login Script ##################"
>> If not err.number = 0 then
>> WScript.quit
>> End if
>> on error goto 0
>> End if
>>
>>
>> If isMember("System Users") or isMember("Metals - System Users") then
>> 'DriveMapper "U:", "\\server-2\share"
>> End if
>>
>> writelog "################ End Login Script ###################"
>>
>> Set objNetwork = Nothing
>> Set objDrives = Nothing
>> Set objComputer = Nothing
>> Set objShell = Nothing
>> Set objFileSystem = Nothing
>> Set objLogFile = Nothing
>> WScript.Quit
>>
>>
>>
>> '######################### Subs 'n Functions Below
>> #########################
>>
>>
>> Function IsMember(sGroup)
>> Dim oDict, oUser, oGroup
>> If IsEmpty(oDict) Then
>> Set oDict = CreateObject("Scripting.Dictionary")
>> oDict.CompareMode = vbTextCompare
>> Set oUser = GetObject("WinNT://" & strAdsPath & ",user")
>> For Each oGroup In oUser.Groups
>> oDict.Add oGroup.Name, "-"
>> Next
>> Set oUser = Nothing
>> End If
>> IsMember = CBool(oDict.Exists(sGroup))
>> If IsMember and bolWriteLog then objLogFile.WriteLine(Now() & ": Success:
>> User is member of " & sGroup)
>> End Function
>>
>> sub WriteLog(sEntry)
>> If bolWriteLog then objLogFile.WriteLine(Now() & ": Log : " & sEntry)
>> End Sub
>>
>>
>> Sub DriveMapper(sDrive, sShare)
>> For i = 0 to objDrives.Count -1 Step 2
>> If LCase(sDrive) = LCase(objDrives.Item(i)) then
>> If not LCase(sShare) = LCase(objDrives.Item(i+1)) then
>> objNetwork.RemoveNetworkDrive sDrive, true, true
>> Else
>> If bolWriteLog then objLogFile.WriteLine(Now() & ": Success: Connect
>> """ & sDrive & """ to share """ & _
>> sShare & """ (previously connected)")
>> Exit Sub
>> End if
>> End if
>> Next
>> 'on error resume next
>> objNetwork.MapNetworkDrive sDrive, sShare
>> If Err.Number = 0 Then
>> If bolWriteLog then objLogFile.WriteLine(Now() & ": Success: Connect
>> """ & sDrive & """ to share """ & sShare & """")
>> Else
>> If bolWriteLog then objLogFile.WriteLine(Now() & ": Failed: Connect """
>> & sDrive & """ to share """ & sShare & """")
>> End if
>> on error goto 0
>> End Sub
>>
>>
>>
>>
>> "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
>> message news:uovpc7xgIHA.3400@TK2MSFTNGP03.phx.gbl...
>>>
>>> "Tom Lavedas" <tglbatch@cox.net> wrote in message
>>> news:4d07ee89-1ba0-4909-8154-de7dd33be37d@u69g2000hse.googlegroups.com...
>>>> On Mar 10, 2:12 pm, "Saucer Man" <saucer...@nospam.com> wrote:
>>>>> I am getting an error in my .vbs script. The error is "Could not
>>>>> create
>>>>> object named "WScript.Network". The code is 8007007E. The source is
>>>>> WScript.CreateObject. The program errors on the "Set" line of code
>>>>> below.
>>>>>
>>>>> Dim objNetwork
>>>>> Set objNetwork = WScript.CreateObject("WScript.Network")
>>>>>
>>>>> However, if I add a drive mapping on my PC to a network share hosting
>>>>> a
>>>>> company application, the script runs. As soon as I delete the
>>>>> mapping, the
>>>>> script fails. Why is this happening? Why does mapping this drive
>>>>> allow the
>>>>> script to run without errors?
>>>>>
>>>>> --
>>>>> Thanks!
>>>>
>>>> I found this at MSDN:
>>>>
>>>> Error code 0x8007007f or error code 0x8007007e
>>>> This problem frequently occurs after you upgrade a service pack. After
>>>> you upgrade, there appears to be a corrupted file, a missing file, or
>>>> a file mismatch.
>>>>
>>>> Workaround for error code 0x8007007f or error code 0x8007007e
>>>> To work around this problem, uninstall the service pack that you
>>>> installed. Then, reinstall the service pack.
>>>>
>>>> It seems to be and unhandled exception related to "The specified
>>>> module could not be found. (Exception from HRESULT: 0x8007007E)"
>>>>
>>>> I don't know whether that helps.
>>>>
>>>> Tom Lavedas
>>>> ===========
>>>> http://members.cox.net/tglbatch/wsh/
>>>
>>> If Tom's suggestion doesn't help, what is the operating system on the
>>> computer. Also, how do you configure the logon scripts to run - using
>>> the "Logon script" field on the "Profile" tab of ADUC or in a Group
>>> Policy.
>>>
>>> --
>>> Richard Mueller
>>> Microsoft MVP Scripting and ADSI
>>> Hilltop Lab - http://www.rlmueller.net
>>> --
>>>
>>>
>>
>>
>>
>
>



Re: Error 8007007E WScript.Network Wscript.CreateObject by Saucer

Saucer
Wed Mar 12 11:51:41 CDT 2008

I get an error when I try that also. However, I downloaded the latest
Windows Scripting Host for XP/2000 and it now works. Strange but I'm happy
it works. I wonder how many workstations will need this installed now.
Thanks for the help!

"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:ubypg16gIHA.5624@TK2MSFTNGP02.phx.gbl...
> What happens if you use the following?
>
> Set objNetwork = CreateObject("WScript.Network")
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
>
> "Saucer Man" <saucerman@nospam.com> wrote in message
> news:47d6d9b3$0$25836$cc2e38e6@news.uslec.net...
>> Let's make this even simpler. I created a very small script.
>>
>> Dim objNetwork
>> Set objNetwork = WScript.CreateObject("WScript.Network")
>> msgbox objNetwork.UserDomain
>> Set objNetwork = Nothing
>> WScript.quit
>>
>> The same behavior with this script. If my computer has a U: drive
>> mapping to a certain share on the network, this script works. If I
>> disconnect the U: drive, the script fails with the same error.
>>
>> If the mapping to the share is a different letter than U:, the script
>> FAILS. By that same token, if U: is mapped to a different share, it fails
>> also. I need to have the letter U mapped to a certain share for this
>> line....
>>
>> Set objNetwork = WScript.CreateObject("WScript.Network")
>>
>> not to error. What the heck is going on here???
>>
>>
>> "Saucer Man" <saucerman@nospam.com> wrote in message
>> news:47d67ea7$0$6430$cc2e38e6@news.uslec.net...
>>> Thanks Corey, Tom, and Richard.
>>>
>>> I remarked out the "on error reume next" statements. It still errors.
>>> It errors on line #7. Same error as in original post. I am using
>>> Windows XP SP2. I never installed SP2 as it was built right into the
>>> original XP install disk. Currently, I am just running this .vbs file
>>> from my desktop. Once it works, I plan on creating a GPO to run it at
>>> logon. Here is the script. It is a modified version of one I found on
>>> the internet.
>>>
>>> Option Explicit
>>>
>>> Dim strLogName, bolWriteLog, bolManagePrinters
>>> Dim objNetwork, objDrives, objDict, objComputer, objShell,
>>> objFileSystem, objLogFile, objRootDSE, objTrans
>>> Dim strComputerName, strDomain, strUser, strAdsPath, strNetBIOSDomain,
>>> strDNSDomain, strTemp, strLogPath, i
>>>
>>> Set objNetwork = WScript.CreateObject("WScript.Network")
>>> Set objDrives = objNetwork.EnumNetworkDrives
>>> Set objShell = WScript.CreateObject("WScript.Shell")
>>>
>>> strLogName = "logfile.log"
>>> bolWriteLog = True
>>> bolManagePrinters = True
>>> strComputerName = objNetwork.ComputerName
>>> strDomain = objNetwork.UserDomain
>>> strUser = objNetwork.UserName
>>> strAdsPath = strDomain & "/" & strUser
>>> strNetBIOSDomain = strDomain
>>> strTemp = objshell.ExpandEnvironmentStrings("%TEMP%")
>>> strLogPath = strTemp & "\" & strLogName
>>>
>>> Set objComputer = GetObject("WinNT://" & strNetBIOSDomain & "/" &
>>> strComputerName & ",computer")
>>> Set objFileSystem = WScript.CreateObject("Scripting.FileSystemObject")
>>>
>>>
>>> If bolWriteLog then ' Initialize log file
>>> 'on error resume next
>>> Set objLogFile = objFileSystem.OpenTextFile(strLogPath, 2, True)
>>> writelog "############### Start Login Script ##################"
>>> If not err.number = 0 then
>>> WScript.quit
>>> End if
>>> on error goto 0
>>> End if
>>>
>>>
>>> If isMember("System Users") or isMember("Metals - System Users") then
>>> 'DriveMapper "U:", "\\server-2\share"
>>> End if
>>>
>>> writelog "################ End Login Script ###################"
>>>
>>> Set objNetwork = Nothing
>>> Set objDrives = Nothing
>>> Set objComputer = Nothing
>>> Set objShell = Nothing
>>> Set objFileSystem = Nothing
>>> Set objLogFile = Nothing
>>> WScript.Quit
>>>
>>>
>>>
>>> '######################### Subs 'n Functions Below
>>> #########################
>>>
>>>
>>> Function IsMember(sGroup)
>>> Dim oDict, oUser, oGroup
>>> If IsEmpty(oDict) Then
>>> Set oDict = CreateObject("Scripting.Dictionary")
>>> oDict.CompareMode = vbTextCompare
>>> Set oUser = GetObject("WinNT://" & strAdsPath & ",user")
>>> For Each oGroup In oUser.Groups
>>> oDict.Add oGroup.Name, "-"
>>> Next
>>> Set oUser = Nothing
>>> End If
>>> IsMember = CBool(oDict.Exists(sGroup))
>>> If IsMember and bolWriteLog then objLogFile.WriteLine(Now() & ":
>>> Success: User is member of " & sGroup)
>>> End Function
>>>
>>> sub WriteLog(sEntry)
>>> If bolWriteLog then objLogFile.WriteLine(Now() & ": Log : " & sEntry)
>>> End Sub
>>>
>>>
>>> Sub DriveMapper(sDrive, sShare)
>>> For i = 0 to objDrives.Count -1 Step 2
>>> If LCase(sDrive) = LCase(objDrives.Item(i)) then
>>> If not LCase(sShare) = LCase(objDrives.Item(i+1)) then
>>> objNetwork.RemoveNetworkDrive sDrive, true, true
>>> Else
>>> If bolWriteLog then objLogFile.WriteLine(Now() & ": Success: Connect
>>> """ & sDrive & """ to share """ & _
>>> sShare & """ (previously connected)")
>>> Exit Sub
>>> End if
>>> End if
>>> Next
>>> 'on error resume next
>>> objNetwork.MapNetworkDrive sDrive, sShare
>>> If Err.Number = 0 Then
>>> If bolWriteLog then objLogFile.WriteLine(Now() & ": Success: Connect
>>> """ & sDrive & """ to share """ & sShare & """")
>>> Else
>>> If bolWriteLog then objLogFile.WriteLine(Now() & ": Failed: Connect
>>> """ & sDrive & """ to share """ & sShare & """")
>>> End if
>>> on error goto 0
>>> End Sub
>>>
>>>
>>>
>>>
>>> "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
>>> message news:uovpc7xgIHA.3400@TK2MSFTNGP03.phx.gbl...
>>>>
>>>> "Tom Lavedas" <tglbatch@cox.net> wrote in message
>>>> news:4d07ee89-1ba0-4909-8154-de7dd33be37d@u69g2000hse.googlegroups.com...
>>>>> On Mar 10, 2:12 pm, "Saucer Man" <saucer...@nospam.com> wrote:
>>>>>> I am getting an error in my .vbs script. The error is "Could not
>>>>>> create
>>>>>> object named "WScript.Network". The code is 8007007E. The source is
>>>>>> WScript.CreateObject. The program errors on the "Set" line of code
>>>>>> below.
>>>>>>
>>>>>> Dim objNetwork
>>>>>> Set objNetwork = WScript.CreateObject("WScript.Network")
>>>>>>
>>>>>> However, if I add a drive mapping on my PC to a network share hosting
>>>>>> a
>>>>>> company application, the script runs. As soon as I delete the
>>>>>> mapping, the
>>>>>> script fails. Why is this happening? Why does mapping this drive
>>>>>> allow the
>>>>>> script to run without errors?
>>>>>>
>>>>>> --
>>>>>> Thanks!
>>>>>
>>>>> I found this at MSDN:
>>>>>
>>>>> Error code 0x8007007f or error code 0x8007007e
>>>>> This problem frequently occurs after you upgrade a service pack. After
>>>>> you upgrade, there appears to be a corrupted file, a missing file, or
>>>>> a file mismatch.
>>>>>
>>>>> Workaround for error code 0x8007007f or error code 0x8007007e
>>>>> To work around this problem, uninstall the service pack that you
>>>>> installed. Then, reinstall the service pack.
>>>>>
>>>>> It seems to be and unhandled exception related to "The specified
>>>>> module could not be found. (Exception from HRESULT: 0x8007007E)"
>>>>>
>>>>> I don't know whether that helps.
>>>>>
>>>>> Tom Lavedas
>>>>> ===========
>>>>> http://members.cox.net/tglbatch/wsh/
>>>>
>>>> If Tom's suggestion doesn't help, what is the operating system on the
>>>> computer. Also, how do you configure the logon scripts to run - using
>>>> the "Logon script" field on the "Profile" tab of ADUC or in a Group
>>>> Policy.
>>>>
>>>> --
>>>> Richard Mueller
>>>> Microsoft MVP Scripting and ADSI
>>>> Hilltop Lab - http://www.rlmueller.net
>>>> --
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>