help strengthen the existing script maps
So I tried initially comes to loop through all the files but could not understand so I made sure that I could pass the file as a parameter, but ideally, I want it to all virtual machines without having to enter all the settings. Any ideas on the best way to do this? I want to the csv files for each folder with all the attributes that are customized for each virtual machine contained in.
##Variables
Param ($param1)
$report = @)
$folders = get-file $Param1 # | name sort
############################################################################################
###########################
ForEach ($folder in $folders)
{
$vms = get-vm-location $folder
ForEach ($vm to $vms)
{
$ReportObj = "" | Select "File", "Virtual Machine", "POC", "Username", "Password",
$ReportObj. "" Folder "= $folder.name
$ReportObj. "' Virtual Machine ' = $vm.name
$ReportObj. "' POC ' = $vm. CustomFields
$ReportObj. "' Username ' = $vm. CustomFields
$ReportObj. "' Password ' = $vm. CustomFields
$Report += $ReportObj
$csvfile = "D:\". "$folder".csv ".
$report | Export-CSV $csvfile - NoTypeInformation
}
}
The Get-FolderPath filter returns anything you put in the $row.
Then if you add additional properties, they will be in the CSV files.
For example, the following version adds the Notes property and all of the custom attributes
filter Get-FolderPath { $vmImpl = $_ $_ | Get-View | % { $row = "" | select Name, Path, Notes $row.Name = $_.Name $current = Get-View $_.Parent $path = "" do { $parent = $current if($parent.Name -ne "vm"){$path = $parent.Name + "\" + $path} $current = Get-View $current.Parent } while ($current.Parent -ne $null) $row.Path = $path $row.Notes = $vmImpl.Description $vmImpl.CustomFields.GetEnumerator() | %{ $row | Add-Member -Name $_.Key -Value $_.Value -MemberType NoteProperty } $row } } Get-VM | Get-FolderPath | Group-Object -Property Path | %{$_.Group | Export-Csv ("C:\" + ($_.Name.TrimEnd("\")).Replace("\","-") + ".csv")}
This version also solves the problem with the file name of the CSV files which was leaking.
Tags: VMware
Similar Questions
-
The HTML output to the existing script maps help
I found a script that had a lot of things that I needed. I have since deleted stuff we didn't need and added some other stuff that we need. The result is good, but now I want to turn this into a page in HTML and it gets an error. Any help would be greatly appreciated. I'm pretty good with PowerShell to be somewhat dangerous with things.
$Cluster = 'CLUS-1' $ClusterName = Get-Cluster $Cluster $Datastores = $ClusterName | Get-Datastore | Where {$_.Name -notlike '*LOCAL' -and $_.Name -notlike 'VM_Datastore*' -and $_.Name -notlike 'Templates' -and $_.Name -notlike 'ISO' -and $_.Name -notlike '*SCRATCH*' -and $_.Name -notlike 'Archive'} $Clusters = Get-View -ViewType ComputeResource | Where {$_.Name -like $ClusterName.Name} $Clusters | % { $Cluste = $_ $VMHostsView = $null $VMHostsView = Get-View $Cluste.Host -Property Name, Hardware, Config $VMss = $ClusterName | Get-VM $HostCount = ($VMHostsView | Measure-Object).Count $VMCount = 0 + ($VMss | Measure-Object).Count $VMsPerHost = [Math]::Round(($VMCount/$HostCount), 1) $vCPU = 0 + ($VMss | Measure-Object -Sum -Property NumCPU).Sum $allocatedram = 0 + ($VMss | Measure-Object -Sum -Property MemoryGB).Sum $avgrampervm = [Math]::Round(($allocatedram/$VMCount), 1) $pCPUSocket = ($VMHostsView | % { $_.Hardware.CPUInfo.NumCpuPackages } | Measure-Object -Sum).Sum $TpCPUSocket += $pCPUSocket $pCPUCore = ($VMHostsView | % { $_.Hardware.CPUInfo.NumCpuCores } | Measure-Object -Sum).Sum $vCPUPerpCPUCore = [Math]::Round(($vCPU/$pCPUCore), 1) $TotalClusterRAMGB = [Math]::Round((Get-Cluster $Cluster | Get-VMHost | % { $_ } | Measure-Object -Property MemoryTotalGB -Sum).Sum) $TotalClusterRAMusageGB = [Math]::Round((Get-Cluster $Cluster | Get-VMHost | % { $_ } | Measure-Object -Property MemoryUsageGB -Sum).Sum) $TotalClusterRAMUsagePercent = [Math]::Round(($TotalClusterRAMusageGB/$TotalClusterRAMGB)*100) $TotalClusterRAMFreeGB = [Math]::Round(($TotalClusterRAMGB-$TotalClusterRAMUsageGB)) $TotalClusterRAMReservedGB = [Math]::Round(($TotalClusterRAMGB/100)*15) $TotalClusterRAMAvailable = [Math]::Round(($TotalClusterRAMFreeGB-$TotalClusterRAMReservedGB)) $newvmcountram = [Math]::Round(($TotalClusterRAMAvailable/$avgrampervm)) $DSCount = 0 + ($datastores | Measure-Object).Count $TotalDSCapacityGB = 0 + [Math]::Round((($datastores | Measure-Object -Sum -Property CapacityGB).Sum), 0) $TotalDSFreeGB = 0 + [Math]::Round((($datastores | Measure-Object -Sum -Property FreespaceGB).Sum), 0) $TotalDSUsedGB = [Math]::Round(($TotalDSCapacityGB - $TotalDSFreeGB),0) $allocatedstorage = 0 + ($VMss | Measure-Object -Sum -Property ProvisionedSpaceGB).Sum $avgstoragepervm = [Math]::Round(($allocatedstorage/$VMCount), 1) $newvmcountstorage = [Math]::Round(($TotalDSFreeGB/$avgstoragepervm)) New-Object PSObject | Add-Member -Pass NoteProperty "Cluster Name" $ClusterName.Name | Add-Member -Pass NoteProperty "Cluster - Host Count" $HostCount | Add-Member -Pass NoteProperty "Cluster - VM Count" $VMCount | Add-Member -Pass NoteProperty "Cluster - VM per Host" $VMsPerHost | Add-Member -Pass NoteProperty "Compute - Number of pCPU" $TpCPUSocket | Add-Member -Pass NoteProperty "Compute - pCPU per Core" $pCPUCore | Add-Member -Pass NoteProperty "Compute - Number of vCPU" $VCPU | Add-Member -Pass NoteProperty "Compute - vCPU per pCore" $vcpuperpcpucore | Add-Member -Pass NoteProperty "Compute - Total Memory (GB)" $TotalClusterRAMGB | Add-Member -Pass NoteProperty "Compute - Total Memory Used (%)" $TotalClusterRAMUsagePercent | Add-Member -Pass NoteProperty "Compute - Total Memory Used (GB)" $TotalClusterRAMusageGB | Add-Member -Pass NoteProperty "Compute - Total Memory Free (GB)" $TotalClusterRAMfreeGB | Add-Member -Pass NoteProperty "Compute - Total Memory Allocated (GB)" $TotalClusterRAMReservedGB | Add-Member -Pass NoteProperty "Compute - RAM Available for NEW VMs (GB)" $TotalClusterRAMAvailable | Add-Member -Pass NoteProperty "Compute - Average RAM allocated per VM" $avgrampervm | Add-Member -Pass NoteProperty "Compute - Remaining VMs based on available RAM" $newvmcountram | Add-Member -Pass NoteProperty "Storage - Datastore Count" $DSCount | Add-Member -Pass NoteProperty "Storage - Total Datastore Capacity (GB)" $TotalDSCapacityGB | Add-Member -Pass NoteProperty "Storage - Total Datastore Free (GB)" $TotalDSFreeGB | Add-Member -Pass NoteProperty "Storage - Total Datastore Used (GB)" $TotalDSUsedGB | Add-Member -Pass NoteProperty "Storage - Average storage allocated per VM" $avgstoragepervm | Add-Member -Pass NoteProperty "Compute - Remaining VMs based on available storage" $newvmcountstorage }
{on the last line of the script after} add below line
| ConvertTo-Html | Out-file c:\log.html
-
Please help improve the JavaScript script
Please help improve the JavaScript script
Hello
to increase or decrease the height of a subform, you use the following syntax in the click of + and - button
cmdAdd::JavaScript
_Row1.addInstance (1);
var b is parseFloat (Subform3.h) - 6.5;.
If (b<>
b = 0;
}
Subform3.h = b + "mm";
cmdRemove::JavaScript
If (_Row1.count > 1) {}
var b is parseFloat (Subform3.h) + 6.5.;
Subform3.h = b + "mm";
_Row1.removeInstance (this.parent.index);
}
This should do the trick, I hope this will help you
-
Help with the Powershell script to collect logs from all domain controllers
I am writing a script to retrieve the last 5 days of application, security and log files from all domain controllers. The script runs, but fire the logs from the local server only. The variable $Computer has all of my DC so it's the fine mark. I guess it's a problem with my line ForEach-Object, but is not error. See the below script.
$log = 'application '.
$date = get-date-format MM-DD-YYYY
$now = get-date
$subtractDays = new-object System.TimeSpan 5,0,0,0,0
$then = $Now.Subtract ($subtractDays)
$Computers = get-ADDomainController-filter *.
ForEach-Object - InputObject $Computers - process {Get-EventLog - LogName $log - after $then - before $now - EntryType error | select EventID, MachineName, Message, Source, TimeGenerated |} ConvertTo-html | {Out-file $env:TEMP\Applicationlog.htm}
Invoke-Expression $env:TEMP\Applicationlog.htmThank you
Rich
Hello
To help with the repost the question script to the script Center Forum
http://social.technet.Microsoft.com/forums/scriptcenter/en-us/home
-
Edit the existing script.
$vCenter = Read-host - prompt "enter hostname vCenter.
to connect-viserver-Server $vCenter - Credential (Get-Credential)
$cluster = read-host - prompt "enter the name of the cluster.
$naa.id = read-host-prompt ", enter the id of naa.
Get-cluster-name '$cluster ' | Get-VMHost | Get-ScsiLun - canonicalName "$naa.id" | Game-ScsiLun - MultipathPolicy "roundrobin".=============================================
In the above script is used to change the political seat RoundRobin data store. When we run the script he invites to vCenter FQDN, identification information, the name of the Cluster and naa.id of the data store.
But I get the error message below.
=============================================================
Property 'id' is not found on this object; Make sure it exists and is settab
the.
C:\users\cz3m7g\desktop\RR.ps1:4 tank: 6
+ $naa. < < < < id = read-host - prompt "enter the id of naa.
+ CategoryInfo: InvalidOperation: (id: String) [], RuntimeExcepti
on
+ FullyQualifiedErrorId: PropertyNotFoundGet-ScsiLun: 08/02/2013-02:41:48 Get ScsiLun could not find ScsiLunI
nterop with CanonicalName "ID".
C:\users\cz3m7g\desktop\RR.ps1:5 char: 56
+ Get-cluster-name '$cluster ' | Get-VMHost | Get-ScsiLun < < < <-canonicalName
"$naa.id" | Game-ScsiLun - MultipathPolicy "roundrobin".
+ CategoryInfo: ObjectNotFound: (.id:String) [Get-ScsiLun], VimE
Xception
+ FullyQualifiedErrorId: Common_CommonUtil_FilterCollection_ObjectNotFoun
d, VMware.VimAutomation.ViCore.cmdlets.Commands.Host.GetScsiLunGet-ScsiLun: 08/02/2013-02:41:49 Get-ScsiLun value cannot be null.
Parameter name: moRef
C:\users\cz3m7g\desktop\RR.ps1:5 char: 56
+ Get-cluster-name '$cluster ' | Get-VMHost | Get-ScsiLun < < < <-canonicalName
"$naa.id" | Game-ScsiLun - MultipathPolicy "roundrobin".
+ CategoryInfo: NotSpecified: (:)) [Get-ScsiLun], VimException)
+ FullyQualifiedErrorId: Core_BaseCmdlet_UnknownError, VMware.VimAutomatio
n.ViCore.Cmdlets.Commands.Host.GetScsiLunLooks like Get-VMHost is not place all the objects in the pipeline.
Are you sure
Get-cluster-name '$cluster ' | Get-VMHost
Returns all objects VMHost?
-
Hello
I have some related issues oppose executing this script to list physical NETWORK card speeds by NIC for each host. The error is:
The method call failed because http://System.Management.Automation.PSObject contains not one me
Taylor named "op_Addition.
Online: 12 char: 23
+ += $NicSpReportObj < < < < $NicSpReportObj
+ CategoryInfo: InvalidOperation: (op_Addition:String)], RuntimeException
+ FullyQualifiedErrorId: MethodNotFound
Hostname Teddy speed
esx14.domain.com pnic0 1000
It will list until I would be the last entry in the object but of course its not adding in the previous info (or deleting it may be).
If someone could take a look it would be great.
Thank you
Dan
Script (also attached):
$VMHosts = get-VMHost | Sort name | Get-View
$NicSpReport = @)
$NicSpReportObj = "" | Select-Object HostName, Teddy bear, speed
Foreach ($VMHost to $VMHosts)
{
$pnic = 0
{}
$Speed = $VMHost.Config.Network.Pnic [$pnic]. LinkSpeed.SpeedMb
$NicSpReportObj.HostName = $VMHost.Name
$NicSpReportObj.pNIC = ' teddy bear$ Teddy. "
$NicSpReportObj.Speed = $speed
$NicSpReportObj += $NicSpReportObj
{$pnic ++}
Until the ($pnic - eq ($VMHost.Config.Network.Pnic.Length))
}
$NicSpReport += $NicSpReportObj
$NicSpReport | FT - AutoSize
I have a little rewriting of your script. I hope it will do what you want now:
Get-VMHost | ForEach-Object { $VMHost = $_ $VMHost.Extensiondata.Config.Network.Pnic | ForEach-Object { $NicSpReportObj = "" | Select-Object HostName, pNIC, Speed $NicSpReportObj.HostName = $VMHost.Name $NicSpReportObj.pNIC = $_.Device $NicSpReportObj.Speed = $_.LinkSpeed.SpeedMb $NicSpReportObj } } | Sort-Object -property HostName,pNIC | Format-Table -AutoSize
Best regards, Robert
Update: moved the Sort-Object cmdlet at the end of the script to also perform a sort on the attribute of Teddy.
Post edited by: RvdNieuwendijk
-
To group the existing objects by using script API?
Am I missing something, or is at - it no way to group the existing objects using the api script? You can add GroupItems (), but that does not help you with existing objects.
You have probably not to duplicate the element, which is just how the examples have been written.
Looking at the code, try to change this:
newItem = docSelection [i] .duplicate ();
newItem.moveToBeginning (newGroup)
to do this:
docSelection [i] .moveToBeginning (newGroup)
-
Can someone help with the scripts on this file?
Hi, I hope someone with a bigger brain can help me here.
I have an existing Flash CS3 file that makes up the result to http://www.infusion-set.com/Flash/eLearning/Inset30/inset30_eguide.html .
The customer asked if I could add an extra tab at the top after that 'group' called 'Contact us' with link to an additional page. The design was done in ActionScript 2 with references to XML files for dynamic content because it has been done in other languages.
I modified the XML file with the correct references to a new page and a .swf file that accompanies it to play in the field of animation.
I tried a .fla version where I duplicated one of the existing tabs script, changed the XML references and changed the variables if necessary to "con or"Con"(which is to reach us). Unfortunately, he made the menu tab go completely off the page and was patently false in some way.
Can someone give me a clue as to what to change here on the original file that I am a novice with ActionScripts, so ask me.
For reference, I have attached the HTML files with scripts of original file and my incorrect version. The chronology is 103 images with the scripts placed in frame 1 and 102
Thank you.
Garry
The buttons are all created using the same library object (but MC), except for the code you have in the revised file does not call on it for the con button.
You calling on something with a name of 'con' link, which tells me that a quick check is not - then it is undefined in the code when you try to use it. I found this by using trace (newConBut._x); After its _x value was assigned, as I said, you should try. So the first thing you want to do is to change the following line from...
var newConBut = _root.attachMovie ("con", "conbut", _root.getNextHighestDepth ());
TO
var newConBut = _root.attachMovie ("but", "conbut", _root.getNextHighestDepth ());
so that it uses the but MC who is used to this end in the library. So, you want to correct the assignment _x of the buttons and I think that you had previously...
newConBut._x = 650 - newConBut._width;
newRecBut._x = newConBut._x - newRecBut._width;Here is a picture of what these changes (note, without the XML file, I had to finagle things just to work, then the labels of biutton are not what they will be)...
-
I have a problem, try to uninstall the ask toolbar. get the error message: unable to access the VB script... need help
Hello
How do you try to uninstall the toolbar?
I would suggest trying the following methods and check if it helps.
Method 1:
Try the steps in the following Microsoft article and check if it helps.
How to fix script errors in Internet Explorer on Windows computers:
http://support.Microsoft.com/kb/308260
Correction of errors in Internet Explorer: http://support.microsoft.com/kb/822521
Method 2:
Try to uninstall the toolbar, programs and features and check if it helps.
Uninstall or change a program:
http://Windows.Microsoft.com/en-us/Windows-Vista/uninstall-or-change-a-program
Hope the information is useful.
-
With the help of the network location and mapped a drive to the server FTP off site; during the transfer of very large amounts of the login information is always lost. Computer power settings are configured to not to do no matter what, I'm assuming that the ftp server can publish a scenerio timeout but is there a way for my computer and windows to restart the file transfer?
Hello
Thanks for posting your question in the Microsoft Community forums.I see from the description of the problem, you have a problem with networking on the FTP server.The question you posted would be better suited in the Technet Forums. I would post the query in the link below.http://social.technet.Microsoft.com/forums/en/w7itpronetworking/threads
Hope this information helps you. If you need additional help or information on Windows, I'll be happy to help you. We, at tender Microsoft to excellence. -
I need help on the matrix of action script 3.0
I need help on the matrix of action script 3.0
[Ask in the correct forum allows... Left non-technical Forum Lounge for forum specific program... MOD]
to apply a matrix for mc mat oppose:
var mat: Matrix = new Matrix;
mat.a = Whatever;
mat.b =
mat.c =
mat.d =
mast. TX =
mat.Ty =
MC. Transform.Matrix = Matt;
-
Hi all
Hoping someone out there can help, I need my script to end with one of the following 3 options:
Select all: as in "cmd one"
Select all the objects on the layer "Tabs".
Select all the objects with the Script title boxes"tabs".
Reason being, when the script ends I need a bunch of boxes to be pre-selected loan for a manual deselect by 1 point (chosen by the user) and then they Deletes selected objects manually to finish. (I didn't understand my original script here as has no impact on the autonomous part I need for the final selection)
Hoping that this is a simple script but as it is rare to have a script of object selection and not do something with them, I think it's impossible to create.
Thank you, Bren
Read the object model and you will find that the equivalent script Cmnd + A is as follows:
app.selection = null; pItems = app.windows[0].activeSpread.pageItems; app.select (pItems, SelectionOptions.ADD_TO);
To select all items in the layer tab page, filter the items in the page:
app.selection = null; pItems = app.windows[0].activeSpread.pageItems; for (i = pItems.length-1; i >= 0; i--) { if (pItems[i].itemLayer.name === 'Tab') { app.select (pItems[i], SelectionOptions.ADD_TO); } }
To select objects with a certain script label is a variant of the (or an addition to) the second script.
Peter
-
How can I import tables from a different schema in the relational model... to add these tables in the existing relational/logic model? PLSS help
Notes; I already have a schema ready relational/logic model... and I need to add more tables to this relational/logic model
can I import the same way like I did before?
But even if I do the same how can I add it in the template? as the logic model has been designed...
Help, please...
Thank you
To view the diagram of logic model in Bachman notation, you right-click on a blank area of the diagram and select the rating > Bachman Notation.
David
-
Can any body help to get a script that can generate the sequence (length 3) with a combination of numbers and characters example: T11... TA1... TZ9... then on
With the help of the clause type
Select sqnc
from (select sqnc
from (select 'T00"sqnc, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' ordr
of the double
)
model
size of (0 I)
measures (sqnc, ordr, length (ordr) len)
rules iterate (1300) until (instr(sqnc[iteration_number],'~')! = 0)
(sqnc [iteration_number] = case when sqnc [cv (i) - 1] is null
then sqnc [0]
of another substr (sqnc [iteration_number - 1], 1, 1) |
-case when substr (sqnc [iteration_number - 1], 2, 1)<=>=>
so when business substr (sqnc [iteration_number - 1], 3, 1)<>
then substr (ordr [0], instr (ordr [0], substr (sqnc [iteration_number - 1], 2, 1)), 1)
of another nvl (substr (ordr [0], instr (ordr [0], substr (sqnc [iteration_number - 1], 2, 1)) + 1.1),'~ ')
end
end |
-case when substr (sqnc [iteration_number - 1], 3, 1)<>
then substr (ordr [0], instr (ordr [0], substr (sqnc [iteration_number - 1], 3, 1)) + 1.1)
else ' 0'
end
end
)
)
where instr(sqnc,'~') = 0
Concerning
Etbin
-
I have a problem check my code for Lightroom 6 help please, the site says code cannot be verified. I have an existing application of Lightroom 2 and I paid for the upgrade
If you purchased the version of LR 6 upgrade then when you install and run for the first time it asks you to Sign In. You must sign in with the same Adobe ID you used to buy it. Then once it's a window will appear asking for a serial number. In this window, you enter the serial number LR 6 What adobe sent you. Then once that went into a second serial number box will appear asking for a serial number from a previous version. Then you enter the serial number LR 2. Series LR 2 will begin with the same 4 numbers, 1160.
Maybe you are looking for
-
My phone will not send SMS.
I awake tonight and found that my iPhone6s + no will not send SMS to anyone. iMessages work very well. I have to be able to roll over the phone. I have hard to restart the phone. iMessages are very good. Other iPhones in the house (older) send fine.
-
Convert from 5.1 in 2011
Could someone please help me to convert 5.1 VL 2011 LV. Well, I'll be appericated.
-
Windows hangs on every game is loading 2.
It is a very strange question that's happened since I reinstalled Windows 7 x 64 Home Premium (after buying a new hard drive). The first game that I play in Windows is fine, regardless of what kind of game it is. However, after the release of the fir
-
WRT54G with TWC new modem does not work anymore
TWC has improved my modem. -before the upgrade, everything worked -I can connect to the internet with modem-> computer -J' cloned my MAC address in the router -J' have most of the things of value by default (gateway, DHCP, etc.). -J' have 2 desktop P
-
Is it possible to trigger a forced memory stack trace?
There, I think of the stack trace that is done automatically on all running applications when "something goes wrong. I have an application that freezes up (I suspect it is a blocking of the thread) and it would be great to have a practical method to