Jump to content
Sign in to follow this  
Werbes

Example of share folder on a remote computer

Recommended Posts

Werbes

Hi,

I have not access to the example scripts site muttley - så i post my example here :-)

Func ShareRemoteFolder($Computer, $FolderToShare, $ShareName, $ShareDesc)
    if FileExists(@TempDir & "\ShRmFl.vbs") Then
        FileDelete(@TempDir & "\ShRmFl.vbs")
    EndIf
    FileWriteLine(@TempDir & "\ShRmFl.vbs", 'Set objWMIService = GetObject ("winmgmts:\\' & $Computer & '\root\cimv2")' & @crlf & 'Set objNewShare = objWMIService.Get("Win32_Share")' & @CRLF & 'errReturn = objNewShare.Create ("' & $FolderToShare & '", "' & $ShareName & '", 0, 1000, "' & $ShareDesc &'.")' & @crlf)
    RunWait(@ComSpec & " /c " & "cscript " & @TempDir & "\ShRmFl.vbs")
EndFunc

/Emil

Share this post


Link to post
Share on other sites
d3mon

Hi,

I have not access to the example scripts site muttley - så i post my example here :-)

Func ShareRemoteFolder($Computer, $FolderToShare, $ShareName, $ShareDesc)
    if FileExists(@TempDir & "\ShRmFl.vbs") Then
        FileDelete(@TempDir & "\ShRmFl.vbs")
    EndIf
    FileWriteLine(@TempDir & "\ShRmFl.vbs", 'Set objWMIService = GetObject ("winmgmts:\\' & $Computer & '\root\cimv2")' & @crlf & 'Set objNewShare = objWMIService.Get("Win32_Share")' & @CRLF & 'errReturn = objNewShare.Create ("' & $FolderToShare & '", "' & $ShareName & '", 0, 1000, "' & $ShareDesc &'.")' & @crlf)
    RunWait(@ComSpec & " /c " & "cscript " & @TempDir & "\ShRmFl.vbs")
EndFunc

/Emil

If you have access here and not exemple script....perhaps you use explorer haha use firefox or go to this link : http://www.autoitscript.com/forum/index.php?showforum=9


No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.