xPSDesiredStateConfiguration icon indicating copy to clipboard operation
xPSDesiredStateConfiguration copied to clipboard

xPackage should allow for detection of a successful install through more than just ProductId or Name

Open CaryRoys opened this issue 8 years ago • 7 comments

Current xPackage determines a successful install of a package by checking the Programs and Features registry entries for either a Product Name or a Product ID.

There exists packages which don't brand the system in this way, and instead rely on a file or folder or other miscellaneous registry entry to determine the absence or presence of the package.

Flags should be added for arbitrary registry values/keys, or files/folders.

CaryRoys avatar Apr 30 '18 04:04 CaryRoys

There are undocumented properties, please see issue #370. Would those help? Could you propose a schema.mof for any additional properties you see are needed?

johlju avatar May 15 '18 11:05 johlju

Per your request, my proposal for changes to schema.mof (adding options for keying the presence of a package off of a file, folder or service):

[ClassVersion("1.0.0"),FriendlyName("xPackage")] 
class MSFT_xPackageResource : OMI_BaseResource
{
  [write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure;
  [Key] string Name;
  [required] string Path;
  [Key] string ProductId;
  [write] string Arguments;
  [write,EmbeddedInstance("MSFT_Credential")] string Credential;
  [write] uint32 ReturnCode[];
  [write] string LogPath;
  [read] string PackageDescription;
  [read] string Publisher;
  [read] string InstalledOn;
  [read] uint32 Size;
  [read] string Version;
  [read] boolean Installed;
  [write] string FileHash;
  [write,ValueMap{"SHA1","SHA256","SHA384","SHA512","MD5","RIPEMD160"},Values{"SHA1","SHA256","SHA384","SHA512","MD5","RIPEMD160"}] string HashAlgorithm;
  [write] string SignerSubject;
  [write] string SignerThumbprint;
  [write] string ServerCertificateValidationCallback;
  [write,ValueMap{"LocalMachine","CurrentUser"},Values{"LocalMachine","CurrentUser"}] string InstalledCheckRegHive;
  [write] string InstalledCheckRegKey;
  [write] string InstalledCheckRegValueName;
  [write] string InstalledCheckRegValueData;
  [write] boolean CreateCheckRegValue;
  [write] boolean CheckFile;
  [write] boolean CheckFolder;
  [write] boolean CheckService;
  [write] string InstalledCheckFile;
  [write] string InstalledCheckFolder;
  [write] string InstalledCheckServiceName;
  [write,EmbeddedInstance("MSFT_Credential")] string RunAsCredential;
};

CaryRoys avatar Jul 31 '18 16:07 CaryRoys

To easier read, the new properties are as follows. Would you mind add a short description to the new properties, they way you see each property is gonna be used?

[ClassVersion("1.0.0"),FriendlyName("xPackage")] 
class MSFT_xPackageResource : OMI_BaseResource
{
    ...
    [Write, Description("")] Boolean CheckFile;
    [Write, Description("")] Boolean CheckFolder;
    [Write, Description("")] Boolean CheckService;
    [Write, Description("")] String InstalledCheckFile;
    [Write, Description("")] String InstalledCheckFolder;
    [Write, Description("")] String InstalledCheckServiceName;
    ...
}

johlju avatar Aug 01 '18 09:08 johlju

[ClassVersion("1.0.0"),FriendlyName("xPackage")] class MSFT_xPackageResource : OMI_BaseResource { ... [Write, Description("")] Boolean CheckFile; [Write, Description("")] Boolean CheckFolder; [Write, Description("")] Boolean CheckService; [Write, Description("")] String InstalledCheckFile; [Write, Description("")] String InstalledCheckFolder; [Write, Description("")] String InstalledCheckServiceName; ... }

CheckFile - whether to check a file to determine the presence of the package. CheckFolder - whether to check a folder to determine the presence of the package. CheckService - whether to check a windows service to determine the presence of the package. InstalledCheckFile - the full path to the file to determine the presence of the package InstalledCheckFolder - the full path to the folder to determine the presence of the package InstalledCheckServiceName - the internal name of the service to be used to determine the presence of the package.

On Wed, Aug 1, 2018 at 4:09 AM, Johan Ljunggren [email protected] wrote:

To easier read, the new properties are as follows. Would you mind add a short description to the new properties, they way you see each property is gonna be used?

[ClassVersion("1.0.0"),FriendlyName("xPackage")] class MSFT_xPackageResource : OMI_BaseResource { ... [Write, Description("")] Boolean CheckFile; [Write, Description("")] Boolean CheckFolder; [Write, Description("")] Boolean CheckService; [Write, Description("")] String InstalledCheckFile; [Write, Description("")] String InstalledCheckFolder; [Write, Description("")] String InstalledCheckServiceName; ... }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/413#issuecomment-409507188, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3OkC1pfSAYqadjqCMfl4Th_QknbWDPks5uMXBYgaJpZM4TsGoQ .

CaryRoys avatar Aug 01 '18 19:08 CaryRoys

I wonder if the boolean parameters are necessary? 🤔 For example. iIf $PSBoundParameters.ContainsKey('InstalledCheckFile') equals to $true then that would be the same as having the CheckFile boolean parameter?

Labelled this as enhancement, and help wanted so that anyone in the community can run with this.

johlju avatar Aug 02 '18 07:08 johlju

that seems fair, as far as the boolean params.

I may well take a crack shortly at it myself.

On Thu, Aug 2, 2018 at 2:59 AM, Johan Ljunggren [email protected] wrote:

I wonder if the boolean parameters are not necessary? 🤔 For example. iIf $PSBoundParameters.ContainsKey('InstalledCheckFile') equals to $true then that would be the same as having the CheckFile boolean parameter?

Labelled this as enhancement, and help wanted so that anyone in the community can run with this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/413#issuecomment-409840815, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3OkI9Kjlt_vGVkjtZepg7rQ_nilrv_ks5uMrFMgaJpZM4TsGoQ .

CaryRoys avatar Aug 03 '18 22:08 CaryRoys

@habeebtc Awesome! Looking forward to the PR. 😃

johlju avatar Aug 06 '18 08:08 johlju