This question already has answers here:
Powershell script value fetching
(2 answers)
Closed 5 years ago.
How to get a particular value in PowerShell display ?
Example - When I execute below script I get 6 values i need to get only 4th row value.
Command:
Get-WmiObject win32_logicaldisk -Filter "Drivetype=3
Output:
DeviceID : C:
DriveType : 3
ProviderName :
FreeSpace : 183760687104
Size : 255791026176
VolumeName :
I need to fetch only "183760687104" value. How to achieve it. Also I do not want to have FreeSpace tag also. Just plain value "183760687104".
You just access the field by name:
(Get-WmiObject Win32_LogicalDisk -Filter "Drivetype=3").FreeSpace
Note that Get-WmiObject is deprecated, you should be using Get-CimInstance instead.
(Get-CimInstance Win32_LogicalDisk -Filter "Drivetype=3").FreeSpace
If you want to save the value in a variable, just assign it:
$freespace = (Get-CimInstance Win32_LogicalDisk -Filter "Drivetype=3").FreeSpace
and then you can use $freespace as you wish. Be careful though as on a system with more than one local disk your expression will return an array of values rather than just a single one, so you may want to subscript the result to choose only the first disk. Either of these expressions will be sure to give you a single number:
PS C:\Users\User> (Get-CimInstance Win32_LogicalDisk -Filter "Drivetype=3").FreeSpace[0]
94229651456
PS C:\Users\User> (Get-CimInstance Win32_LogicalDisk -Filter "Drivetype=3")[0].FreeSpace
94239125504
If you are ever in doubt about the accessible fields on an object, just pipe the expression through gm (short for Get-Member):
Get-CimInstance Win32_LogicalDisk -Filter "Drivetype=3" | gm
will list all available fields.
PS C:\Users\User> Get-CimInstance Win32_LogicalDisk -Filter "Drivetype=3" | gm
TypeName: Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_LogicalDisk
Name MemberType Definition
---- ---------- ----------
Clone Method System.Object ICloneable.Clone()
Dispose Method void Dispose(), void IDisposable.Dispose()
Equals Method bool Equals(System.Object obj)
GetCimSessionComputerName Method string GetCimSessionComputerName()
GetCimSessionInstanceId Method guid GetCimSessionInstanceId()
GetHashCode Method int GetHashCode()
GetObjectData Method void GetObjectData(System.Runtime.Serialization.SerializationInfo info, Sys...
GetType Method type GetType()
ToString Method string ToString()
Access Property uint16 Access {get;}
Availability Property uint16 Availability {get;}
BlockSize Property uint64 BlockSize {get;}
Caption Property string Caption {get;}
Compressed Property bool Compressed {get;}
ConfigManagerErrorCode Property uint32 ConfigManagerErrorCode {get;}
ConfigManagerUserConfig Property bool ConfigManagerUserConfig {get;}
CreationClassName Property string CreationClassName {get;}
Description Property string Description {get;}
DeviceID Property string DeviceID {get;}
DriveType Property uint32 DriveType {get;}
ErrorCleared Property bool ErrorCleared {get;}
ErrorDescription Property string ErrorDescription {get;}
ErrorMethodology Property string ErrorMethodology {get;}
FileSystem Property string FileSystem {get;}
FreeSpace Property uint64 FreeSpace {get;}
InstallDate Property CimInstance#DateTime InstallDate {get;}
LastErrorCode Property uint32 LastErrorCode {get;}
MaximumComponentLength Property uint32 MaximumComponentLength {get;}
MediaType Property uint32 MediaType {get;}
Name Property string Name {get;}
NumberOfBlocks Property uint64 NumberOfBlocks {get;set;}
PNPDeviceID Property string PNPDeviceID {get;}
PowerManagementCapabilities Property uint16[] PowerManagementCapabilities {get;}
PowerManagementSupported Property bool PowerManagementSupported {get;}
ProviderName Property string ProviderName {get;}
PSComputerName Property string PSComputerName {get;}
Purpose Property string Purpose {get;}
QuotasDisabled Property bool QuotasDisabled {get;}
QuotasIncomplete Property bool QuotasIncomplete {get;}
QuotasRebuilding Property bool QuotasRebuilding {get;}
Size Property uint64 Size {get;}
Status Property string Status {get;}
StatusInfo Property uint16 StatusInfo {get;}
SupportsDiskQuotas Property bool SupportsDiskQuotas {get;}
SupportsFileBasedCompression Property bool SupportsFileBasedCompression {get;}
SystemCreationClassName Property string SystemCreationClassName {get;}
SystemName Property string SystemName {get;}
VolumeDirty Property bool VolumeDirty {get;}
VolumeName Property string VolumeName {get;set;}
VolumeSerialNumber Property string VolumeSerialNumber {get;}
PSStatus PropertySet PSStatus {Status, Availability, DeviceID, StatusInfo}
Related
I need to look through eventLog security ID 4648, and find the last time the user connected to the machine.
Currently this is my code:
$Values = invoke-command -ComputerName $ComputerName {Get-EventLog -LogName Security -InstanceID 4648 | Select-Object -ExpandProperty Message| ForEach-Object {if($_.Log -match "$String2"){
$_
Break }}}
$Values
The aim was to go through each log until a log where the message has the previously defined username is found, and then stop going through EventLog and return that log.
This is working well, except its not matching the correct log with the specified string.
Is there a way to improve how the matching works? So it actually finds the correct log with the specified user?
# Fill in the regex for the userName
$userName = "userName"
$Values = #(invoke-command -ComputerName $ComputerName {
Get-EventLog -LogName Security -InstanceID 4648 | Where-Object { $_.message -match $Using:userName } | Select-Object -First 1)
}
Your above sample won't work since message is of type string, therefore it doesn't have a Log property. Since we want $userName to be avaiable for read access on the remote machine we can use the $Using: syntax. To break the pipeline "iteration" I'm using Select-Object -First 1 which will return the first object passing the Where-Objectclause.
Resulting from that $Values points to a collection of (deserialized) objects (using the #() operator) of type:
TypeName: System.Diagnostics.EventLogEntry#Security/Microsoft-Windows-Security-Auditing/4648
Which means you can change the -First parameter to e.g. 10 and sort the result on the client machine:
$Values | sort TimeGenerated -Descending
If you want to know which properties are available you can use:
> $Values | gm
TypeName: System.Diagnostics.EventLogEntry#Security/Microsoft-Windows-Security-Auditing/4648
Name MemberType Definition
---- ---------- ----------
Disposed Event System.EventHandler Disposed(System.Object, System.EventArgs)
CreateObjRef Method System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType)
Dispose Method void Dispose(), void IDisposable.Dispose()
Equals Method bool Equals(System.Diagnostics.EventLogEntry otherEntry), bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetLifetimeService Method System.Object GetLifetimeService()
GetObjectData Method void ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
GetType Method type GetType()
InitializeLifetimeService Method System.Object InitializeLifetimeService()
ToString Method string ToString()
Category Property string Category {get;}
CategoryNumber Property int16 CategoryNumber {get;}
Container Property System.ComponentModel.IContainer Container {get;}
Data Property byte[] Data {get;}
EntryType Property System.Diagnostics.EventLogEntryType EntryType {get;}
Index Property int Index {get;}
InstanceId Property long InstanceId {get;}
MachineName Property string MachineName {get;}
Message Property string Message {get;}
ReplacementStrings Property string[] ReplacementStrings {get;}
Site Property System.ComponentModel.ISite Site {get;set;}
Source Property string Source {get;}
TimeGenerated Property datetime TimeGenerated {get;}
TimeWritten Property datetime TimeWritten {get;}
UserName Property string UserName {get;}
EventID ScriptProperty System.Object EventID {get=$this.get_EventID() -band 0xFFFF;}
Hope that helps.
I guess I just don't know the proper name of whatever I'm looking for, but this was probably asked a thousand times before.
I started PowerShell not long ago, and I'm struggling to understand where I can find the 'sub properties'(if you can call it those) of an object.
For instance, I was using the VMware PowerCLI, and was tried to figure out how I can find the IP address of a VM.
So for example, I was using the Get-VM command, and when I piped it into get member, I got the following:
PS C:\Users\eitan.rapaport> get-vm "*VRA*" | gm
TypeName: VMware.VimAutomation.ViCore.Impl.V1.VM.UniversalVirtualMachineImpl
Name MemberType Definition
---- ---------- ----------
ConvertToVersion Method T VersionedObjectInterop.ConvertToVersion[T]()
Equals Method bool Equals(System.Object obj)
GetClient Method VMware.VimAutomation.ViCore.Interop.V1.VIAutomation VIObjectCoreInterop.GetClient()
GetConnectionParameters Method VMware.VimAutomation.ViCore.Interop.V1.VM.RemoteConsoleVMParams RemoteConsoleVMIn..
GetHashCode Method int GetHashCode()
GetType Method type GetType()
IsConvertableTo Method bool VersionedObjectInterop.IsConvertableTo(type type)
LockUpdates Method void ExtensionData.LockUpdates()
ObtainExportLease Method VMware.Vim.ManagedObjectReference ObtainExportLease.ObtainExportLease()
ToString Method string ToString()
UnlockUpdates Method void ExtensionData.UnlockUpdates()
CoresPerSocket Property int CoresPerSocket {get;}
CustomFields Property System.Collections.Generic.IDictionary[string,string] CustomFields {get;}
DatastoreIdList Property string[] DatastoreIdList {get;}
DrsAutomationLevel Property System.Nullable[VMware.VimAutomation.ViCore.Types.V1.Cluster.DrsAutomationLevel] ..
ExtensionData Property System.Object ExtensionData {get;}
Folder Property VMware.VimAutomation.ViCore.Types.V1.Inventory.Folder Folder {get;}
FolderId Property string FolderId {get;}
Guest Property VMware.VimAutomation.ViCore.Types.V1.VM.Guest.VMGuest Guest {get;}
GuestId Property string GuestId {get;}
HAIsolationResponse Property System.Nullable[VMware.VimAutomation.ViCore.Types.V1.Cluster.HAIsolationResponse]..
HardwareVersion Property string HardwareVersion {get;}
HARestartPriority Property System.Nullable[VMware.VimAutomation.ViCore.Types.V1.Cluster.HARestartPriority] H..
Id Property string Id {get;}
MemoryGB Property decimal MemoryGB {get;}
MemoryMB Property decimal MemoryMB {get;}
Name Property string Name {get;}
Notes Property string Notes {get;}
NumCpu Property int NumCpu {get;}
PersistentId Property string PersistentId {get;}
PowerState Property VMware.VimAutomation.ViCore.Types.V1.Inventory.PowerState PowerState {get;}
ProvisionedSpaceGB Property decimal ProvisionedSpaceGB {get;}
ResourcePool Property VMware.VimAutomation.ViCore.Types.V1.Inventory.ResourcePool ResourcePool {get;}
ResourcePoolId Property string ResourcePoolId {get;}
Uid Property string Uid {get;}
UsedSpaceGB Property decimal UsedSpaceGB {get;}
VApp Property VMware.VimAutomation.ViCore.Types.V1.Inventory.VApp VApp {get;}
Version Property VMware.VimAutomation.ViCore.Types.V1.VM.VMVersion Version {get;}
VMHost Property VMware.VimAutomation.ViCore.Types.V1.Inventory.VMHost VMHost {get;}
VMHostId Property string VMHostId {get;}
VMResourceConfiguration Property VMware.VimAutomation.ViCore.Types.V1.VM.VMResourceConfiguration VMResourceConfigu..
VMSwapfilePolicy Property System.Nullable[VMware.VimAutomation.ViCore.Types.V1.VMSwapfilePolicy] VMSwapfile..
As you can see, nothing mentions anything about IP.
I was researching this online, and have found that I should run the following command:
Get-VM | Select Name, #{N="IP Address";E={#($_.guest.IPAddress[0])}}
Which leads me to my question. How can I find the properties under a certain member/property of a command? How could I research the 'sub properties' of 'guest' in that example?
Okay, found it.
In that instance it would be get-vm "*VRA*" | select -ExpandProperty guest | gm
I've been dealing with this for the last two days, so I figured I'd share my solution:
First, I'm saving the VM object to a variable to make it easy to access without searching every time.
$vm = Get-vm -Name steve
To get all the properties of the VM Object
$vm | Select-Object *
If you just want to get the Name you can access it like this:
$vm.Name
If you want to get the Properties of the Guest Object (which is a property of the VM object):
$vm.Guest | Select-Object *
You can access the Properties of the Guest Object through the VM Object like this:
$vm.Guest.VmName
Want the IP addresses of the guest?
$vmip = $vm.Guest.IPAddress
And, because this took me a while to figure out, if that returns ipv4 and ipv6, and you want to filter out the ipv6:
$vmip = $vm.Guest.IPAddress | ?{$_ -notmatch ':'}
Another method of introspection in PowerShell is to just get the class name and then look it up in the API.
PS C:\> $Files = Get-ChildItem *.* -File
PS C:\> $Files[0].GetType().FullName
System.IO.FileInfo
You can then search for that class with either C# or PowerShell to find the API listing.
You can do a similar thing with the VMWare PowerCLI doc. The "all types" list on the left is a list of all the classes used by the module.
I'm using Windows Server 2012 R2 with PowerShell v5 and I've stumbled on some PowerShell behaviour I don't understand.
The following line working correctly and returning results as expected:
Get-WindowsFeature | where -Property "InstallState" -eq "Installed"
This working correctly and returning results as previous:
Get-WindowsFeature | where {$_.Installed}
The following is NOT working, even though it should:
Get-WindowsFeature | where {$_.Available}
But this one is working:
Get-WindowsFeature | where -Property "InstallState" -eq "Available"
I've seen the same behaviour with PowerShell v3 on Windows 7 as well.
Please explain it to me.
Get-WindowsFeature | Get-Member -MemberType Property
TypeName: Microsoft.Windows.ServerManager.Commands.Feature
Name MemberType Definition
---- ---------- ----------
AdditionalInfo Property hashtable AdditionalInfo {get;}
BestPracticesModelId Property string BestPracticesModelId {get;}
DependsOn Property string[] DependsOn {get;}
Depth Property int Depth {get;}
Description Property string Description {get;}
DisplayName Property string DisplayName {get;}
EventQuery Property string EventQuery {get;}
FeatureType Property string FeatureType {get;}
Installed Property bool Installed {get;}
InstallState Property Microsoft.Windows.ServerManager.Commands.InstallState InstallState {get;}
Name Property string Name {get;}
Notification Property Microsoft.Windows.ServerManager.ServerComponentManager.Internal.Notification[] Notification {g...
Parent Property string Parent {get;}
Path Property string Path {get;}
PostConfigurationNeeded Property bool PostConfigurationNeeded {get;}
ServerComponentDescriptor Property psobject ServerComponentDescriptor {get;}
SubFeatures Property string[] SubFeatures {get;}
SystemService Property string[] SystemService {get;}
There is no "Available" property.
I would like to execute a program.exe which resides next to the script.ps1 file...
How can i get this location/folder?
(this is not a fixed location/folder, can be a usb stick or network drive etc)
I have tried to use
$MyInvocation.MyCommand.Path
But it seems not to be helping me (or i'm not using it the rigth way)
Thanks
This is the pattern I normally use:
$exeName = "MyApplication.exe"
$scriptFolder = Split-Path -Parent $MyInvocation.MyCommand.Path
$exeFullPath = Join-Path -Path $scriptFolder -ChildPath $exeName
$MyInvocation is an automatic variable.
Contains an information about the current command, such as the name,
parameters, parameter values, and information about how the command
was started, called, or "invoked," such as the name of the script that
called the current command.
Note that the object returned by $MyInvocation.MyCommand is different depending upon the context from which it was executed.
The type ScriptInfo is returned from the powershell command window, notice the lack of Path property:
TypeName: System.Management.Automation.ScriptInfo
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
CommandType Property System.Management.Automation.CommandTypes CommandType {get;}
Definition Property System.String Definition {get;}
Module Property System.Management.Automation.PSModuleInfo Module {get;}
ModuleName Property System.String ModuleName {get;}
Name Property System.String Name {get;}
OutputType Property System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.PSTyp...
Parameters Property System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Cult...
ParameterSets Property System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.Comma...
ScriptBlock Property System.Management.Automation.ScriptBlock ScriptBlock {get;}
Visibility Property System.Management.Automation.SessionStateEntryVisibility Visibility {get;set;}
HelpUri ScriptProperty System.Object HelpUri {get=try...
Whereas the type is ExternalScriptInfo when run from a script, notice the additional properties ScriptContents and Path etc.
TypeName: System.Management.Automation.ExternalScriptInfo
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
CommandType Property System.Management.Automation.CommandTypes CommandType {get;}
Definition Property System.String Definition {get;}
Module Property System.Management.Automation.PSModuleInfo Module {get;}
ModuleName Property System.String ModuleName {get;}
Name Property System.String Name {get;}
OriginalEncoding Property System.Text.Encoding OriginalEncoding {get;}
OutputType Property System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.PS...
Parameters Property System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, C...
ParameterSets Property System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.Co...
Path Property System.String Path {get;}
ScriptBlock Property System.Management.Automation.ScriptBlock ScriptBlock {get;}
ScriptContents Property System.String ScriptContents {get;}
Visibility Property System.Management.Automation.SessionStateEntryVisibility Visibility {get;set;}
HelpUri ScriptProperty System.Object HelpUri {get=try...
How do I pipeline the output of Exchange 2010's Get-MoveRequest command so that the Name variable can be used in the $Username variable below?
[CmdletBinding(DefaultParameterSetName = "MoveUser")]
param(
[Parameter(Mandatory = $true, ParameterSetName = "MoveUser", ValueFromPipeline = $true, Position = 0)]
$Username
)
function Get-MBStats($Username )
{
$req = Get-MailboxStatistics -Identity $Username -IncludeMoveHistory
$UserDetail = ($req).MoveHistory[0]
# TODO: SOME CUSTOM STUFF HERE #
New-Object PSObject -Property #{
Username = $Username
Status = $UserDetail.Status
TargetDatabase = $UserDetail.TargetDatabase
CompletionTime = $UserDetail.CompletionTimestamp
MailboxSizeKB = $UserDetail.TotalMailboxSize.ToKB()
DurationSec = $UserDetail.TotalInProgressDuration.TotalSeconds
BadItems = $UserDetail.BadItemsEncountered
}
# Todo: GUI http://msdn.microsoft.com/en-us/magazine/hh288074.aspx #
}
Get-MBStats($Username)
UPDATE
Here are the members output from MoveRequest (source)
TypeName: Microsoft.Exchange.Management.RecipientTasks.MoveRequest
Name MemberType Definition
---- ---------- ----------
Clone Method System.Object Clone()
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetProperties Method System.Object[] GetProperties(System.Collections.Generic.ICollection[Microso...
GetType Method type GetType()
ToString Method string ToString()
Validate Method Microsoft.Exchange.Data.ValidationError[] Validate()
PSComputerName NoteProperty System.String PSComputerName=nycexhc01.nfp.com
RunspaceId NoteProperty System.Guid RunspaceId=dc444c7e-bcac-4c1c-8fdf-847875456c03
Alias Property System.String Alias {get;set;}
BatchName Property System.String BatchName {get;}
Direction Property Microsoft.Exchange.MailboxReplicationService.RequestDirection Direction {get;}
DisplayName Property System.String DisplayName {get;set;}
DistinguishedName Property System.String DistinguishedName {get;}
ExchangeGuid Property System.Guid ExchangeGuid {get;}
ExchangeVersion Property Microsoft.Exchange.Data.ExchangeObjectVersion ExchangeVersion {get;}
ExternalDirectoryObjectId Property System.String ExternalDirectoryObjectId {get;}
Flags Property Microsoft.Exchange.Data.Directory.Recipient.RequestFlags Flags {get;}
Guid Property System.Guid Guid {get;}
Identity Property Microsoft.Exchange.Data.ObjectId Identity {get;}
IsOffline Property System.Boolean IsOffline {get;}
IsValid Property System.Boolean IsValid {get;}
LastExchangeChangedTime Property System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutr...
Name Property System.String Name {get;set;}
OrganizationId Property Microsoft.Exchange.Data.Directory.OrganizationId OrganizationId {get;}
OriginatingServer Property System.String OriginatingServer {get;}
Protect Property System.Boolean Protect {get;}
RecipientType Property Microsoft.Exchange.Data.Directory.Recipient.RecipientType RecipientType {get;}
RecipientTypeDetails Property Microsoft.Exchange.Data.Directory.Recipient.RecipientTypeDetails RecipientTy...
RemoteHostName Property System.String RemoteHostName {get;}
RequestStyle Property Microsoft.Exchange.MailboxReplicationService.RequestStyle RequestStyle {get;}
SourceArchiveDatabase Property Microsoft.Exchange.Data.Directory.ADObjectId SourceArchiveDatabase {get;}
SourceDatabase Property Microsoft.Exchange.Data.Directory.ADObjectId SourceDatabase {get;}
Status Property Microsoft.Exchange.Data.Directory.Recipient.RequestStatus Status {get;}
Suspend Property System.Boolean Suspend {get;}
SuspendWhenReadyToComplete Property System.Boolean SuspendWhenReadyToComplete {get;}
TargetArchiveDatabase Property Microsoft.Exchange.Data.Directory.ADObjectId TargetArchiveDatabase {get;}
TargetDatabase Property Microsoft.Exchange.Data.Directory.ADObjectId TargetDatabase {get;}
Here are the members of the target
TypeName: Microsoft.Exchange.Data.Mapi.MailboxStatistics
Name MemberType Definition
---- ---------- ----------
Clone Method System.Object Clone()
Dispose Method System.Void Dispose()
Equals Method bool Equals(System.Object obj)
GetDisposeTracker Method Microsoft.Exchange.Diagnostics.DisposeTracker GetDisposeTracker()
GetHashCode Method int GetHashCode()
GetProperties Method System.Object[] GetProperties(System.Collections.Generic.ICollection[Microsoft....
GetType Method type GetType()
SuppressDisposeTracker Method System.Void SuppressDisposeTracker()
ToString Method string ToString()
Validate Method Microsoft.Exchange.Data.ValidationError[] Validate()
PSComputerName NoteProperty System.String PSComputerName=nycexhc01.nfp.com
RunspaceId NoteProperty System.Guid RunspaceId=dc444c7e-bcac-4c1c-8fdf-847875456c03
AssociatedItemCount Property System.Nullable`1[[System.UInt32, mscorlib, Version=2.0.0.0, Culture=neutral, P...
Database Property Microsoft.Exchange.Data.ObjectId Database {get;}
DatabaseName Property System.String DatabaseName {get;}
DeletedItemCount Property System.Nullable`1[[System.UInt32, mscorlib, Version=2.0.0.0, Culture=neutral, P...
DisconnectDate Property System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral,...
DisconnectReason Property System.Nullable`1[[Microsoft.Exchange.Data.Mapi.MailboxState, Microsoft.Exchang...
DisplayName Property System.String DisplayName {get;}
Identity Property Microsoft.Exchange.Data.Mapi.MailboxId Identity {get;}
IsArchiveMailbox Property System.Nullable`1[[System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, ...
IsQuarantined Property System.Boolean IsQuarantined {get;}
IsValid Property System.Boolean IsValid {get;}
ItemCount Property System.Nullable`1[[System.UInt32, mscorlib, Version=2.0.0.0, Culture=neutral, P...
LastLoggedOnUserAccount Property System.String LastLoggedOnUserAccount {get;}
LastLogoffTime Property System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral,...
LastLogonTime Property System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral,...
LegacyDN Property System.String LegacyDN {get;}
MailboxGuid Property System.Guid MailboxGuid {get;}
MailboxTableIdentifier Property System.String MailboxTableIdentifier {get;}
MapiIdentity Property Microsoft.Exchange.Data.Mapi.MapiObjectId MapiIdentity {get;}
MoveHistory Property System.Object MoveHistory {get;}
ObjectClass Property Microsoft.Exchange.Data.Mapi.ObjectClass ObjectClass {get;}
OriginatingServer Property Microsoft.Exchange.Data.Fqdn OriginatingServer {get;}
ServerName Property System.String ServerName {get;}
StorageLimitStatus Property System.Nullable`1[[Microsoft.Exchange.Data.Mapi.StorageLimitStatus, Microsoft.E...
TotalDeletedItemSize Property Microsoft.Exchange.Data.Unlimited`1[[Microsoft.Exchange.Data.ByteQuantifiedSize...
TotalItemSize Property Microsoft.Exchange.Data.Unlimited`1[[Microsoft.Exchange.Data.ByteQuantifiedSize...
The documentation is not clear on what Get-MoveRequest returns, but something like below is what you can try:
Get-MoveRequest ... | select -expand Name | Get-MBStats