Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 2377214 - Last Review: August 18, 2010 - Revision: 1.0
CIM_DataFile class may ignore permissions when run remotely
When using
CIM_DataFile from WMI, you may notice differences in behavior when running locally versus remotely. Specifically, permissions will be handled differently when run remotely. An example scenario would be that of an Administrator that does not have full access to a file location, specifically being denied DELETE rights. Below is an example script that uses
CIM_DataFile to rename a file:
strComputer = WScript.Arguments(0)
strFile = WScript.Arguments(1)Set objWMIService = GetObject _   ("winmgmts:" & "!\\" & strComputer & "\root\cimv2")Set colFiles = objWMIService.ExecQuery _   ("Select * from CIM_DataFile where Name = " _       & "'c:\\" + strFile + "'")For Each objFile in colFiles   errResult = objFile.Rename("c:\" + strFile + ".old")NextIf this script example is run locally, access will be denied as expected. However, if the same script is run remotely, the delete or rename operation will succeed, which is not expected.
This behavior is by design. The remote procedure uses the Backup\Restore privilege to carry out the function, which bypasses the administrator privileges.
NOTE: An Administrator can always delete or rename files with different methods, even if he is not the owner of the files, or does not explicitly have the rights to do so. Administrators and programmers should take care when using this function on remote machines, as it may end in files being renamed or deleted which should, from the user rights perspective, not be touched.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See
Terms of Use
(http://go.microsoft.com/fwlink/?LinkId=151500)
for other considerations.
APPLIES TO
- Microsoft Windows XP Service Pack 3
- Microsoft Windows Server 2003 Service Pack 1
- Microsoft Windows Server 2003 Service Pack 2
- Microsoft Windows XP Service Pack 1
- Microsoft Windows XP Service Pack 2
- Windows Vista Service Pack 1
- Windows Vista Service Pack 2
- Windows Server 2008 Service Pack 2
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate