473,385 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

WMI and permissions on a shared directory

Hi everybody,

I need to remove access to a shared directory before to execute a
process on the directory.
And put back the access on it after the execution.

So I wanted to set the permission of the Everyone user to Deny, execute
my process, and restore the permission to Allow.

There is the NET SHARE command, but it's to create or delete a share.
We don't have the RMTSHARE.exe tool and we cannot install another tool.

I readed some things about WMI and csharp but I never see an exemple
with the permisson on a share.
There are a lot of things about the permission about the folder, but I
want just the share.

So, I wanted to use WMI. I saw exemple to create a new permission or
delete one, but I cannot read the permission on the share.

Maybe somebody has some exemple to help me.

I use Visual Studio 2005 (and the framework 2.0). And the share is on a
win 2003 server.

Thanks in advance
Jerome

Dec 13 '06 #1
1 4432
"Jerome" <je***********@belgacom.bewrote in message
news:11*********************@f1g2000cwa.googlegrou ps.com...
Hi everybody,

I need to remove access to a shared directory before to execute a
process on the directory.
And put back the access on it after the execution.

So I wanted to set the permission of the Everyone user to Deny, execute
my process, and restore the permission to Allow.

There is the NET SHARE command, but it's to create or delete a share.
We don't have the RMTSHARE.exe tool and we cannot install another tool.

I readed some things about WMI and csharp but I never see an exemple
with the permisson on a share.
There are a lot of things about the permission about the folder, but I
want just the share.

So, I wanted to use WMI. I saw exemple to create a new permission or
delete one, but I cannot read the permission on the share.

Maybe somebody has some exemple to help me.

I use Visual Studio 2005 (and the framework 2.0). And the share is on a
win 2003 server.

Thanks in advance
Jerome
You can't modify the sharing permissions on an existing share, you can only "set" the
permissions when you create the share. So, basically what you should do is delete the share
and re-create it with the wanted permissions.

net share <sharename/delete
net share <sharename>=c:\somepath /user:onlyme,full
....run your application...
net share <sharename/delete
net share <sharename>=c:\somepath /everyone,full

Note that you need to make sure there are no existing sessions with the share before you
delete the share and you'll need administrative privileges to do so.

Willy.

Dec 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Shelly | last post by:
I have a new server and I have my files up there. The files are in /var/www/html/. In this directory I have another directory that I created called "users". I am unable to figure out how to set...
2
by: Alex | last post by:
I have a web application hosted on the server's F:\www directory. I have images stored on the file system at E:\Images. I have the website shared thru IIS pointing to the F:\www directory. 1.)...
5
by: JR | last post by:
Here's the scenerio: HAD: Entire Windows 2000 domain multiple servers Internal Web Server - Windows 2000 NAS Server - Windows 2000 Internal Web Application (On Web server) utilizing .ASP...
0
by: JR | last post by:
Here's the scenerio: HAD: Entire Windows 2000 domain multiple servers Internal Web Server - Windows 2000 NAS Server - Windows 2000 Internal Web Application (On Web server) utilizing .ASP...
2
by: skinnybloke | last post by:
Hi - I have a file permissions problem with PHP. I am using a product called Actinic to develop a shopping cart. This creates a subfolder named ACATALOG into which it loads all of its files. The...
1
by: jmurphy95 | last post by:
Hi there, I have a Windows application that I'm running from a shared drive that needs to access file/directory resources on other drives. I've done a lot of reading, but a lot of the material...
2
by: helloitsme | last post by:
Hello! How can we find out the sharing/access permissions of a directory ? Like, i need to know if a given directory is shared as readonly or with full access? I guess we can use...
30
by: Adam Baker | last post by:
Hello, I'm writing a site where a handful of people will be able to edit the content using PHP scripts (FCKeditor). The content is stored as individual files in a directory. I'd like to validate...
13
by: eclipsme | last post by:
I thought I had this licked, but apparently not. I have a file upload script that attempts to upload a file to a directory in the public_html directory - www.domain.com/upload The permissions...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.