Welcome to Scripting Forums Sign in | Join | Help
in Search

Pushing the values back into the share

Last post 09-10-2008, 10:10 PM by AbqBill. 1 replies.
Sort Posts: Previous Next
  •  07-22-2008, 7:06 PM 29882

    Pushing the values back into the share

    Hi All,

    I wrote a small script to get some properties of a share like Name, Description etc

    On Error Resume Next
     Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
       Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Share")

    For Each objItem In colItems
    WScript.Echo "Name: " & objItem.Name
     WScript.Echo "Description: " & objItem.Description
    Next


    Now I have a new description for each share. How do I push that back into that share? I have all the descriptions in an excel file. I can do the Excel initiation but I just wanted to know the way we push it back.

     I am assuming we can use PUT method. But I am not sure. Any help appreciated.

     Thanks

  •  09-10-2008, 10:10 PM 30054 in reply to 29882

    Re: Pushing the values back into the share

    Hi kalcee,

    The quickest way that I could think of off the top of my head was to do this using ADSI; e.g.:

    share = GetObject("WinNT://./LanmanServer/ShareName")
    share.Description = "Updated description"
    share.SetInfo()

    Microsoft KB article 234234 also provides some more information.

    Bill

View as RSS news feed in XML
SPONSORED LINKS FEATURED LINKS

Maximize speed, performance and reliablity of your PCs and servers—automatically!Speed Up Your PC! Try Diskeeper 2008 with InvisiTasking Free Now! Microsoft Learning Snack - Green IT Through Virtualization Many organizations face rising operating costs caused by excessive energy consumption. Virtualization and "Green IT" can help cut these costs. Get the information you need to bring Green IT savings to your business. Order Your Fundamentals CD Today!Register today for your in-depth copy of one of three Fundamental CDs on the following topics – Exchange, SQL, and SharePoint. Microsoft Learning Snack - Virtualization With Windows Server 2008Windows Server 2008 includes virtualization technology that allows many operating systems - including open source - to run on a single host. Come learn the basics of implementing these features. Microsoft Learning Snack - Virtualization BasicsWith virtualization, computing components essentially become on-demand services, freeing each element of a system from the others. This short video explains the needs, benefits, and technologies behind virtualization. Microsoft Learning Snack - Virtualization BasicsWith virtualization, computing components essentially become on-demand services, freeing each element of a system from the others. This short video explains the needs, benefits, and technologies behind virtualization. Microsoft Learning Snack - Virtualization With Windows Server 2008Windows Server 2008 includes virtualization technology that allows many operating systems - including open source - to run on a single host. Come learn the basics of implementing these features. Empower Your Processes with PowerShell 201Paul Robichaux delves deep into PowerShell how-tos in 3 informative lessons, each followed by live Q&A—all on your own computer! Register today! Microsoft Learning Snack - Green IT Through VirtualizationMany organizations face rising operating costs caused by excessive energy consumption. Virtualization and "Green IT" can help cut these costs. Get the information you need to bring Green IT savings to your business. New Release: Windows IT Pro Master CD13 years of content archives, fast answers with advanced search tools, and full access to WindowsITPro.com—order today!

 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing