Uploaded by Isaac Carrillo

Module 15

advertisement
EXAMPLE 1: .Net Framework
PS C:\Users\HP> $myDT = New-Object DateTime
PS C:\Users\HP> $myDT
Monday, January 1, 0001 12:00:00 AM
PS C:\Users\HP> $myDT.AddMinutes(45)
Monday, January 1, 0001 12:45:00 AM
PS C:\Users\HP> $myDT.AddDays(300)
Sunday, October 28, 0001 12:00:00 AM
EXAMPLE 2: COM
PS C:\Users\HP> $word = New-Object -ComObject Excel.Application
PS C:\Users\HP> $word.Visible = $true
EXAMPLE 3: WMI
PS C:\Users\HP> $computer = Get-WmiObject Win32_ComputerSystem
PS C:\Users\HP> $computer | Select =
=
-
PS C:\Users\HP> $computer | Select Manufacturer, SystemType, Model
Manufacturer SystemType Model
------------ ---------- ----HP
x64-based PC HP EliteBook 840 G5
PS C:\Users\HP> $computer = Get-WmiObject Win32_ComputerSystem
PS C:\Users\HP> $computer | Select *
PSComputerName
: DESKTOP-VH2DJVL
AdminPasswordStatus
BootupState
:0
: Normal boot
ChassisBootupState
:3
KeyboardPasswordStatus
:0
PowerOnPasswordStatus
:0
PowerSupplyState
PowerState
:3
:0
FrontPanelResetStatus
ThermalState
Status
Name
:0
:3
: OK
: DESKTOP-VH2DJVL
PowerManagementCapabilities :
PowerManagementSupported :
__GENUS
__CLASS
__SUPERCLASS
__DYNASTY
:2
: Win32_ComputerSystem
: CIM_UnitaryComputerSystem
: CIM_ManagedSystemElement
__RELPATH
: Win32_ComputerSystem.Name="DESKTOP-VH2DJVL"
__PROPERTY_COUNT
: 64
__DERIVATION
: {CIM_UnitaryComputerSystem, CIM_ComputerSystem, CIM_System,
CIM_LogicalElement...}
__SERVER
: DESKTOP-VH2DJVL
__NAMESPACE
: root\cimv2
__PATH
VH2DJVL"
: \\DESKTOP-VH2DJVL\root\cimv2:Win32_ComputerSystem.Name="DESKTOP-
AutomaticManagedPagefile : True
AutomaticResetBootOption : True
AutomaticResetCapability : True
BootOptionOnLimit
:
BootOptionOnWatchDog
:
BootROMSupported
BootStatus
Caption
: True
: {0, 0, 0, 11...}
: DESKTOP-VH2DJVL
ChassisSKUNumber
:
CreationClassName
: Win32_ComputerSystem
CurrentTimeZone
: -420
DaylightInEffect
:
Description
: AT/AT COMPATIBLE
DNSHostName
Domain
: DESKTOP-VH2DJVL
: WORKGROUP
DomainRole
:0
EnableDaylightSavingsTime : True
HypervisorPresent
: False
InfraredSupported
: False
InitialLoadInfo
InstallDate
:
:
LastLoadInfo
:
Manufacturer
: HP
Model
: HP EliteBook 840 G5
NameFormat
:
NetworkServerModeEnabled : True
NumberOfLogicalProcessors : 8
NumberOfProcessors
:1
OEMLogoBitmap
:
OEMStringArray
:
{FBYTE#3X476J6S6b7B7H7M7Q7W7m7saBaEapaqauawbUbhcAdUdpdqgdhKhkjh.g,
BUILDID#17WWCSBT602#SABA#DABA;, EDK2_1, Buff=2...}
PartOfDomain
: False
PauseAfterReset
: -1
PCSystemType
:2
PCSystemTypeEx
:2
PrimaryOwnerContact
:
PrimaryOwnerName
: HP
ResetCapability
:1
ResetCount
: -1
ResetLimit
Roles
: -1
: {LM_Workstation, LM_Server, NT}
SupportContactDescription :
SystemFamily
: 103C_5336AN HP EliteBook
SystemSKUNumber
: 3YG93UC#ABA
SystemStartupDelay
:
SystemStartupOptions
SystemStartupSetting
SystemType
TotalPhysicalMemory
:
:
: x64-based PC
: 17015463936
UserName
: DESKTOP-VH2DJVL\HP
WakeUpType
:6
Workgroup
: WORKGROUP
Scope
: System.Management.ManagementScope
Path
VH2DJVL"
: \\DESKTOP-VH2DJVL\root\cimv2:Win32_ComputerSystem.Name="DESKTOP-
Options
: System.Management.ObjectGetOptions
ClassPath
: \\DESKTOP-VH2DJVL\root\cimv2:Win32_ComputerSystem
Properties
: {AdminPasswordStatus, AutomaticManagedPagefile, AutomaticResetBootOption,
AutomaticResetCapability...}
SystemProperties
Qualifiers
Site
: {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY...}
: {dynamic, Locale, provider, UUID}
:
Container
:
PS C:\Users\HP> $computer | Select Manufacturer, SystemType, Model
Manufacturer SystemType Model
------------ ---------- ----HP
x64-based PC HP EliteBook 840 G5
OR
PS C:\Users\HP> Get-WmiObject -NameSpace "root/default" -List
NameSpace: ROOT\default
Name
----
Methods
-------
CIM_Indication
Properties
----------
{}
{CorrelatedIndications, IndicationFilterName, Indication...
CIM_ClassIndication
{}
{ClassDefinition, CorrelatedIndications, IndicationFilte...
CIM_ClassDeletion
{}
{ClassDefinition, CorrelatedIndications, IndicationFilte...
CIM_ClassCreation
{}
{ClassDefinition, CorrelatedIndications, IndicationFilte...
CIM_ClassModification
{}
{ClassDefinition, CorrelatedIndications, IndicationFilte...
CIM_InstIndication
{}
{CorrelatedIndications, IndicationFilterName, Indication...
CIM_InstCreation
{}
{CorrelatedIndications, IndicationFilterName, Indication...
CIM_InstModification
{}
CIM_InstDeletion
{}
__NotifyStatus
{CorrelatedIndications, IndicationFilterName, Indication...
{}
{StatusCode}
__ExtendedStatus
{}
CIM_Error
{Description, Operation, ParameterInfo, ProviderName...}
{}
{CIMStatusCode, CIMStatusCodeDescription, ErrorSource, E...
MSFT_WmiError
{}
MSFT_ExtendedStatus
error_Category...
{CIMStatusCode, CIMStatusCodeDescription,
{}
{}
{}
{Domain, Name, SID, SidLength...}
__NTLMUser9X
__ACE
{CIMStatusCode, CIMStatusCodeDescription, error_Category...
{}
__SecurityRelatedClass
__Trustee
{CorrelatedIndications, IndicationFilterName, Indication...
{}
{Authority, Flags, Mask, Name...}
{}
{AccessMask, AceFlags, AceType, GuidInheritedObjectType...}
__SecurityDescriptor
{}
{ControlFlags, DACL, Group, Owner...}
__PARAMETERS
{}
{}
__SystemClass
{}
__ProviderRegistration
{}
{}
{provider}
__EventProviderRegistration
{}
{EventQueryList, provider}
__ObjectProviderRegistration
Supports...
{}
{InteractionType, provider, QuerySupportLevels,
__ClassProviderRegistration
p...
{}
__InstanceProviderRegistration
Supports...
{CacheRefreshInterval, InteractionType, PerUserSchema,
{}
{InteractionType, provider, QuerySupportLevels,
__MethodProviderRegistration
{}
{provider}
__PropertyProviderRegistration
{}
{provider, SupportsGet, SupportsPut}
__EventConsumerProviderRegistration {}
__thisNAMESPACE
{}
{ConsumerClassNames, provider}
{SECURITY_DESCRIPTOR}
__NAMESPACE
{}
{Name}
__IndicationRelated
{}
{}
__FilterToConsumerBinding
DeliveryQoS...
{}
__EventConsumer
{Consumer, CreatorSID, DeliverSynchronously,
{}
LogFileEventConsumer
{CreatorSID, MachineName, MaximumQueueSize}
{}
ActiveScriptEventConsumer
MaximumQueueSize...}
{CreatorSID, Filename, IsUnicode, MachineName...}
{}
NTEventLogEventConsumer
{CreatorSID, KillTimeout, MachineName,
{}
SMTPEventConsumer
{Category, CreatorSID, EventID, EventType...}
{}
{BccLine, CcLine, CreatorSID, FromLine...}
CommandLineEventConsumer
CreateNewProcess...
{}
{CommandLineTemplate, CreateNewConsole,
__AggregateEvent
{}
{NumberOfEvents, Representative}
__TimerNextFiring
{}
{NextEvent64BitTime, TimerId}
__EventFilter
__Event
{}
{}
__NamespaceOperationEvent
TIME_CREATED}
{CreatorSID, EventAccess, EventNamespace, Name...}
{SECURITY_DESCRIPTOR, TIME_CREATED}
{}
__NamespaceModificationEvent
TargetNamespace...
{}
{SECURITY_DESCRIPTOR, TargetNamespace,
{PreviousNamespace, SECURITY_DESCRIPTOR,
__NamespaceDeletionEvent
TIME_CREATED}
{}
{SECURITY_DESCRIPTOR, TargetNamespace,
__NamespaceCreationEvent
TIME_CREATED}
{}
{SECURITY_DESCRIPTOR, TargetNamespace,
__ClassOperationEvent
{}
__ClassDeletionEvent
{SECURITY_DESCRIPTOR, TargetClass, TIME_CREATED}
{}
__ClassModificationEvent
TIME_C...
{SECURITY_DESCRIPTOR, TargetClass, TIME_CREATED}
{}
__ClassCreationEvent
{PreviousClass, SECURITY_DESCRIPTOR, TargetClass,
{}
__InstanceOperationEvent
{SECURITY_DESCRIPTOR, TargetClass, TIME_CREATED}
{}
__InstanceCreationEvent
{SECURITY_DESCRIPTOR, TargetInstance, TIME_CREATED}
{}
{SECURITY_DESCRIPTOR, TargetInstance, TIME_CREATED}
__MethodInvocationEvent
{}
{Method, Parameters, PreCall, SECURITY_DESCRIPTOR...}
__InstanceModificationEvent
TargetInstance, ...
{}
{PreviousInstance, SECURITY_DESCRIPTOR,
__InstanceDeletionEvent
{}
{SECURITY_DESCRIPTOR, TargetInstance, TIME_CREATED}
__TimerEvent
{}
{NumFirings, SECURITY_DESCRIPTOR, TIME_CREATED, TimerId}
__ExtrinsicEvent
{}
{SECURITY_DESCRIPTOR, TIME_CREATED}
__SystemEvent
{}
{SECURITY_DESCRIPTOR, TIME_CREATED}
__EventDroppedEvent
TIME_CREA...
{}
{Event, IntendedConsumer, SECURITY_DESCRIPTOR,
__EventQueueOverflowEvent
SECURITY_DES...
__QOSFailureEvent
{}
{}
__ConsumerFailureEvent
{CurrentQueueSize, Event, IntendedConsumer,
{ErrorCode, ErrorDescription, Event, IntendedConsumer...}
{}
RegistryEvent
{}
{ErrorCode, ErrorDescription, ErrorObject, Event...}
{SECURITY_DESCRIPTOR, TIME_CREATED}
RegistryKeyChangeEvent
{}
{Hive, KeyPath, SECURITY_DESCRIPTOR, TIME_CREATED}
RegistryTreeChangeEvent
{}
{Hive, RootPath, SECURITY_DESCRIPTOR, TIME_CREATED}
RegistryValueChangeEvent
{}
{Hive, KeyPath, SECURITY_DESCRIPTOR, TIME_CREATED...}
__EventGenerator
{}
{}
__TimerInstruction
{}
{SkipIfPassed, TimerId}
__AbsoluteTimerInstruction
{}
__IntervalTimerInstruction
__Provider
__Win32Provider
{}
{}
{EventDateTime, SkipIfPassed, TimerId}
{IntervalBetweenEvents, SkipIfPassed, TimerId}
{Name}
{}
{ClientLoadableCLSID, CLSID, Concurrency, DefaultMachine...
__CIMOMIdentification
VersionUsedToCr...
__AdapStatus
__SystemSecurity
StdRegProv
SystemRestoreConfig
SystemRestore
RestorePointType...}
{}
{}
{SetupDateTime, VersionCurrentlyRunning,
{LastStartTime, LastStopTime, Status}
{GetSD, GetSecuri... {}
{CreateKey, Delet... {}
{}
{DiskPercent, MyKey, RPGlobalInterval, RPLifeInterval...}
{CreateRestorePoi... {CreationTime, Description, EventType,
Download