2.5 KiB
something |Select –Property Get-Member
Select-Object https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/select-object?view=powershell-7.2
Get-Process Explorer | Select-Object -Property ProcessName -ExpandProperty Modules | Format-List
========
Stuck at
Method invocation failed because [System.Management.Automation.PSMethod] does not contain a method named 'FindHost'.
At C:\Users\Mamoncete\Desktop\test.ps1:93 char:17
+ $result = $server.FindHost($_vname)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MethodNotFound
El for fa el lio?
You cannot call a method on a null-valued expression.
At C:\Users\Mamoncete\Desktop\test.ps1:50 char:8
+ $this._connected_servers[$num].FindHost("Test")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvokeMethodOnNull
======================================
Get-SCVMMServer -ComputerName "VMMServer01.Cosco.com" -TCPPort 8100
Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com" -TCPPort 8100
$list = Get-SCVirtualMachine
$list is an array now
foreach ($element in $list){$element.Name}
GOD
Get-Command -Module hyper-v | Out-GridView
https://quick-adviser.com/where-can-i-find-scvmm-server/
Niputis
https://livebook.manning.com/book/windows-powershell-in-action-third-edition/chapter-2/40
Connect-VIServer -Server 10.23.112.235 -Protocol https -User admin -Password pass
https://thesysadminchannel.com/get-all-vmware-snapshots-using-powercli-module/
Get-VM | Get-Snapshot | select VM, Name, Created
format-list
Async/background
https://adamtheautomator.com/powershell-async/
Mayb do a list of background processes, when it finishes/breaks or something removes itself? Mayb a list of pids, a loop that checks if the pid still running, if it is running it waits, if it isnt it get removed, resumes when all ended?
"Best practices"
https://adamtheautomator.com/powershell-best-practices/