![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Query folder backup operator Hi, I need to write a vbscript to list each file in a windows xp machine. I made a vbscript using filesystemobject, but I obtain a "Permission denied" when the folder has access permission only for the owner. I execute the script using the SYSTEM, or an administrator user, but I had the same error. Searching on Internet I've found that if the program use the backup operator permissions, it would be able to access the folder content, but my vbscript isn't able to access. On the other hand, testing the robocopy resource kit application I've notice that robocopy is able to access the folder. I've use the processmonitor application (http://technet.microsoft.com/ en-us/sysinternals/bb896645.aspx) to compare the system calls used by robocopy and my vbscript. The difference is that robocopy calls createfile win32 function using a "open for backup" option, but my vbscript doesn't do it. Does anybody know if I could write a vbscript, using filesystemobject or other mechanism, to access a folder using “open for backup” option?. Thank you very much for your help. Regards. Juan |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Query folder backup operator "Juan" <jvaleromtnez@xxxxxx> wrote in message news:b93de9e4-a048-49c1-bf7a-deb791fd3874@xxxxxx Hi, I need to write a vbscript to list each file in a windows xp machine. I made a vbscript using filesystemobject, but I obtain a "Permission denied" when the folder has access permission only for the owner. I execute the script using the SYSTEM, or an administrator user, but I had the same error. Searching on Internet I've found that if the program use the backup operator permissions, it would be able to access the folder content, but my vbscript isn't able to access. On the other hand, testing the robocopy resource kit application I've notice that robocopy is able to access the folder. I've use the processmonitor application (http://technet.microsoft.com/ en-us/sysinternals/bb896645.aspx) to compare the system calls used by robocopy and my vbscript. The difference is that robocopy calls createfile win32 function using a "open for backup" option, but my vbscript doesn't do it. Does anybody know if I could write a vbscript, using filesystemobject or other mechanism, to access a folder using “open for backup” option?. Thank you very much for your help. Regards. Juan =================== Sorry, can't tell without seeing the code and knowing which line generates the error message. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Query folder backup operator On 28 abr, 11:53, "Pegasus [MVP]" <n...@xxxxxx> wrote: Quote: > "Juan" <jvaleromt...@xxxxxx> wrote in message > > news:b93de9e4-a048-49c1-bf7a-deb791fd3874@xxxxxx > Hi, > > I need to write a vbscript to list each file in a windows xp machine. > I made a vbscript using filesystemobject, but I obtain a "Permission > denied" when the folder has access permission only for the owner. > > I execute the script using the SYSTEM, or an administrator user, but I > had the same error. > > Searching on Internet I've found that if the program use the backup > operator permissions, it would be able to access the folder content, > but my vbscript isn't able to access. On the other hand, testing the > robocopy resource kit application I've notice that robocopy is able to > access the folder. > > I've use the processmonitor application (http://technet.microsoft.com/ > en-us/sysinternals/bb896645.aspx) to compare the system calls used by > robocopy and my vbscript. The difference is that robocopy calls > createfile win32 function using a "open for backup" option, but my > vbscript doesn't do it. > > Does anybody know if I could write a vbscript, using filesystemobject > or other mechanism, to access a folder using “open for backup” > option?. > > Thank you very much for your help. > > Regards. > > Juan > =================== > Sorry, can't tell without seeing the code and knowing which line generates > the error message. Hi, Here you have the sample I use: Set FSO = CreateObject ("Scripting.FileSystemObject") strDir = "e:\hpadmin" Set objDir = FSO.GetFolder(strDir) getInfo(objDir) Sub getInfo(pCurrentDir) For Each aItem In pCurrentDir.Files wscript.Echo aItem.Name Next For Each aItem In pCurrentDir.SubFolders getInfo(aItem) Next End Sub Error message "Permission denied" is throw in the "For Each aItem In pCurrentDir.Files" sentence. Could you help me? I really appreciate your help. Regards Juan. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Query folder backup operator "Juan" <jvaleromtnez@xxxxxx> wrote in message news:5da535b6-8758-405b-a4a2-e3204e192b18@xxxxxx On 28 abr, 11:53, "Pegasus [MVP]" <n...@xxxxxx> wrote: Quote: > "Juan" <jvaleromt...@xxxxxx> wrote in message > > news:b93de9e4-a048-49c1-bf7a-deb791fd3874@xxxxxx > Hi, > > I need to write a vbscript to list each file in a windows xp machine. > I made a vbscript using filesystemobject, but I obtain a "Permission > denied" when the folder has access permission only for the owner. > > I execute the script using the SYSTEM, or an administrator user, but I > had the same error. > > Searching on Internet I've found that if the program use the backup > operator permissions, it would be able to access the folder content, > but my vbscript isn't able to access. On the other hand, testing the > robocopy resource kit application I've notice that robocopy is able to > access the folder. > > I've use the processmonitor application (http://technet.microsoft.com/ > en-us/sysinternals/bb896645.aspx) to compare the system calls used by > robocopy and my vbscript. The difference is that robocopy calls > createfile win32 function using a "open for backup" option, but my > vbscript doesn't do it. > > Does anybody know if I could write a vbscript, using filesystemobject > or other mechanism, to access a folder using “open for backup” > option?. > > Thank you very much for your help. > > Regards. > > Juan > =================== > Sorry, can't tell without seeing the code and knowing which line generates > the error message. Hi, Here you have the sample I use: Set FSO = CreateObject ("Scripting.FileSystemObject") strDir = "e:\hpadmin" Set objDir = FSO.GetFolder(strDir) getInfo(objDir) Sub getInfo(pCurrentDir) For Each aItem In pCurrentDir.Files wscript.Echo aItem.Name Next For Each aItem In pCurrentDir.SubFolders getInfo(aItem) Next End Sub Error message "Permission denied" is throw in the "For Each aItem In pCurrentDir.Files" sentence. Could you help me? I really appreciate your help. Regards Juan. =============== I tested your script as it is and it worked perfectly. Perhaps you have a protected file or folder inside "e:\hpadmin". I could get it to fail if I allowed it to examine the folder "System Volume Information", which is a protected folder. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Query folder backup operator On 28 abr, 15:47, "Pegasus [MVP]" <n...@xxxxxx> wrote: Quote: > "Juan" <jvaleromt...@xxxxxx> wrote in message > > news:5da535b6-8758-405b-a4a2-e3204e192b18@xxxxxx > On 28 abr, 11:53, "Pegasus [MVP]" <n...@xxxxxx> wrote: > > > > > Quote: > > "Juan" <jvaleromt...@xxxxxx> wrote in message Quote: > >news:b93de9e4-a048-49c1-bf7a-deb791fd3874@xxxxxx > > Hi, Quote: > > I need to write a vbscript to list each file in a windows xp machine. > > I made a vbscript using filesystemobject, but I obtain a "Permission > > denied" when the folder has access permission only for the owner. Quote: > > I execute the script using the SYSTEM, or an administrator user, but I > > had the same error. Quote: > > Searching on Internet I've found that if the program use the backup > > operator permissions, it would be able to access the folder content, > > but my vbscript isn't able to access. On the other hand, testing the > > robocopy resource kit application I've notice that robocopy is able to > > access the folder. Quote: > > I've use the processmonitor application (http://technet.microsoft.com/ > > en-us/sysinternals/bb896645.aspx) to compare the system calls used by > > robocopy and my vbscript. The difference is that robocopy calls > > createfile win32 function using a "open for backup" option, but my > > vbscript doesn't do it. Quote: > > Does anybody know if I could write a vbscript, using filesystemobject > > or other mechanism, to access a folder using “open for backup” > > option?. Quote: > > Thank you very much for your help. Quote: > > Regards. Quote: > > Juan > > =================== > > Sorry, can't tell without seeing the code and knowing which line generates > > the error message. > Hi, > > Here you have the sample I use: > > Set FSO = CreateObject ("Scripting.FileSystemObject") > strDir = "e:\hpadmin" > Set objDir = FSO.GetFolder(strDir) > getInfo(objDir) > > Sub getInfo(pCurrentDir) > For Each aItem In pCurrentDir.Files > wscript.Echo aItem.Name > Next > > For Each aItem In pCurrentDir.SubFolders > * *getInfo(aItem) > Next > End Sub > > Error message "Permission denied" is throw in the "For Each aItem In > pCurrentDir.Files" sentence. > > Could you help me? > > I really appreciate your help. > > Regards > > Juan. > > =============== > > I tested your script as it is and it worked perfectly. Perhaps you have a > protected file or folder inside "e:\hpadmin". I could get it to fail if I > allowed it to examine the folder "System Volume Information", which is a > protected folder.- Ocultar texto de la cita - > > - Mostrar texto de la cita - I know that the script works fine, but, as you say, my problem is with the protected folders. I need to access every file in the computer, regardless of the folder permissions. As I said in my previous message, if I used the robocopy resource kil application, I could access the folder content. I only need to list every files, I don't need to access the file content. Using the processmonitor application, I've noticed that robocopy access the folder using the "open for backup" option. My question is... Could I use the "open for backup" option in a vbscript? How could I specify this option?. Again, thank you very much for your help. Regards |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Query folder backup operator "Juan" <jvaleromtnez@xxxxxx> wrote in message news:2ae9a81a-e584-4cf5-8651-f670336f3378@xxxxxx Thank you again Pegasus. I know that the script works fine, but, as you say, my problem is with the protected folders. I need to access every file in the computer, regardless of the folder permissions. As I said in my previous message, if I used the robocopy resource kil application, I could access the folder content. I only need to list every files, I don't need to access the file content. Using the processmonitor application, I've noticed that robocopy access the folder using the "open for backup" option. My question is... Could I use the "open for backup" option in a vbscript? How could I specify this option?. Again, thank you very much for your help. Regards =================== WMI should be able to do it but I can't quite get it to work: Set oWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,(Backup)}!\\.\root\cimv2") Set oFolder = oWMIService.Get("Win32_Directory.Name='e:\System Volume Information'") RetCode = oFolder.copy("c:\Test") See also here: http://msdn.microsoft.com/en-us/libr...58(VS.85).aspx. Post again if/when you find the solution! |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Query folder backup operator On Apr 28, 11:40*pm, "Pegasus [MVP]" <n...@xxxxxx> wrote: Quote: > "Juan" <jvaleromt...@xxxxxx> wrote in message > > news:2ae9a81a-e584-4cf5-8651-f670336f3378@xxxxxx > > Thank you again Pegasus. > > I know that the script works fine, but, as you say, my problem is with > the protected folders. I need to access every file in the computer, > regardless of the folder permissions. As I said in my previous > message, if I used the robocopy resource kil application, I could > access the folder content. I only need to list every files, I don't > need to access the file content. > > Using the processmonitor application, I've noticed that robocopy > access the folder using the "open for backup" option. My question > is... Could I use the "open for backup" option in a vbscript? How > could I specify this option?. > > Again, thank you very much for your help. > > Regards > > =================== > > WMI should be able to do it but I can't quite get it to work: > > Set oWMIService = GetObject("winmgmts:" _ > * * & "{impersonationLevel=impersonate,(Backup)}!\\.\root\cimv2") > Set oFolder = oWMIService.Get("Win32_Directory.Name='e:\System Volume > Information'") > RetCode = oFolder.copy("c:\Test") > > See also here:http://msdn.microsoft.com/en-us/libr...58(VS.85).aspx. > Post again if/when you find the solution! script, I mean. the script must be executed with the lowest priority, so the user mustn't be concious that the script is running. If I used WMI, the query to search files (WQL) would be executed without the control of my script, so the query could take longer and influence the performance of the computer. Thank you very much for your help. If I found the solution, I would post it. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Does Vista Backup Backup The ITunes Folder? | Vista General | |||
| "Complete PC Backup" Query | Vista General | |||
| Query shared folder free space | PowerShell | |||
| Complete PC Backup Best Practice Query | Vista General | |||
| Vista Incremental backup Query : Home Premium Edition | Vista performance & maintenance | |||