kam_uk
asked on
Powershell help
Hi
Just to pieces of advice I need:
1. We have W2008 servers and some of the time, their disk space gets low on the C:. Rather than right click each folder to see properties/size, is there a PS command I can run that will show the sizes of folders (and pref sub-folders too)?
2. I'm running a Get-mailboxserver command where I want all mailboxes except those with the name "E2010" in them. How can I filter the Get-mailbox command so it ignores any servers with "E2010" in their name?
3. I'd like to run a Get-mailboxserver command where the mailbox names are in the CSV flie, how can I use this?
Many thanks in advance!
Just to pieces of advice I need:
1. We have W2008 servers and some of the time, their disk space gets low on the C:. Rather than right click each folder to see properties/size, is there a PS command I can run that will show the sizes of folders (and pref sub-folders too)?
2. I'm running a Get-mailboxserver command where I want all mailboxes except those with the name "E2010" in them. How can I filter the Get-mailbox command so it ignores any servers with "E2010" in their name?
3. I'd like to run a Get-mailboxserver command where the mailbox names are in the CSV flie, how can I use this?
Many thanks in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks All
One question regarding: get-mailbox | where-object {$_.name -notlike '*E2010*"}
What If I wanted to say, object not like E2010xxx *or* E2003xx, how could I write that?
One question regarding: get-mailbox | where-object {$_.name -notlike '*E2010*"}
What If I wanted to say, object not like E2010xxx *or* E2003xx, how could I write that?
You actually want AND rather than OR, so it's not like either (excludes both).
get-mailbox | where-object {$_.name -notlike '*E2010*" -And $_.Name -NotLike "E2003*" }
Chris
get-mailbox | where-object {$_.name -notlike '*E2010*" -And $_.Name -NotLike "E2003*" }
Chris
get-mailbox | where-object {$_.name -notlike 'E2010*" -and $_,name -notlike "E2003*"}
or, for exactly 3 resp. 2 chars after the name:
get-mailbox | where-object {$_.name -notlike 'E2010???" -and $_,name -notlike "E2003??"}
or, for exactly 3 resp. 2 chars after the name:
get-mailbox | where-object {$_.name -notlike 'E2010???" -and $_,name -notlike "E2003??"}
I tend to use RegEx for things like this. I probably like them too much :) For example:
Get-Mailbox | Where-Object { $_.Name -NotMatch '^(E2003.{2}|E2010.{3})$' }
Or:
Get-Mailbox | Where-Object { $_.Name -NotMatch '^E20(03\w{2}|10\w{3})$' }
Probably a bit over the top though, and harder to get right unless you like RegEx already.
Chris
Get-Mailbox | Where-Object { $_.Name -NotMatch '^(E2003.{2}|E2010.{3})$' }
Or:
Get-Mailbox | Where-Object { $_.Name -NotMatch '^E20(03\w{2}|10\w{3})$' }
Probably a bit over the top though, and harder to get right unless you like RegEx already.
Chris
http://www.jgoodies.com/freeware/jdiskreport/
2) I would suggest to past eh result to excel and remove unwanted entries...
3) just appeand ">filename.svc" in the end of line.
get-mailobxerver >c:\filesname.svc