Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 210263

Re: how can run a script in powercli

$
0
0

now when run below command show :

 

PowerCLI C:\> $global:defaultviservers

 

Name                           Port  User

----                           ----  ----

10.11.21.192                   443   VSPHERE.LOCAL\Administrator

10.11.21.191                   443   root

 

and when put this script in a .ps file with name 1.ps

 

$vms=Get-VM

$start= (Get-Date).AddMonths(-1)

Get-VIEvent-Entity$vms-Start$start-MaxSamples ([int]::MaxValue) |

where{$_-is[VMware.Vim.VmCreatedEvent]} |%{

    $obj=[ordered]@{

        Name =$_.Vm.Name

        Created =$_.CreatedTime

        CreatedBy =$_.UserName

        IPAddress =$vm.Guest.IPAddress -join'|'

    }

    New-Objectpsobject-Property$obj

}

 

when run just open 1.ps file in a txt file

 

what do i have to do ?


Viewing all articles
Browse latest Browse all 210263

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>