View a Share Permission

Recently, I am being asked to come out with a script to read a share permissions and this can be achieved thru scripting with WMI…..:D
Below is a sample code to read permissions from a share folder named “Share$” from a computer called “ABC-D-1234″.
=====================================================
Dim strComputer
Dim strShareName
strComputer = “ABC-D-1234″
strShareName = “Share$”
ViewSharePermission strComputer, strShareName
Sub ViewSharePermission(vComputer, vShareName)
    Dim objWMIService  
    [...]

Posted at 7:26 am on December 7, 2007 | leave a comment | Filed Under: MS Windows | read on

Restart a service remotely

Just being asked by a few guys to have a script to restart a service remotely.
Below is the example of source code to restart a ”SMS Agent Host” service from a computer called “ABC-D-1234″ 
===================================================== 
Dim strComputer
Dim strServiceName 
strComputer = ”ABC-D-1234″
strServiceName =  ”CcmExec”
 ’// Stop Service  
StartWin32Service strComputer, strServiceName, False
 ’// Pause to allow service to stop  
Wscript.Sleep 5000
 ’// Start Service  
StartWin32Service strComputer, strServiceName, True
Sub StartWin32Service(vComputer, vServiceName, bStart)
    Dim [...]

Posted at 5:55 am on November 28, 2007 | leave a comment | Filed Under: MS Windows | read on

Categories