//Constructor /// <summary> /// Initializes a new instance of the <see cref="AI_InstalledSoftwareCache"/> class. /// </summary> /// <param name="WMIObject">A WMI object.</param> /// <param name="RemoteRunspace">The remote runspace.</param> /// <param name="PSCode">The PowerShell code.</param> public AI_InstalledSoftwareCache(PSObject WMIObject, Runspace RemoteRunspace, TraceSource PSCode) { remoteRunspace = RemoteRunspace; pSCode = PSCode; oNewBase = new baseInit(remoteRunspace, pSCode); this.__CLASS = (WMIObject.Properties["__CLASS"] == null) ? WMIObject.Properties["CimClass"].Value as string : WMIObject.Properties["__CLASS"].Value as string; this.__CLASS = (WMIObject.Properties["__NAMESPACE"] == null) ? "" as string : WMIObject.Properties["__NAMESPACE"].Value as string; this.__CLASS = (WMIObject.Properties["__RELPATH"] == null) ? "" : WMIObject.Properties["__RELPATH"].Value as string; this.__INSTANCE = true; this.WMIObject = WMIObject; this.ARPDisplayName = WMIObject.Properties["ARPDisplayName"].Value as String; this.ChannelCode = WMIObject.Properties["ChannelCode"].Value as String; this.ChannelID = WMIObject.Properties["ChannelID"].Value as String; this.CM_DSLID = WMIObject.Properties["CM_DSLID"].Value as String; this.EvidenceSource = WMIObject.Properties["EvidenceSource"].Value as String; try { DateTime?dInstallDate = WMIObject.Properties["InstallDate"].Value as DateTime?; if (dInstallDate != null) { this.InstallDate = ((DateTime)dInstallDate).ToString("u"); } else { this.InstallDate = (WMIObject.Properties["InstallDate"].Value == null) ? "" : WMIObject.Properties["InstallDate"].Value.ToString(); } } catch { } this.InstallDirectoryValidation = WMIObject.Properties["InstallDirectoryValidation"].Value as String; this.InstalledLocation = WMIObject.Properties["InstalledLocation"].Value as String; this.InstallSource = WMIObject.Properties["InstallSource"].Value as String; this.InstallType = WMIObject.Properties["InstallType"].Value as String; this.Language = WMIObject.Properties["Language"].Value as String; this.LocalPackage = WMIObject.Properties["LocalPackage"].Value as String; this.MPC = WMIObject.Properties["MPC"].Value as String; this.OsComponent = WMIObject.Properties["OsComponent"].Value as String; this.PackageCode = WMIObject.Properties["PackageCode"].Value as String; this.ProductID = WMIObject.Properties["ProductID"].Value as String; this.ProductName = WMIObject.Properties["ProductName"].Value as String; this.ProductVersion = WMIObject.Properties["ProductVersion"].Value as String; this.Publisher = WMIObject.Properties["Publisher"].Value as String; this.RegisteredUser = WMIObject.Properties["RegisteredUser"].Value as String; this.ServicePack = WMIObject.Properties["ServicePack"].Value as String; this.SoftwareCode = WMIObject.Properties["SoftwareCode"].Value as String; this.SoftwarePropertiesHash = WMIObject.Properties["SoftwarePropertiesHash"].Value as String; this.SoftwarePropertiesHashEx = WMIObject.Properties["SoftwarePropertiesHashEx"].Value as String; this.UninstallString = WMIObject.Properties["UninstallString"].Value as String; this.UpgradeCode = WMIObject.Properties["UpgradeCode"].Value as String; this.VersionMajor = WMIObject.Properties["VersionMajor"].Value as String; this.VersionMinor = WMIObject.Properties["VersionMinor"].Value as String; }
//Constructor public BoundaryGroupCache(PSObject WMIObject, Runspace RemoteRunspace, TraceSource PSCode) { remoteRunspace = RemoteRunspace; pSCode = PSCode; oNewBase = new baseInit(remoteRunspace, pSCode); __CLASS = WMIObject.Properties["__CLASS"].Value as string; __NAMESPACE = WMIObject.Properties["__NAMESPACE"].Value as string; __RELPATH = WMIObject.Properties["__RELPATH"].Value as string; __INSTANCE = true; this.WMIObject = WMIObject; BoundaryGroupIDs = WMIObject.Properties["BoundaryGroupIDs"].Value as String[]; CacheToken = WMIObject.Properties["CacheToken"].Value as String; }
//Constructor /// <summary> /// Initializes a new instance of the <see cref="Win32_Service"/> class. /// </summary> /// <param name="WMIObject">The WMI object.</param> /// <param name="RemoteRunspace">The remote runspace.</param> /// <param name="PSCode">The PowerShell code.</param> public Win32_Service(PSObject WMIObject, Runspace RemoteRunspace, TraceSource PSCode) : base(WMIObject, RemoteRunspace, PSCode) { remoteRunspace = RemoteRunspace; pSCode = PSCode; oNewBase = new baseInit(remoteRunspace, pSCode); this.__CLASS = WMIObject.Properties["__CLASS"].Value as string; this.__NAMESPACE = WMIObject.Properties["__NAMESPACE"].Value as string; this.__RELPATH = WMIObject.Properties["__RELPATH"].Value as string; this.__INSTANCE = true; this.WMIObject = WMIObject; this.CheckPoint = WMIObject.Properties["CheckPoint"].Value as UInt32?; this.ProcessId = WMIObject.Properties["ProcessId"].Value as UInt32?; this.WaitHint = WMIObject.Properties["WaitHint"].Value as UInt32?; }
/// <summary> /// Constructor /// </summary> /// <param name="WMIObject"></param> /// <param name="RemoteRunspace"></param> /// <param name="PSCode"></param> public SMS_DesiredConfiguration(PSObject WMIObject, Runspace RemoteRunspace, TraceSource PSCode) { remoteRunspace = RemoteRunspace; pSCode = PSCode; oNewBase = new baseInit(remoteRunspace, pSCode); this.__CLASS = WMIObject.Properties["__CLASS"].Value as string; this.__NAMESPACE = WMIObject.Properties["__NAMESPACE"].Value as string; this.__RELPATH = WMIObject.Properties["__RELPATH"].Value as string; this.__INSTANCE = true; this.WMIObject = WMIObject; this.ComplianceDetails = WMIObject.Properties["ComplianceDetails"].Value as String; this.DisplayName = WMIObject.Properties["DisplayName"].Value as String; this.IsMachineTarget = WMIObject.Properties["IsMachineTarget"].Value as Boolean?; this.LastComplianceStatus = WMIObject.Properties["LastComplianceStatus"].Value as UInt32?; string sLastEvalTime = WMIObject.Properties["LastEvalTime"].Value as string; if (string.IsNullOrEmpty(sLastEvalTime)) { this.LastEvalTime = null; } else { try { this.LastEvalTime = ManagementDateTimeConverter.ToDateTime(sLastEvalTime) as DateTime?; } catch { } } this.Name = WMIObject.Properties["Name"].Value as String; this.Status = WMIObject.Properties["Status"].Value as UInt32?; this.Version = WMIObject.Properties["Version"].Value as String; if (this.LastComplianceStatus == 1) { this.isCompliant = true; } else { this.isCompliant = false; } _RawObject = WMIObject; }
/// <summary> /// Initializes a new instance of the <see cref="CacheInfoEx"/> class. /// </summary> /// <param name="WMIObject">The WMI object.</param> /// <param name="RemoteRunspace">The remote runspace.</param> /// <param name="PSCode">The PowerShell code.</param> public CacheInfoEx(PSObject WMIObject, Runspace RemoteRunspace, TraceSource PSCode) { remoteRunspace = RemoteRunspace; pSCode = PSCode; oNewBase = new baseInit(remoteRunspace, pSCode); __CLASS = WMIObject.Properties["__CLASS"].Value as string; __NAMESPACE = WMIObject.Properties["__NAMESPACE"].Value as string; __RELPATH = WMIObject.Properties["__RELPATH"].Value as string; __INSTANCE = true; this.WMIObject = WMIObject; //New in Build1510 (2016) try { ContentFlags = WMIObject.Properties["PeerCaching"].Value as UInt32?; } catch { ContentFlags = null; } CacheId = WMIObject.Properties["CacheId"].Value as string; ContentId = WMIObject.Properties["ContentId"].Value as string; try { ContentSize = WMIObject.Properties["ContentSize"].Value as UInt32?; } catch { ContentSize = null; } ContentType = WMIObject.Properties["ContentType"].Value as string; ContentVer = WMIObject.Properties["ContentVer"].Value as string; //New in Build1510 (2016) try { ExcludeFileList = WMIObject.Properties["ExcludeFileList"].Value as string; } catch { ExcludeFileList = ""; } string sLastEvalTime = WMIObject.Properties["LastReferenced"].Value as string; if (string.IsNullOrEmpty(sLastEvalTime)) { LastReferenced = null; } else { LastReferenced = ManagementDateTimeConverter.ToDateTime(sLastEvalTime) as DateTime?; } Location = WMIObject.Properties["Location"].Value as string; //New in Build1510 (2016) try { PeerCaching = WMIObject.Properties["PeerCaching"].Value as bool?; } catch { PeerCaching = false; } try { PersistInCache = WMIObject.Properties["PersistInCache"].Value as UInt32?; } catch { PersistInCache = null; } try { ReferenceCount = WMIObject.Properties["ReferenceCount"].Value as UInt32?; } catch { ReferenceCount = null; } }
//Constructor /// <summary> /// Initializes a new instance of the <see cref="CIM_Process" /> class. /// </summary> /// <param name="WMIObject">The WMI object.</param> /// <param name="RemoteRunspace">The remote runspace.</param> /// <param name="PSCode">The PowerShell code.</param> public Win32_Process(PSObject WMIObject, Runspace RemoteRunspace, TraceSource PSCode) : base(WMIObject, RemoteRunspace, PSCode) { remoteRunspace = RemoteRunspace; pSCode = PSCode; oNewBase = new baseInit(remoteRunspace, pSCode); this.__CLASS = WMIObject.Properties["__CLASS"].Value as string; this.__NAMESPACE = WMIObject.Properties["__NAMESPACE"].Value as string; this.__RELPATH = WMIObject.Properties["__RELPATH"].Value as string; this.__INSTANCE = true; this.WMIObject = WMIObject; this.CommandLine = WMIObject.Properties["CommandLine"].Value as String; this.ExecutablePath = WMIObject.Properties["ExecutablePath"].Value as String; this.HandleCount = WMIObject.Properties["HandleCount"].Value as UInt32?; this.MaximumWorkingSetSize = WMIObject.Properties["MaximumWorkingSetSize"].Value as UInt32?; this.MinimumWorkingSetSize = WMIObject.Properties["MinimumWorkingSetSize"].Value as UInt32?; this.OtherOperationCount = WMIObject.Properties["OtherOperationCount"].Value as UInt64?; this.OtherTransferCount = WMIObject.Properties["OtherTransferCount"].Value as UInt64?; this.PageFaults = WMIObject.Properties["PageFaults"].Value as UInt32?; this.PageFileUsage = WMIObject.Properties["PageFileUsage"].Value as UInt32?; this.ParentProcessId = WMIObject.Properties["ParentProcessId"].Value as UInt32?; this.PeakPageFileUsage = WMIObject.Properties["PeakPageFileUsage"].Value as UInt32?; this.PeakVirtualSize = WMIObject.Properties["PeakVirtualSize"].Value as UInt64?; this.PeakWorkingSetSize = WMIObject.Properties["PeakWorkingSetSize"].Value as UInt32?; this.PrivatePageCount = WMIObject.Properties["PrivatePageCount"].Value as UInt64?; this.ProcessId = WMIObject.Properties["ProcessId"].Value as UInt32?; this.QuotaNonPagedPoolUsage = WMIObject.Properties["QuotaNonPagedPoolUsage"].Value as UInt32?; this.QuotaPagedPoolUsage = WMIObject.Properties["QuotaPagedPoolUsage"].Value as UInt32?; this.QuotaPeakNonPagedPoolUsage = WMIObject.Properties["QuotaPeakNonPagedPoolUsage"].Value as UInt32?; this.QuotaPeakPagedPoolUsage = WMIObject.Properties["QuotaPeakPagedPoolUsage"].Value as UInt32?; this.ReadOperationCount = WMIObject.Properties["ReadOperationCount"].Value as UInt64?; this.ReadTransferCount = WMIObject.Properties["ReadTransferCount"].Value as UInt64?; this.SessionId = WMIObject.Properties["SessionId"].Value as UInt32?; this.ThreadCount = WMIObject.Properties["ThreadCount"].Value as UInt32?; this.VirtualSize = WMIObject.Properties["VirtualSize"].Value as UInt64?; this.WindowsVersion = WMIObject.Properties["WindowsVersion"].Value as String; this.WriteOperationCount = WMIObject.Properties["WriteOperationCount"].Value as UInt64?; this.WriteTransferCount = WMIObject.Properties["WriteTransferCount"].Value as UInt64?; }
//Constructor /// <summary> /// Initializes a new instance of the <see cref="AI_InstalledSoftwareCache"/> class. /// </summary> /// <param name="WMIObject">A WMI object.</param> /// <param name="RemoteRunspace">The remote runspace.</param> /// <param name="PSCode">The PowerShell code.</param> public AI_InstalledSoftwareCache(PSObject WMIObject, Runspace RemoteRunspace, TraceSource PSCode) { remoteRunspace = RemoteRunspace; pSCode = PSCode; oNewBase = new baseInit(remoteRunspace, pSCode); this.__CLASS = WMIObject.Properties["__CLASS"].Value as string; this.__NAMESPACE = WMIObject.Properties["__NAMESPACE"].Value as string; this.__RELPATH = WMIObject.Properties["__RELPATH"].Value as string; this.__INSTANCE = true; this.WMIObject = WMIObject; this.ARPDisplayName = WMIObject.Properties["ARPDisplayName"].Value as String; this.ChannelCode = WMIObject.Properties["ChannelCode"].Value as String; this.CM_DSLID = WMIObject.Properties["CM_DSLID"].Value as String; this.EvidenceSource = WMIObject.Properties["EvidenceSource"].Value as String; this.InstallDate = WMIObject.Properties["InstallDate"].Value as String; this.InstallDirectoryValidation = WMIObject.Properties["InstallDirectoryValidation"].Value as String; this.InstalledLocation = WMIObject.Properties["InstalledLocation"].Value as String; this.InstallSource = WMIObject.Properties["InstallSource"].Value as String; this.InstallType = WMIObject.Properties["InstallType"].Value as String; this.Language = WMIObject.Properties["Language"].Value as String; this.LocalPackage = WMIObject.Properties["LocalPackage"].Value as String; this.ProductID = WMIObject.Properties["ProductID"].Value as String; this.ProductName = WMIObject.Properties["ProductName"].Value as String; this.ProductVersion = WMIObject.Properties["ProductVersion"].Value as String; this.Publisher = WMIObject.Properties["Publisher"].Value as String; this.RegisteredUser = WMIObject.Properties["RegisteredUser"].Value as String; this.ServicePack = WMIObject.Properties["ServicePack"].Value as String; this.SoftwareCode = WMIObject.Properties["SoftwareCode"].Value as String; this.SoftwarePropertiesHash = WMIObject.Properties["SoftwarePropertiesHash"].Value as String; this.SoftwarePropertiesHashEx = WMIObject.Properties["SoftwarePropertiesHashEx"].Value as String; this.UninstallString = WMIObject.Properties["UninstallString"].Value as String; this.UpgradeCode = WMIObject.Properties["UpgradeCode"].Value as String; this.VersionMajor = WMIObject.Properties["VersionMajor"].Value as String; this.VersionMinor = WMIObject.Properties["VersionMinor"].Value as String; }