To get a list of the Win32_* classes within Root/CIMV2 on your computer, you can use the following PowerShell Command:
Get-WMIObject -List| Where{$_.name -match "^Win32_"} | Sort Name | Format-Table Name
Last modified by Thomas Lee on 11/23/2009 8:49:53 PM
<#.SYNOPSIS This script encrpyts then decrypts a byte string.DESCRIPTION This script uses System.Security to encrpyt a byte string, then decrypts it..NOTES File Name : Protect-ByteArray.ps1 Author : Thomas Lee - tfl@psp.co.uk Requires : PowerShell V2.LINK This script posted to: http://www.pshscripts.blogspot.com MSDN Sample posted at: http://msdn.microsoft.c
Last modified by Thomas Lee on 11/14/2009 1:54:50 PM
<#.SYNOPSIS This script displays the CA roles of the caller.DESCRIPTION This script instantiates the CA COM object, gets the allowed roles, and displays them. This script also shows use of Bitwise And operations, typical when using output from API calls..NOTES File Name : Get-CARolesofCaller.ps1 Author : Thomas Lee - tfl@psp.co.uk Requires : PowerShell V2.LINK T
Last modified by Thomas Lee on 10/24/2009 6:42:38 PM
# To access this interface in PowerShell - it is necessary to create a com object# The COM Object type is: CertificateAuthority.Admin.1# More detailed scripts will always show the com object creation, then# some use of what's created.# Create com object$CertAdmin = New-Object -com "CertificateAuthority.Admin.1"
Last modified by Vadims Podans on 11/3/2009 8:49:00 PM
# Create the com object$CertAdmin = New-Object -com "CertificateAuthority.Admin.1"# publish Base CRL only$CertAdmin.PublishCRLs("servername\caname", 0, 1)# publish Delta CRL only$CertAdmin.PublishCRLs("servername\caname", 0, 2)
Last modified by Vadims Podans on 11/3/2009 7:15:50 PM
# Create COM object$CertAdmin = New-Object -com "CertificateAuthority.Admin.1" # Revoke certificate with serial number 6ef5e9aa00000000008f# on CA with CAName that is hosted on computer named ServerName with# Superseded reason. Certificate will considered as revoked in 24 hours$CertAdmin.RevokeCertificate("ServerName\CAName","6ef5e9aa00000000008f",4, (Get-Date).AddDays(1))
Last modified by Thomas Lee on 10/24/2009 2:27:24 PM
# Create the COM object$CertAdmin = New-Object -com "CertificateAuthority.Admin.1" # At first we need to get a disposition. And output should be 2 (indicates that certificate is revoked)$CertAdmin.IsValid("ServerName\CAName", "6ef5e9aa00000000008f") # Now check revocation reason$CertAdmin.GetRevocationReason() # return value represents a revocation reason. 0 means CRL_REASON_UNSPECIFIED, 1 — C
Last modified by Thomas Lee on 10/24/2009 2:26:08 PM
# Create the com object$CertAdmin = New-Object -com "CertificateAuthority.Admin.1" # Check Validity$CertAdmin.IsValid("ServerName\CANAme","6ef5e9aa00000000008f")# return value represents certificate disposition status. 0 means CA_DISP_INCOMPLETE, 1 — CA_DISP_ERROR, etc.
Last modified by Thomas Lee on 10/24/2009 2:24:08 PM
# Create admin object$CertAdmin = New-Object -com "CertificateAuthority.Admin.1"# Get CRL to Base64 encoded format $CRL = $CertAdmin.GetCRL("ServerName\CAName", 1)# Convert Base 64 string to byta array$bytes = [System.Convert]::FromBase64String($CRL)# Write this array to regular .CRL file[System.IO.File]::WriteAllBytes('file.crl', $bytes)# to open this file, just invoke it & .\file.crl
Last modified by Thomas Lee on 10/24/2009 2:01:48 PM
$CertAdmin = New-Object -com "CertificateAuthority.Admin.1"$MyRoles = $CertAdmin.GetMyRoles("ServerName\CAName")# parse return value using bitwise AND operator to get granular rights$Roles = 1, 2, 4, 8, 256, 512 | Foreach-Object {$MyRoles -band $_} | Where-Object {$_}switch ($Roles) {1 {"I have CA administrator capability"}2 {"I have CA officer capability"}4 {"I have CA auditor capability"}8 {"I h
Last modified by Thomas Lee on 10/24/2009 12:05:42 PM