[windows2000] Re: Is there a tool to strip the comments field from W2K shares?

  • From: Jeff Malczewski <jeff.malczewski@xxxxxxxxx>
  • To: windows2000@xxxxxxxxxxxxx
  • Date: Thu, 30 Sep 2004 15:31:29 -0400

Angus - Chris has a very good point there..  I would indeed do a
little homework on it, if for no other reason than self-improvement.. 
But, if you want the short version, I can tell you what it does...

strComputer = "."
This line sets the computer to work on to the local machine

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
This line connects to the windows management (WMI) database..

Set colShares = objWMIService.ExecQuery("SELECT * FROM Win32_Share")
This line is a simple SQL statement that gets a list of your shares
contained in Win32_Share

For each objShare in colShares
This line walks through each entry that was returned above and
executes the following commands on each one

    errReturn = objShare.SetShareInfo(,"")
This line is the line that actually removes the description. 
SetShareInfo supports two parameters (separated by a comma).  The
first parameter is the number of concurrent connections.  Since you
mentioned nothing about wanting to change this field, I left this
parameter out, effectively not changing whatever was there.  The
second portion, after the comma (""), is the description field.  If
you were to change this to "sharepoint" then it would make all the
descriptions read "sharepoint"

This line is the end of the for...next loop that was begun a couple lines up.


On Thu, 30 Sep 2004 12:08:06 -0700, Chris Berry
<chris_berry-list-windows2000@xxxxxxxxxxxxxxxxx> wrote:
> Angus Macdonald wrote:
> > Excellent! I don't understand a single bit of it but I'm prepapred to give
> > it a go!
> As a responsible admin you should never implement scripts from a mailing
> list if you don't have at least a general idea of what the code does.
> Spend a few hours googling around to work out the commands and syntax
> before you use it.
> --
> Chris Berry
> chris_berry@xxxxxxxxxxxxxxxxx
> Systems Administrator
> JM Associates & Coast Business Service
> "This message written on our state-of-the-art beowulf cluster of
> nitrogen cooled, overclocked C64's"
This Weeks Sponsor StressedPuppy.com Games
Feeling stressed out? Check out our games to
relieve your stress.
To Unsubscribe, set digest or vacation
mode or view archives use the below link.


Other related posts: