VMware Cloud Community
jade_
Contributor
Contributor
Jump to solution

Getting file size of report file on PowerCLI server?

Hi all:

I am trying to find out if there is a way to list the size of a file thats local to the powercli server.  The background is that I have a script that runs daily and emails out the report of what it finds during the audit.  What I am trying to update the script to do is only send the report if the audit actually found anything; and not an empty file attachment...

Thanks in advance for any help you can provide, and please let me know if more information is needed.

thanks!

Jade

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

Hi Jade,

you can do the following to check the size of a file called vmware.log:

if ((Get-ChildItem vmware.log).Length -gt 0) { # E-mail logfile}


Regards,Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

0 Kudos
2 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

Hi Jade,

you can do the following to check the size of a file called vmware.log:

if ((Get-ChildItem vmware.log).Length -gt 0) { # E-mail logfile}


Regards,Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
jade_
Contributor
Contributor
Jump to solution

That was exactly what I was looking for!  Thank you for the lightning fast (and correct!) answer!

Jade

0 Kudos