none
Share Sizes With Alternative Credentials

    Question

  • Here’s the challenge....

    I have been asked to create a script that gathers a list of network shares and their sizes on a given server. A brief search threw up this solution http://stackoverflow.com/questions/2589702/get-total-size-of-all-shared-folders-except-admin-shares-from-a-list-of-server

    This solution works in some cases (albeit a bit slow) but I have the added challenge that I want to run the machine with alternative credentials. The machine running the script is on a Workgroup machine and will be run against a range of servers on different domains and some in a workgroup. The problem with the above script is that there doesn’t appear to be a –Credential option for Get-ChildItem, which means I get access denied related messages.

    Can anyone offer advice on how to solve this problem?

    Monday, February 18, 2013 9:21 PM

Answers

  • Get -WmiObject Win32_Share -computer somepc -credential

    You can only use admin credentials to do this.


    ¯\_(ツ)_/¯

    Monday, February 18, 2013 9:56 PM
  • Get -WmiObject Win32_Share -computer somepc -credential

    You can only use admin credentials to do this.


    ¯\_(ツ)_/¯

    This probably will not help as WMI just gets the share names, not the size of the share. ALso, you can't run Get-WMIobject on a local machine specifying credentials. Not sure if that was your intention or not, just saying!

    Thomas Lee <DoctorDNS@Gmail.Com>

    Sunday, February 24, 2013 10:39 AM
    Moderator
  • The idea is to get the shares and the underlying folder.  Then we use the file system to get the size.  The suggestion was to show how to get the share names.

    Getting the size would depend on mapping a drive or the IPC share with admin credentials then Get-CildItem would work.

    I think the question has been abandoned.


    ¯\_(ツ)_/¯

    Sunday, February 24, 2013 10:52 AM

All replies

  • Get -WmiObject Win32_Share -computer somepc -credential

    You can only use admin credentials to do this.


    ¯\_(ツ)_/¯

    Monday, February 18, 2013 9:56 PM
  • Get -WmiObject Win32_Share -computer somepc -credential

    You can only use admin credentials to do this.


    ¯\_(ツ)_/¯

    This probably will not help as WMI just gets the share names, not the size of the share. ALso, you can't run Get-WMIobject on a local machine specifying credentials. Not sure if that was your intention or not, just saying!

    Thomas Lee <DoctorDNS@Gmail.Com>

    Sunday, February 24, 2013 10:39 AM
    Moderator
  • The idea is to get the shares and the underlying folder.  Then we use the file system to get the size.  The suggestion was to show how to get the share names.

    Getting the size would depend on mapping a drive or the IPC share with admin credentials then Get-CildItem would work.

    I think the question has been abandoned.


    ¯\_(ツ)_/¯

    Sunday, February 24, 2013 10:52 AM