function Get-ObjectInformation{<#.SYNOPSISA function used to explore object type information..DESCRIPTIONThe Get-ObjectInformation function provides access to otherwiseburied .NET reflection functionality. There is a large collection ofswitch parameters to help give a large sample of the members foran object passed to the function..NOTESAuthor: Will Steele (wlsteele@gmail.com)Last edited date: 7/19/2012Version 1.0Some of these will return large collections, depending on the assemblybeing referenced, so, it is sometimes a good idea to write to a variablefirst, examine the object size (using .Count) and select -first 5. Onceyou have a small sample set you can then determine which fields you needfor the specific investigation you are using. The key to realize hereis that many of these are in depth .NET objects and they have verylarge property collections..PARAMETER ObjectA mandatory parameter indicating the object to examine..PARAMETER GetConstructorsA switch parameter indicating whether it should return the constructorinformation or not. Default is False..PARAMETER GetCustomAttributesA switch parameter indicating whether it should return the CustomAttributes or not. Default is False..PARAMETER GetCustomAttributesDataA switch parameter indicating whether it should return theCustom Attributes Data or not. Default is False..PARAMETER GetExportedTypesA switch parameter indicating whether it should return the ExportedTypes or not. Default is False. NOTE: These are exported types ofthe assembly as a whole, not just for the referenced type..PARAMETER GetGenericArgumentsA switch parameter indicating whether it should return the GenericArguments or not. Default is False..PARAMETER GetHashCodeA switch parameter indicating whether it should return the HashCode or not. Default is False..PARAMETER GetLoadedModulesA switch parameter indicating whether it should return the LoadedModules or not. Default is False..PARAMETER GetManifestResourceNamesA switch parameter indicating whether it should return theManifest Resource Names or not. Default is False..PARAMETER GetMembersA switch parameter indicating whether it should return the Membersor not. Default is False..PARAMETER GetMethodsA switch parameter indicating whether it should return the Methodsor not. Default is False..PARAMETER GetModulesA switch parameter indicating whether it should return the Modulesor not. Default is False..PARAMETER GetNameA switch parameter indicating whether it should return the Nameor not. Default is False..PARAMETER GetReferencedAssembliesA switch parameter indicating whether it should return the ReferencedAssemblies or not. Default is False..PARAMETER GetTypeA switch parameter indicating whether it should return the Typeinformation or not. Default is False..PARAMETER SummaryA switch parameter indicating whether it should return the functionsummary of which switches are $true. Default is False..INPUTSObject.OUTPUTSReturns a variety of output pertaining to the input objects typedata..EXAMPLE 1$string = "string"Get-ObjectInformation -Object $string -GetTypeSystem.String.EXAMPLE 2$psobject = New-Object -TypeName PSObjectGet-ObjectInformation -Object $psobject -GetExportedTypes | sort nameIsPublic IsSerial Name BaseType-------- -------- ---- --------True True ActionPreference System.EnumTrue True ActionPreferenceStopException System.Management.Automation.RuntimeExceptionTrue False AdapterCodeMethods System.Object...True False WSManConfigurationOption System.Management.Automation.PSTransportOptionTrue False WSManConnectionInfo System.Management.Automation.Runspaces.RunspaceConnection...True False WSManServerChannelEvents System.Object.EXAMPLE 3$contentservice = New-WebServiceProxy -Uri http://services.msdn.microsoft.com/ContentServices/ContentService.asmx -Namespace contentserviceGet-ObjectInformation -Object $contentservice -GetReferencedAssemblies -SummaryVersion Name------- ----4.0.0.0 mscorlib4.0.0.0 System.Web.Services4.0.0.0 System4.0.0.0 System.Xml--- Information Summary ---
PowerShell v3 Function Get ObjectInformation
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar