PSTypenames for a string object

PS C:\> $myobj = ‘2222’
PS C:\> $myobj.pstypenames
System.String
System.Object
PS C:\> $myobj.pstypenames.add(‘Greg’)
PS C:\> $myobj.pstypenames
System.String
System.Object
PS C:\> [psobject]$myobj2=’2222′
PS C:\> $myobj2.pstypenames.add(‘Greg’)
PS C:\> $myobj2.pstypenames
System.String
System.Object
Greg

 

You have to cast them to PSO first, as it was explained to me on #powershell-help that the string PSO do not propagate members, hence you have to make it manually

Get-VMHostHardware Permission to perform this operation was denied

For a user with read-only

Get-VMHostHardware fails with Permission to perform this operation was denied

Add the Host-Cim-CimInteraction privilege.

hostcim

Download EJBCA certificate with powershell

i came up with this today

add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
    public bool CheckValidationResult(
        ServicePoint srvPoint, X509Certificate certificate,
        WebRequest request, int certificateProblem) {
        return true;
    }
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

you can look up the thumbprint to compare which one it is
get-childitem Cert:\CurrentUser\My

$superadmin = get-childitem Cert:\CurrentUser\My\YOUR_SUPERADMIN_CERT_HASH
invoke-webrequest -Uri "https://infralab.local:32768/ejbca/publicweb/webdist/certdist?cmd=lastcert&installtobrowser=&subject=CN%3dgregu.host.com&format=chain&hidemenu=false" -method "Get" -Certificate $superadmin

what's left is to generate the cert order via csr. this just just downloading the already made cert.

vSphere Lookup Service MOB

https://<vcenter-FQDN>/lookupservice/mob

Using this link:

https://<center-FQDN>/lookupservice/mob/?moid=ServiceRegistration&method=List

You can access the list() method, you have to fill out the filterCriteria

Leave it ‘blank’:

<filterCriteria>
</filterCriteria>

and click the Invoke Method.

From the vCenter appliance itself you can  use the list() method using the lstool.py

/usr/lib/vmidentity/tools/scripts/lstool.py list –url https://localhost/lookupservice/sdk –no-check-cert | grep -v ‘SSL’

Mind that it will hide the SSL part to make screen content  more readable.