{"id":827,"date":"2013-09-05T16:23:26","date_gmt":"2013-09-05T14:23:26","guid":{"rendered":"http:\/\/vthink.fr\/2013\/09\/script-powercli-audit-de-vos-vms-emplacementtaillemacipetc-2\/"},"modified":"2015-02-19T17:41:43","modified_gmt":"2015-02-19T16:41:43","slug":"powercli-audit-script-vmware-statecpusizemacipetc","status":"publish","type":"post","link":"https:\/\/vthink.fr\/en\/2013\/09\/powercli-audit-script-vmware-statecpusizemacipetc\/","title":{"rendered":"Powercli &#8211; Audit Script VMware (State,CPU,Size,@mac,IP,etc..)"},"content":{"rendered":"\n<!-- Quick Adsense WordPress Plugin: http:\/\/quickadsense.com\/ -->\n<div class=\"e93ad9a1ff002511692efbd236903a83\" data-index=\"1\" style=\"float: left; margin: 10px 10px 10px 0;\">\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- ads1 -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:inline-block;width:300px;height:250px\"\r\n     data-ad-client=\"ca-pub-9785518987307332\"\r\n     data-ad-slot=\"8809267401\"><\/ins>\r\n<script>\r\n(adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<p>This is a script that will audited your VMware infrastructure.<\/p>\n<p>For example, the script can be usefull if you will migrate your VMware infrastructure.<\/p>\n<p>You will be able to retrieve these informations :<\/p>\n<p>&#8211; State<br \/>\n&#8211; Name<br \/>\n&#8211; CPU<br \/>\n&#8211; Memory<br \/>\n&#8211; IPAddress<br \/>\n&#8211; OSFullName<br \/>\n&#8211; Cluster<br \/>\n&#8211; Directory<br \/>\n&#8211; UsedspaceGB<br \/>\n&#8211; Datastore<br \/>\n&#8211; Description<br \/>\n&#8211; MacAddress<br \/>\n&#8211; Path<br \/>\n&#8211; NetworkName<br \/>\n&#8211; NetworkAdapter<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<!-- Quick Adsense WordPress Plugin: http:\/\/quickadsense.com\/ -->\n<div class=\"e93ad9a1ff002511692efbd236903a83\" data-index=\"1\" style=\"float: left; margin: 10px 10px 10px 0;\">\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- ads1 -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:inline-block;width:300px;height:250px\"\r\n     data-ad-client=\"ca-pub-9785518987307332\"\r\n     data-ad-slot=\"8809267401\"><\/ins>\r\n<script>\r\n(adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n\n<p>$AuditVM = @()<br \/>\nForEach ($vm in (Get-Cluster | Get-VM )) {<br \/>\nforeach ($vmguest in @($vm | Get-VMguest)) {<br \/>\nforeach ($cluster in @($vm | Get-Cluster )) {<br \/>\nforeach ($datastore in @(Get-VM $vm | Get-Datastore)) {<br \/>\nforeach ($Network in @(Get-VM $vm | Get-NetworkAdapter)) {<br \/>\n$objGuest= &#8220;&#8221; | Select State, Name,CPU, Memory, IPAddress, OSFullName, Cluster, Folder, UsedspaceGB, Datastore, Description, MacAddress, Path, NetworkName, NetworkAdapter<br \/>\n$objGuest.State= $vmguest.state<br \/>\n$objGuest.CPU = $vm.NumCPU<br \/>\n$objGuest.Memory = $vm.MemoryMB<br \/>\n$objGuest.Description= $vm.Notes<br \/>\n$objGuest.Folder=$vm.Folder<br \/>\n$objGuest.Name = $vm.Name<br \/>\n$objGuest.IPAddress = [string]::Join(&#8216;,&#8217;,$vmguest.IPAddress)<br \/>\n$objGuest.OSFullName = $vmguest.OSFullName<br \/>\n$objGuest.UsedSpaceGb = $vm.UsedSpaceGB<br \/>\n$objGuest.Cluster = $cluster.Name<br \/>\n$objGuest.Datastore = $datastore.Name<br \/>\n$objGuest.MacAddress = $Network.MacAddress<br \/>\n$objGuest.Path = $vm.Extensiondata.Config.Files.VmPathName<br \/>\n$objGuest.NetworkName = $Network.NetworkName<br \/>\n$objGuest.NetworkAdapter = $Network.Name<br \/>\n$AuditVM += $objGuest<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n<p>$AuditVM | Export-Csv d:\\auditvm.csv -noTypeInformation | Format-Table -AutoSize # Replace d:\\auditvm.csv with your path<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div><!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>This is a script that will audited your VMware infrastructure. For example, the script can be usefull if you will migrate your VMware infrastructure. You will be able to retrieve these informations : &#8211; State &#8211; Name &#8211; CPU &#8211; Memory &#8211; IPAddress &#8211; OSFullName &#8211; Cluster &#8211; Directory &#8211; UsedspaceGB &#8211; Datastore &#8211; Description&hellip;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":2,"featured_media":713,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1088],"tags":[1223,1092,1187,1188,1093,1189,1036,1190,1130,1037,1096,1191,1134,1192,1222,1193,1194,1643,1099,1214,1224,1225,1195,1220,1196,1221,1197,1198,1218,1108,1199,1219,1226,1200,1110,1111,1058,1216,1213,1067,1069,1215,1072,1073,1120,1201,1217,1075,1076,1121,1122,1077],"_links":{"self":[{"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/posts\/827"}],"collection":[{"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/comments?post=827"}],"version-history":[{"count":4,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/posts\/827\/revisions"}],"predecessor-version":[{"id":831,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/posts\/827\/revisions\/831"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/media\/713"}],"wp:attachment":[{"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/media?parent=827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/categories?post=827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vthink.fr\/en\/wp-json\/wp\/v2\/tags?post=827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}