Jump to content

Example of share folder on a remote computer


Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...