# Getting volume on all machines on a different domain

**URL:** <https://forums.powershell.org/t/getting-volume-on-all-machines-on-a-different-domain/19826>\
**Category:** PowerShell Help\
**Created:** [July 7, 2022, 2:31pm UTC](https://forums.powershell.org/t/getting-volume-on-all-machines-on-a-different-domain/19826 "2022-07-07T14:31:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![McFly](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@McFly](https://forums.powershell.org/u/McFly)\
**Post date:** [July 7, 2022, 2:31pm UTC](https://forums.powershell.org/t/getting-volume-on-all-machines-on-a-different-domain/19826/1 "2022-07-07T14:31:46Z")

</div>

I am new to Powershell so please excuse my ignorance. I need to run a script on a different domain to get the volume info. So far, I have the script below.

icm test1,test2,test3 {get-volume} | sort sizeremaining

There are at least a total of 100 machines out there. How can I get them all with a single command?  
Thank you.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 7, 2022, 2:36pm UTC](https://forums.powershell.org/t/getting-volume-on-all-machines-on-a-different-domain/19826/2 "2022-07-07T14:36:50Z")

</div>

Jerry,  
Welcome to the forum. 👋🏽

> [@McFly](#):
>
> How can I get them all with a single command?

What’s wrong with the command you have?

And BTW: When you post code, sample data, console output or error messages please format it as code using the _preformatted text_ button ( **\</\>** ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

[How to format code in PowerShell.org](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/b/bee50c628238f2c076c0504efb6b15f2fb11f002.gif) \<---- Click 👆🏽 😉

---

<div class="post-metadata">

**Author:** ![McFly](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@McFly](https://forums.powershell.org/u/McFly)\
**Post date:** [July 7, 2022, 3:04pm UTC](https://forums.powershell.org/t/getting-volume-on-all-machines-on-a-different-domain/19826/3 "2022-07-07T15:04:36Z")

</div>

Thank you for your reply. The code works if I am just looking for a few volumes on the current domain. I need at least 100 volumes for machines across a different domain. I have an idea of entering the names for this somewhere along the lines like

`-computername -filter "name -like ""lm*mr"""`

How would I look for all the machines volume on machines associated with machines that are similar.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 7, 2022, 3:17pm UTC](https://forums.powershell.org/t/getting-volume-on-all-machines-on-a-different-domain/19826/4 "2022-07-07T15:17:59Z")

</div>

Please always read the help for cmdlets you’re about to use completely including examples to learn how to use them.

> **[Invoke-Command (Microsoft.PowerShell.Core) - PowerShell](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/invoke-command?view=powershell-7.2)**
>
> The Invoke-Command cmdlet runs commands on a local or remote computer and returns all output from the commands, including errors. Using a single Invoke-Command command, you can run commands on multiple computers. To run a single command on a remote...

You have to specify the computernames for the parameter `-ComputerName` explicitly. You cannot use wildcards.  
You can save a list of computernames in an array though and provide this to the command.

---

<div class="post-metadata">

**Author:** ![McFly](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@McFly](https://forums.powershell.org/u/McFly)\
**Post date:** [July 7, 2022, 3:28pm UTC](https://forums.powershell.org/t/getting-volume-on-all-machines-on-a-different-domain/19826/5 "2022-07-07T15:28:28Z")

</div>

thank you! I will give this a shot!

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:17pm UTC](https://forums.powershell.org/t/getting-volume-on-all-machines-on-a-different-domain/19826/6 "2024-05-16T20:17:46Z")

</div>

Closed on May 16, 2024, 8:17pm UTC


