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

Free Download –VS 2008 TrainingExperts Ken Getz & Robert Green plus labs, code, courseware Maximize speed, performance and reliablity of your PCs and servers—automatically!Speed Up Your PC! Try Diskeeper 2008 with InvisiTasking Free Now! Register for SolarWinds VM MonitorGet X-Ray Vision into Your ESX Servers with SolarWinds FREE VM Monitor GoGrid Offers FREE Trial for Windows Cloud ServersDeploy Windows Server 2003 and 2008 with free load balancing through GoGrid’s award winning web-based GUI – all in less than 5 minutes Order Your SQL Fundamentals CD Today! Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD. How healthy is your Exchange Server? Find out Now!Automatic Exchange Server Maintenance helps prevent disasters and improves performance. Download a FREE Exchange Server analysis tool. You've Deployed SharePoint...Now What?This one-day free online conference delivers the technical knowledge needed to kick MOSS up a notch. In one information-packed day, independent SharePoint experts will present practical, real-world information and provide take-away, ready-to-use solutions Ease Your Scripting Pains with the Flexibility of PowerShell!Paul Robichaux equips you with PowerShell basics in 3 introductory lessons, each followed by live Q&A—all on your own computer! Register today! What Would You Do If You Ran Microsoft?ITTV's 2008 inaugural video contest, "If I Ran Microsoft..." is your chance to tell it like it is. Be goofy or be serious, but don"t miss this chance to have fun, win prizes, and go viral in a major way. Maximize Your SharePoint InvestmentThis web seminar discusses how true bi-directional replication of SharePoint content from one server to another enables branch offices to maintain access to current SharePoint content. Rock Your Knowledge, and Compete with Friends and Colleagues!Are you the Web Application Performance Guru in your office? It's time to have fun! Download now to access the crossword puzzle. Challenge yourself and complete this fun activity!

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