Hi all
I'm trying to set the permissions of a file using WMI, and since i'm
writing a windows service i want to use UNC paths doing this because
the destination might not be a mapped path. I'we been looking around
here at google and gotten the impression that it is not possible to
use UNC paths when working with WMI, is that really so? Or does anyone
know how how to set file permissions using a UNC path? I'we gotten to
work ok with a mapped path to a file on another computer, but if I
feed the same code with a UNC path instead i get a error back saying
"Not Found". Here is the code that works with a mapped path.
Note that this i VB.NET and only a part of the code.
The reason for using WMI instead of ADSI is that I want this to work
in a Novell enviorment as well, and I imagine that WMI can manage
that.
Dim FolderPath as string = Any mapped path
Dim objFile As New ManagementObjec t(New
ManagementPath( "Win32_Logicalf ileSecuritySett ing='" + _
FolderPath.Repl ace("\", "\\") + "'"))
Dim options As New InvokeMethodOpt ions(Nothing, New TimeSpan(0, 0, 0,
5))
Dim outparams As ManagementBaseO bject =
objFile.InvokeM ethod("GetSecur ityDescriptor", Nothing, options)
Console.Write(o bjFile.GetText( TextFormat.Mof) )
Another solution to my problem would be to do a temporary mapping the
the UNC path from withing my service. But if I do that it seams that
WMI does not get my temporary mapping. Can I make WMI to somehow
"reinit" itself so it gets the mapping i've made from the code.
Thanks
Johan 1 3986
Hi,
As far as I know, WMI can only work with "local" files, however "local"
can mean on a different box because you can connect to WMI on a
different box.
It's a pain if you want to create a process whos image (exe file)
resides on a different computer. Some 3rd party vendors take the
approach of copying the whole file to every remote computer.
Johan wrote: Hi all
I'm trying to set the permissions of a file using WMI, and since i'm writing a windows service i want to use UNC paths doing this because the destination might not be a mapped path. I'we been looking around here at google and gotten the impression that it is not possible to use UNC paths when working with WMI, is that really so? Or does anyone know how how to set file permissions using a UNC path? I'we gotten to work ok with a mapped path to a file on another computer, but if I feed the same code with a UNC path instead i get a error back saying "Not Found". Here is the code that works with a mapped path. Note that this i VB.NET and only a part of the code.
The reason for using WMI instead of ADSI is that I want this to work in a Novell enviorment as well, and I imagine that WMI can manage that.
Dim FolderPath as string = Any mapped path Dim objFile As New ManagementObjec t(New ManagementPath( "Win32_Logicalf ileSecuritySett ing='" + _ FolderPath.Repl ace("\", "\\") + "'")) Dim options As New InvokeMethodOpt ions(Nothing, New TimeSpan(0, 0, 0, 5)) Dim outparams As ManagementBaseO bject = objFile.InvokeM ethod("GetSecur ityDescriptor", Nothing, options)
Console.Write(o bjFile.GetText( TextFormat.Mof) )
Another solution to my problem would be to do a temporary mapping the the UNC path from withing my service. But if I do that it seams that WMI does not get my temporary mapping. Can I make WMI to somehow "reinit" itself so it gets the mapping i've made from the code.
Thanks Johan
--
Gerry Hickman (London UK) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: G. Richard Bellamy |
last post by:
I'm trying to unset the Encrypted attribute on all the files in a path.
The attribute is not getting set. What am I doing wrong?
Perhaps there's another newsgroup I can send this to?
Here's the code:
=============================================
using System;
|
by: John R. |
last post by:
How do you set the following file attributes:
Compressed
Encrypted
Normal
ReparsePoint
SparsePoint
You CAN'T set these using FileInfo.Attributes or File.SetAttributes. It
doesn't work for these file attributes.
|
by: Steve Yerkes |
last post by:
There seems to be way too much confusion over how to set focus on the a field using a field validator. I looked all over the web and found people trying to do this, but not getting anywhere. There are a couple of people selling components... but that is not really an option for me... So, I took the plunge and modified the "WebUIValidation.js" file to make it happen... After tracing through file, I figure it out. It was actually pretty...
|
by: phil campaigne |
last post by:
On Mon, 1 Mar 2004, phil campaigne wrote:
>> Nigel J. Andrews wrote:
>>
>
>
>>> >On Mon, 1 Mar 2004, Phil Campaigne wrote:
>>> >
>>> >
|
by: Sam |
last post by:
Hi all
I'm looking for a way to detect the background color of my internal webpage
through a stylesheet. And so far, the only solution I find is to open the
styles.css file and parse the BACKGROUND-COLOR field. The problem I'm
having is that I don't know the exact absolute path of the stylesheet file
(styles.css) to access it using stream reader. I have tried to use the
"Path.GetFullPath" method of the system.IO to get the absolute path...
| |
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting" setting to be
"E_ALL", notices are still not getting reported. The perms on my file
are 664, with owner root and group root. The php.ini file is located
at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem
to be having an effect? ...
|
by: dancer |
last post by:
Using ASP.net 1.1 and Microsoft Access.
I received the following error message. Why? I have closed the Access
file. I have another very small access file that opens with no trouble with
the same code, except a different name for the file.
The Microsoft Jet database engine cannot open the file
'C:\Inetpub\wwwroot\Accident.mdb'. It is already opened exclusively by
another user, or you need permission to view its data.
|
by: Steven Spits |
last post by:
Hi group,
I need to write a file in a network share automatically from within the
browser. I realise this is an uncommon scenario that would need some work on
the client side. The less the better ofcourse.
I was thinking about using embedded .NET user controls in IE (using OBJECT).
This would require installing .NET 2.0 runtime on the clients and grating
the assembly the required permissions to write the file.
|
by: nokia33948 |
last post by:
Hi there,
I am writing a VB.NET 2005 application that connects to an MySQL DB
(it could be MS SQL, one day...). One of the window forms contains a
gridview with some rows coming from a table on the DB, basically,
phisical addresses of contacts. I would like to implement a system to
grant/deny read/write permissions on specific rows, so that if the
user, after the log in, has got the necessay privileges he actually
can see/modify some...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |