Folks,
Not sure if this is the correct forum for this posting, but I'm banging by
head against the wall, I have been trying to use my WSH scripts in vb. net
environment but not having much joy. The script is to create a shared folder
and set permission. I have added all referneces to WSH and WMI refernce in
VS2005. Can anyone tell me what changes do I need to make to the below code
to work in VB.NET? or even direct me to code for creating remote shares and
set permission in vb.net, I'm amazed at how diffcult it is to get vb.net code
to do such a simple thing!!! This code works fine in VBA environment such
Access that I'm currently running in.
Set WshNetwork = CreateObject("WScript.Network")
Set objFS = CreateObject("Scripting.FileSystemObject")
' creating the folder on a remote machine
Set objWMIService = GetObject _
("winmgmts:\\" & strServerName & "\root\cimv2:Win32_Process")
errReturn = objWMIService.Create _
("cmd.exe /cmd " & strFullPath & "", Null, Null, intProcessID)
' setting the sharing of a folder
Const FILE_SHARE = 0
Const MAXIMUM_CONNECTIONS = 25
Set objWMIService = GetObject _
("winmgmts:\\" & strServerName & "\root\cimv2")
Set objNewShare = objWMIService.Get("Win32_Share")
strShareName = strGCN & "$"
errReturn = objNewShare.Create("" & strFullPath & "", "" & strShareName &
"", FILE_SHARE, MAXIMUM_CONNECTIONS, "X Drive")
Call WshShell.Run("cacls " & USER_ROOT_UNC & " /e /g CS SysAdmin:F",
HIDE_WINDOW, WAIT_ON_RETURN)
Call WshShell.Run("cacls " & USER_ROOT_UNC & " /e /g " & strUser & ":C",
HIDE_WINDOW, WAIT_ON_RETURN) 3 5525
On Mon, 20 Aug 2007 04:34:08 -0700, Liam Mac
<Li*****@discussions.microsoft.comwrote:
>Folks,
Not sure if this is the correct forum for this posting, but I'm banging by head against the wall, I have been trying to use my WSH scripts in vb. net environment but not having much joy. The script is to create a shared folder and set permission. I have added all referneces to WSH and WMI refernce in VS2005. Can anyone tell me what changes do I need to make to the below code to work in VB.NET? or even direct me to code for creating remote shares and set permission in vb.net, I'm amazed at how diffcult it is to get vb.net code to do such a simple thing!!! This code works fine in VBA environment such Access that I'm currently running in.
Set WshNetwork = CreateObject("WScript.Network") Set objFS = CreateObject("Scripting.FileSystemObject")
' creating the folder on a remote machine
Set objWMIService = GetObject _
("winmgmts:\\" & strServerName & "\root\cimv2:Win32_Process") errReturn = objWMIService.Create _
("cmd.exe /cmd " & strFullPath & "", Null, Null, intProcessID)
' setting the sharing of a folder
Const FILE_SHARE = 0 Const MAXIMUM_CONNECTIONS = 25
Set objWMIService = GetObject _
("winmgmts:\\" & strServerName & "\root\cimv2")
Set objNewShare = objWMIService.Get("Win32_Share") strShareName = strGCN & "$" errReturn = objNewShare.Create("" & strFullPath & "", "" & strShareName & "", FILE_SHARE, MAXIMUM_CONNECTIONS, "X Drive")
Call WshShell.Run("cacls " & USER_ROOT_UNC & " /e /g CS SysAdmin:F", HIDE_WINDOW, WAIT_ON_RETURN) Call WshShell.Run("cacls " & USER_ROOT_UNC & " /e /g " & strUser & ":C", HIDE_WINDOW, WAIT_ON_RETURN)
Personally I would use windows scripting host as a last resort,
because almost all anti viruses will block it right from the start.
What anti virus do you use?
-- http://bytes.thinkersroom.com
Hi
We have Mcafee anti-virus, but it doesn't seem to have a problem...
"Rad [Visual C# MVP]" wrote:
On Mon, 20 Aug 2007 04:34:08 -0700, Liam Mac
<Li*****@discussions.microsoft.comwrote:
Folks,
Not sure if this is the correct forum for this posting, but I'm banging by
head against the wall, I have been trying to use my WSH scripts in vb. net
environment but not having much joy. The script is to create a shared folder
and set permission. I have added all referneces to WSH and WMI refernce in
VS2005. Can anyone tell me what changes do I need to make to the below code
to work in VB.NET? or even direct me to code for creating remote shares and
set permission in vb.net, I'm amazed at how diffcult it is to get vb.net code
to do such a simple thing!!! This code works fine in VBA environment such
Access that I'm currently running in.
Set WshNetwork = CreateObject("WScript.Network")
Set objFS = CreateObject("Scripting.FileSystemObject")
' creating the folder on a remote machine
Set objWMIService = GetObject _
("winmgmts:\\" & strServerName & "\root\cimv2:Win32_Process")
errReturn = objWMIService.Create _
("cmd.exe /cmd " & strFullPath & "", Null, Null, intProcessID)
' setting the sharing of a folder
Const FILE_SHARE = 0
Const MAXIMUM_CONNECTIONS = 25
Set objWMIService = GetObject _
("winmgmts:\\" & strServerName & "\root\cimv2")
Set objNewShare = objWMIService.Get("Win32_Share")
strShareName = strGCN & "$"
errReturn = objNewShare.Create("" & strFullPath & "", "" & strShareName &
"", FILE_SHARE, MAXIMUM_CONNECTIONS, "X Drive")
Call WshShell.Run("cacls " & USER_ROOT_UNC & " /e /g CS SysAdmin:F",
HIDE_WINDOW, WAIT_ON_RETURN)
Call WshShell.Run("cacls " & USER_ROOT_UNC & " /e /g " & strUser & ":C",
HIDE_WINDOW, WAIT_ON_RETURN)
Personally I would use windows scripting host as a last resort,
because almost all anti viruses will block it right from the start.
What anti virus do you use?
-- http://bytes.thinkersroom.com
"Rad [Visual C# MVP]" wrote:
On Mon, 20 Aug 2007 04:34:08 -0700, Liam Mac
<Li*****@discussions.microsoft.comwrote:
Folks,
Not sure if this is the correct forum for this posting, but I'm banging by
head against the wall, I have been trying to use my WSH scripts in vb. net
environment but not having much joy. The script is to create a shared folder
and set permission. I have added all referneces to WSH and WMI refernce in
VS2005. Can anyone tell me what changes do I need to make to the below code
to work in VB.NET? or even direct me to code for creating remote shares and
set permission in vb.net, I'm amazed at how diffcult it is to get vb.net code
to do such a simple thing!!! This code works fine in VBA environment such
Access that I'm currently running in.
Set WshNetwork = CreateObject("WScript.Network")
Set objFS = CreateObject("Scripting.FileSystemObject")
' creating the folder on a remote machine
Set objWMIService = GetObject _
("winmgmts:\\" & strServerName & "\root\cimv2:Win32_Process")
errReturn = objWMIService.Create _
("cmd.exe /cmd " & strFullPath & "", Null, Null, intProcessID)
' setting the sharing of a folder
Const FILE_SHARE = 0
Const MAXIMUM_CONNECTIONS = 25
Set objWMIService = GetObject _
("winmgmts:\\" & strServerName & "\root\cimv2")
Set objNewShare = objWMIService.Get("Win32_Share")
strShareName = strGCN & "$"
errReturn = objNewShare.Create("" & strFullPath & "", "" & strShareName &
"", FILE_SHARE, MAXIMUM_CONNECTIONS, "X Drive")
Call WshShell.Run("cacls " & USER_ROOT_UNC & " /e /g CS SysAdmin:F",
HIDE_WINDOW, WAIT_ON_RETURN)
Call WshShell.Run("cacls " & USER_ROOT_UNC & " /e /g " & strUser & ":C",
HIDE_WINDOW, WAIT_ON_RETURN)
Personally I would use windows scripting host as a last resort,
because almost all anti viruses will block it right from the start.
What anti virus do you use?
-- http://bytes.thinkersroom.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Adam |
last post by:
I have an application which interacts with a webserver over https
using client certificates.
Due to a bug in openssl 0.9.6, I upgraded to 0.9.7 and rebuilt python.
Now, when I access the page...
|
by: Jeff Wagner |
last post by:
I have a project of converting numerous DOS cmd shell scripts to Python. Is there a tutorial to
getting started?
Thanks, Jeff
|
by: Stumped and Confused |
last post by:
Hello,
I really, really, need some help here - I've spent hours trying to find a
solution.
In a nutshell, I'm trying to have a user input a value in form's
textfield. The value should then be...
|
by: volantecho |
last post by:
hi,
i m using webmin to create a cron job of a php script. While i click on
'run it now', it works, generate the output. However, the php script
doesnt execute for every minutes which i've set...
|
by: doomx |
last post by:
I'm using SQL scripts to create and alter tables in my DB
I want to know if it's possible to fill the description(like in the
Create table UI) using these scripts.
EX:
CREATE TABLE(...
|
by: fred_mumble |
last post by:
I have been testing various techniques to run "script" code which will
be stored in a SQL database and executed dynamically at runtime. The
scripts are essentially business rules that result in a...
|
by: Flip |
last post by:
I have a website that's using Master pages (very cool). But when I put JS
on there (to close the browser for example) coming from an external file,
when I navigate away from the first page, the JS...
|
by: Milsnips |
last post by:
hi there,
i'm currently using the following line:
<script language="javascript" type="text/javascript"
src="../scripts/timer.js"></script>
but i want to do the following, as the script...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Uploading files from a local computer to a remote web server has many useful purposes, the most...
|
by: raghutumma |
last post by:
Hi,
How can we execute SQL Scripts using Batch file???
i think Batch file should contain Username,Password,Database and
Scripts...
Using that file scripts should run...
How can i give...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
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...
| |