dannydanny
IS-IT--Management
Hi,
I sent out a script to everyone in my office to collect information about links stored on their computers then write the information to a textfile on the server. I created the script below and ran it and it seemed to work perfectly. But no sooner than I had distributed the scirpt, users started calling me asking why an error popped up. I investigated and this was the error code: "800A0046. Can not write to file."
However the script continues and works as intended. So I am wondering, why did the error occur and what does it mean???
***********************************
Set fs = CreateObject("Scripting.FileSystemObject"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer)
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem"
For Each objComputer in colSettings
compname = objComputer.Name
Next
>>>>>>>>ERROR CREATED BY NEXT STATEMENT<<<<
set tempfile = fs.CreateTextFile("\\Servername\public\GeneralFolder\"+compname+"Links.txt"
Set objWMIService = GetObject("winmgmts:\\" & compname & "\root\cimv2"
Set colItems = objWMIService.ExecQuery("Select * from Win32_ShortcutFile",,48)
For Each objItem in colItems
tempfile.writeline ("Name: " & objItem.Name)
tempfile.writeline("Target: " & objItem.Target)
tempfile.writeline(""
Next
msgbox("Finished. Thank you for your co-operation"
tempfile.close
WScript.quit
*****************************************
Permissions on the folder that the text file is written to are Everyone. We are using W2k Pro, but the server is WinNT4.0.
Could the error be caused by permissions? or the fact that everyone executed the script at about the same time, so access to the folder was denied?!?!
The funny thing is, apart from the error popping up, the script works as intended!?!?
Any info much appreciated! It was quite embarassing to send out a buggy script to everyone....
Danny
I sent out a script to everyone in my office to collect information about links stored on their computers then write the information to a textfile on the server. I created the script below and ran it and it seemed to work perfectly. But no sooner than I had distributed the scirpt, users started calling me asking why an error popped up. I investigated and this was the error code: "800A0046. Can not write to file."
However the script continues and works as intended. So I am wondering, why did the error occur and what does it mean???
***********************************
Set fs = CreateObject("Scripting.FileSystemObject"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer)
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem"
For Each objComputer in colSettings
compname = objComputer.Name
Next
>>>>>>>>ERROR CREATED BY NEXT STATEMENT<<<<
set tempfile = fs.CreateTextFile("\\Servername\public\GeneralFolder\"+compname+"Links.txt"
Set objWMIService = GetObject("winmgmts:\\" & compname & "\root\cimv2"
Set colItems = objWMIService.ExecQuery("Select * from Win32_ShortcutFile",,48)
For Each objItem in colItems
tempfile.writeline ("Name: " & objItem.Name)
tempfile.writeline("Target: " & objItem.Target)
tempfile.writeline(""
Next
msgbox("Finished. Thank you for your co-operation"
tempfile.close
WScript.quit
*****************************************
Permissions on the folder that the text file is written to are Everyone. We are using W2k Pro, but the server is WinNT4.0.
Could the error be caused by permissions? or the fact that everyone executed the script at about the same time, so access to the folder was denied?!?!
The funny thing is, apart from the error popping up, the script works as intended!?!?
Any info much appreciated! It was quite embarassing to send out a buggy script to everyone....
Danny