diff --git a/README.md b/README.md index e111a47..8db5148 100644 --- a/README.md +++ b/README.md @@ -43,4 +43,9 @@ The Windows Installer PowerShell module is licensed under the [MIT License](LICE ## Status -[![Build status](https://ci.appveyor.com/api/projects/status/251twb4wvywq0vei/branch/master?svg=true)](https://ci.appveyor.com/project/heaths/psmsi/branch/master) +[Project build status](https://ci.appveyor.com/project/heaths/psmsi) for release and development branches. + +Branch | Status +--- | --- +**master** | [![Build status](https://ci.appveyor.com/api/projects/status/251twb4wvywq0vei/branch/master?svg=true)](https://ci.appveyor.com/project/heaths/psmsi/branch/master) +**develop** | [![Build status](https://ci.appveyor.com/api/projects/status/251twb4wvywq0vei/branch/develop?svg=true)](https://ci.appveyor.com/project/heaths/psmsi/branch/develop) diff --git a/appveyor.yml b/appveyor.yml index 9ed8432..9819adc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,9 +3,15 @@ pull_requests: do_not_increment_build_number: true skip_tags: true +notifications: +- provider: GitHubPullRequest + on_build_success: true + on_build_failure: true + branches: only: - master + - develop cache: - packages -> **\packages.config @@ -34,7 +40,6 @@ deploy: auth_token: secure: 5K94QY8dHKlbjvlBpQaXwAkmDf+LQE3g5WlU9snnNMjDjf0UT4xDoOBCLWcmwZOm artifact: installer, package - prerelease: true on: branch: master @@ -44,6 +49,13 @@ deploy: secure: 4STrzCp6wDsDBj/wCtmImMVL7wUI8DCGjdMBXGqQf9JZJ8LjmW5YSY8wtcHAv0XW artifact: package skip_symbols: true - prerelease: true + on: + branch: master + + - provider: NuGet + server: https://nuget.smbsrc.net/ + api_key: + secure: WPxjuSouwbCdM6I771BfIbOk8gA883+l9RKUCfFknaUT1vYPmTpT2ABF9r+J0JgR + artifact: /.*\.symbols\.nupkg/ on: branch: master diff --git a/inc/Common.csproj.targets b/inc/Common.csproj.targets index 739e906..973b6d8 100644 --- a/inc/Common.csproj.targets +++ b/inc/Common.csproj.targets @@ -22,6 +22,9 @@ false $(IncludeDir)KeyFile.snk + + ..\..\inc\Common.ruleset + Properties\BrandingInfo.cs diff --git a/inc/Common.ruleset b/inc/Common.ruleset new file mode 100644 index 0000000..030cf28 --- /dev/null +++ b/inc/Common.ruleset @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/PowerShell/ActionText.cs b/src/PowerShell/ActionText.cs index 02d649d..6a2fb82 100644 --- a/src/PowerShell/ActionText.cs +++ b/src/PowerShell/ActionText.cs @@ -1,4 +1,26 @@ -using System; +// The MIT License (MIT) +// +// Copyright (c) Microsoft Corporation +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using System; using System.Globalization; using System.Resources; diff --git a/src/PowerShell/AttributeColumn.cs b/src/PowerShell/AttributeColumn.cs index fea5b31..60565be 100644 --- a/src/PowerShell/AttributeColumn.cs +++ b/src/PowerShell/AttributeColumn.cs @@ -39,7 +39,7 @@ private enum UndefinedType } /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// /// The type of the enumeration. /// The value of the enumeration. @@ -173,10 +173,10 @@ internal bool HasValue(string name) // A 32-bit integer is the largest integer supported by Windows Installer. /// - /// Converts an to an . + /// Converts an to an . /// /// The to convert. - /// The value of the . + /// The value of the . public static implicit operator int(AttributeColumn column) { if (null != column) @@ -188,20 +188,20 @@ public static implicit operator int(AttributeColumn column) } /// - /// Converts an to an . + /// Converts an to an . /// - /// The value to convert. - /// The with the value of the . + /// The value to convert. + /// The with the value of the . public static implicit operator AttributeColumn(int value) { return new AttributeColumn(null, value); } /// - /// Converts an to a nullable . + /// Converts an to a nullable . /// /// The to convert. - /// The nullable value of the . + /// The nullable value of the . public static implicit operator int?(AttributeColumn column) { if (null != column) @@ -213,10 +213,10 @@ public static implicit operator AttributeColumn(int value) } /// - /// Converts a nullable to an . + /// Converts a nullable to an . /// - /// The nullable value to convert. - /// The with the value of the nullable . + /// The nullable value to convert. + /// The with the value of the nullable . public static implicit operator AttributeColumn(int? value) { return new AttributeColumn(null, value); diff --git a/src/PowerShell/Cache.cs b/src/PowerShell/Cache.cs index b4d29b8..cda00cd 100644 --- a/src/PowerShell/Cache.cs +++ b/src/PowerShell/Cache.cs @@ -38,14 +38,15 @@ internal sealed class Cache private CacheItemSorter sorter; /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// - internal Cache() : this(DefaultCapacity) + internal Cache() + : this(DefaultCapacity) { } /// - /// Creates a new instance of the class using the given . + /// Initializes a new instance of the class. /// /// The initial capacity that should not be exceeded. internal Cache(int capacity) diff --git a/src/PowerShell/CharComparer.cs b/src/PowerShell/CharComparer.cs index 32fea2c..8ff3bd2 100644 --- a/src/PowerShell/CharComparer.cs +++ b/src/PowerShell/CharComparer.cs @@ -20,13 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using System; using System.Collections.Generic; namespace Microsoft.Tools.WindowsInstaller { /// - /// Equality comparer for a . + /// Equality comparer for a . /// internal sealed class CharComparer : IEqualityComparer { @@ -45,30 +44,30 @@ private CharComparer(bool ignoreCase) /// /// Gets whether and are equal. /// - /// The first to compare. - /// The second to compare. + /// The first to compare. + /// The second to compare. /// True if equals . public bool Equals(char x, char y) { if (this.ignoreCase) { - x = Char.ToLowerInvariant(x); - y = Char.ToLowerInvariant(y); + x = char.ToLowerInvariant(x); + y = char.ToLowerInvariant(y); } return x.Equals(y); } /// - /// Gets the hash code of the given . + /// Gets the hash code of the given . /// - /// The from which to get the hash code. - /// The hash code of the given . + /// The from which to get the hash code. + /// The hash code of the given . public int GetHashCode(char obj) { if (this.ignoreCase) { - obj = Char.ToLowerInvariant(obj); + obj = char.ToLowerInvariant(obj); } return obj.GetHashCode(); diff --git a/src/PowerShell/Column.cs b/src/PowerShell/Column.cs index 57cae8c..be0cde6 100644 --- a/src/PowerShell/Column.cs +++ b/src/PowerShell/Column.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.Collections.Generic; using System.IO; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller { @@ -53,7 +53,7 @@ internal sealed class Column }; /// - /// Creates a new instance of the class from a and column index. + /// Initializes a new instance of the class. /// /// The from which column information is retrieved. /// The index of the column within the . @@ -63,7 +63,6 @@ internal sealed class Column internal Column(View view, int index, string table, string name, string key) { // Internal constructor will assume valid parameters. - this.Index = index; var column = view.Columns[index]; @@ -101,11 +100,11 @@ internal Column(View view, int index, string table, string name, string key) } else if (typeof(short) == type) { - this.ColumnType = typeof(Nullable); + this.ColumnType = typeof(short?); } else { - this.ColumnType = typeof(Nullable); + this.ColumnType = typeof(int?); } } @@ -120,7 +119,7 @@ internal Column(View view, int index, string table, string name, string key) internal int Index { get; private set; } /// - /// Gets whether the column is a primary key in its containing table. + /// Gets a value indicating whether the column is a primary key in its containing table. /// internal bool IsPrimaryKey { get; private set; } diff --git a/src/PowerShell/ColumnCollection.cs b/src/PowerShell/ColumnCollection.cs index b5f8bb7..aecca63 100644 --- a/src/PowerShell/ColumnCollection.cs +++ b/src/PowerShell/ColumnCollection.cs @@ -20,11 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Tools.WindowsInstaller.Properties; using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller { @@ -37,7 +37,7 @@ internal sealed class ColumnCollection : KeyedCollection private static readonly char[] NameSeparators = new char[] { '.' }; /// - /// Creates a new instance of the class from the specified . + /// Initializes a new instance of the class. /// /// The from which column information is retrieved. /// A column name was defined by multiple tables. @@ -131,7 +131,7 @@ private static string[] GetColumns(View view) { // Return only specified columns. return columns - .Replace("`", "") + .Replace("`", string.Empty) .Split(ColumnCollection.ColumnSeparators, StringSplitOptions.RemoveEmptyEntries); } } diff --git a/src/PowerShell/ComponentSearcher.cs b/src/PowerShell/ComponentSearcher.cs index afe6166..9792b6d 100644 --- a/src/PowerShell/ComponentSearcher.cs +++ b/src/PowerShell/ComponentSearcher.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System.Collections.Generic; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller { diff --git a/src/PowerShell/EncodingConverter.cs b/src/PowerShell/EncodingConverter.cs index 6435907..d87ee30 100644 --- a/src/PowerShell/EncodingConverter.cs +++ b/src/PowerShell/EncodingConverter.cs @@ -20,7 +20,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.ComponentModel; using System.Globalization; @@ -35,33 +34,33 @@ namespace Microsoft.Tools.WindowsInstaller internal sealed class EncodingConverter : TypeConverter { /// - /// Returns True when is a or . + /// Returns True when is a or . /// /// Additional context for conversion. /// The type of the source object. - /// True if the is a or . + /// True if the is a or . public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return typeof(string) == sourceType || IsNumeric(sourceType) || base.CanConvertFrom(context, sourceType); } /// - /// Returns True when is a or . + /// Returns True when is a or . /// /// Additional context for conversion. /// The type of the destination object. - /// True if the is a or . + /// True if the is a or . public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return typeof(string) == destinationType || IsNumeric(destinationType) || base.CanConvertTo(context, destinationType); } /// - /// Converts a or to an . + /// Converts a or to an . /// /// Additional context for conversion. /// The culture to use for conversion. - /// The or value to convert. + /// The or value to convert. /// The for the string. /// No could be matched to the string or code page integer. /// diff --git a/src/PowerShell/ExtensionMethods.cs b/src/PowerShell/ExtensionMethods.cs index 6d2efa3..fdf3578 100644 --- a/src/PowerShell/ExtensionMethods.cs +++ b/src/PowerShell/ExtensionMethods.cs @@ -44,7 +44,7 @@ internal static class ExtensionMethods /// Determines whether any element of a sequence satisfies a condition. /// /// The type of the elements of source. - /// The type of the elements of source. + /// The source elements. /// The condition to apply to each element. /// True if any of the elements satisfy the . /// The or argument is null. @@ -135,10 +135,10 @@ internal static TSource FirstOrDefault(this IEnumerable source } /// - /// Joins an enumerable of elements with the given . + /// Joins an enumerable of elements with the given . /// - /// An enumerable of type . - /// The string separator to separate elements. The default is an empty string. + /// An enumerable of type . + /// The string separator to separate elements. The default is an empty string. /// A string of all elements separated by the given , or null if is null. internal static string Join(this IEnumerable source, string separator) { @@ -260,7 +260,7 @@ internal static IList ToList(this IEnumerable source) /// Filters a sequence of values based on a predicate. /// /// The type of the elements of source. - /// The type of the elements of source. + /// The source elements. /// A function to test each element for a condition. /// An enumerable that contains elements from the input sequence that satisfy the condition. /// The or argument is null. diff --git a/src/PowerShell/FileHash.cs b/src/PowerShell/FileHash.cs index 591c926..9bed923 100644 --- a/src/PowerShell/FileHash.cs +++ b/src/PowerShell/FileHash.cs @@ -46,7 +46,7 @@ public class FileHash : IEnumerable private int dwData3; /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// internal FileHash() { diff --git a/src/PowerShell/GlobalSuppressions.cs b/src/PowerShell/GlobalSuppressions.cs index ae2e784..b6426e3 100644 --- a/src/PowerShell/GlobalSuppressions.cs +++ b/src/PowerShell/GlobalSuppressions.cs @@ -1,12 +1,27 @@ -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. -// -// To add a suppression to this file, right-click the message in the -// Error List, point to "Suppress Message(s)", and click -// "In Project Suppression File". -// You do not need to add suppressions to this file manually. +// The MIT License (MIT) +// +// Copyright (c) Microsoft Corporation +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma warning disable SA1404 + [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Tools.WindowsInstaller")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Tools.WindowsInstaller.PowerShell")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", Scope = "resource", Target = "Microsoft.Tools.WindowsInstaller.Properties.Resources.resources")] diff --git a/src/PowerShell/Help.xml b/src/PowerShell/Help.xml index 3752f84..c461f9d 100644 --- a/src/PowerShell/Help.xml +++ b/src/PowerShell/Help.xml @@ -1281,6 +1281,9 @@ The directory or URL to register. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + Whether to validate that directories exist before they are added to the source list. + Whether to return the remaining registered source through the pipeline. diff --git a/src/PowerShell/InapplicablePatchEventArgs.cs b/src/PowerShell/InapplicablePatchEventArgs.cs new file mode 100644 index 0000000..cac6b8b --- /dev/null +++ b/src/PowerShell/InapplicablePatchEventArgs.cs @@ -0,0 +1,60 @@ +// The MIT License (MIT) +// +// Copyright (c) Microsoft Corporation +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using System; + +namespace Microsoft.Tools.WindowsInstaller +{ + /// + /// Contains information about inapplicable patches. + /// + internal sealed class InapplicablePatchEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// The path to the patch or patch XML file that is not applicable. + /// The ProductCode for or path to the target product. + /// Exception information about why the patch is not applicable. + internal InapplicablePatchEventArgs(string patch, string product, Exception exception) + { + this.Patch = patch; + this.Product = product; + this.Exception = exception; + } + + /// + /// Gets the path to the patch or patch XML file. + /// + internal string Patch { get; private set; } + + /// + /// Gets the ProductCode for or path to the target product. + /// + internal string Product { get; private set; } + + /// + /// Gets exception information about why the patch is not applicable. + /// + internal Exception Exception { get; private set; } + } +} diff --git a/src/PowerShell/Log.cs b/src/PowerShell/Log.cs index 3831725..6acc4cd 100644 --- a/src/PowerShell/Log.cs +++ b/src/PowerShell/Log.cs @@ -20,11 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Win32; using System; using System.Globalization; using System.IO; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Win32; namespace Microsoft.Tools.WindowsInstaller { @@ -45,7 +45,7 @@ internal sealed class Log private bool initialized; /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// /// Optional path to use for directory and file base names. internal Log(string path) @@ -55,7 +55,7 @@ internal Log(string path) } /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// /// Optional path to use for directory and file base names. /// The for the log identifier. @@ -107,6 +107,20 @@ internal string Next(string extra) } } + private static string GetLoggingPolicy() + { + var key = Registry.LocalMachine.OpenSubKey(@"Software\Policies\Microsoft\Windows\Installer"); + if (null != key) + { + using (key) + { + return key.GetValue("Logging") as string; + } + } + + return null; + } + private void Initialize() { if (this.initialized) @@ -147,19 +161,5 @@ private void Initialize() this.initialized = true; } - - private static string GetLoggingPolicy() - { - var key = Registry.LocalMachine.OpenSubKey(@"Software\Policies\Microsoft\Windows\Installer"); - if (null != key) - { - using (key) - { - return key.GetValue("Logging") as string; - } - } - - return null; - } } } \ No newline at end of file diff --git a/src/PowerShell/LoggingPolicies.cs b/src/PowerShell/LoggingPolicies.cs index 9827b11..475804d 100644 --- a/src/PowerShell/LoggingPolicies.cs +++ b/src/PowerShell/LoggingPolicies.cs @@ -20,7 +20,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; namespace Microsoft.Tools.WindowsInstaller @@ -39,67 +38,67 @@ public enum LoggingPolicies /// /// No logging. /// - None = 0x0, + None = 0x0, /// /// Out-of-memory or fatal exit information. /// - FatalExit = 0x1, + FatalExit = 0x1, /// /// All error messages. /// - Error = 0x2, + Error = 0x2, /// /// Non-fatal warnings. /// - Warning = 0x4, + Warning = 0x4, /// /// User requests. /// - User = 0x8, + User = 0x8, /// /// Status messages. /// - Information = 0x10, + Information = 0x10, /// /// Out-of-disk-space messages. /// - OutOfDiskSpace = 0x80, + OutOfDiskSpace = 0x80, /// /// Start up of actions. /// - ActionStart = 0x100, + ActionStart = 0x100, /// /// Action-specific records. /// - ActionData = 0x200, + ActionData = 0x200, /// /// Dump properties on exit. /// - PropertyDump = 0x400, + PropertyDump = 0x400, /// /// Initial user interface parameters. /// - CommonData = 0x800, + CommonData = 0x800, /// /// Verbose output. /// - Verbose = 0x1000, + Verbose = 0x1000, /// /// Extra debugging information. /// - ExtraDebug = 0x2000, + ExtraDebug = 0x2000, /// /// Log everything. @@ -107,7 +106,7 @@ public enum LoggingPolicies /// /// This is equivalent to "*vx" or "voicewarmupx" on the command line. /// - All = Verbose | OutOfDiskSpace | Information | CommonData | Error | + All = Verbose | OutOfDiskSpace | Information | CommonData | Error | Warning | ActionStart | ActionData | FatalExit | User | PropertyDump | ExtraDebug, /// @@ -116,6 +115,6 @@ public enum LoggingPolicies /// /// This can cause performance degradation and is not recommended. /// - FlushEachLine = 0x10000000, + FlushEachLine = 0x10000000, } } diff --git a/src/PowerShell/LoggingPoliciesConverter.cs b/src/PowerShell/LoggingPoliciesConverter.cs index 90ec970..21a52f1 100644 --- a/src/PowerShell/LoggingPoliciesConverter.cs +++ b/src/PowerShell/LoggingPoliciesConverter.cs @@ -20,11 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Tools.WindowsInstaller.Properties; using System; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller { @@ -71,33 +71,33 @@ static LoggingPoliciesConverter() } /// - /// Returns True when is a . + /// Returns True when is a . /// /// Additional context for conversion. /// The type of the source object. - /// True if the is a . + /// True if the is a . public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return typeof(string) == sourceType; } /// - /// Returns True when is a . + /// Returns True when is a . /// /// Additional context for conversion. /// The type of the destination object. - /// True if the is a . + /// True if the is a . public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return typeof(string) == destinationType; } /// - /// Converts a in the short form like "omus" to a enumeration. + /// Converts a in the short form like "omus" to a enumeration. /// /// Additional context for conversion. /// The culture to use for conversion. - /// The value to convert. + /// The value to convert. /// The converted enumeration. /// The short form string contains invalid characters. public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) @@ -127,7 +127,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c } else { - var message = String.Format(CultureInfo.CurrentCulture, Resources.Error_InvalidLoggingMode, c); + var message = string.Format(CultureInfo.CurrentCulture, Resources.Error_InvalidLoggingMode, c); throw new ArgumentException(message, "value"); } } @@ -140,7 +140,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c } /// - /// Converts a to a short form like "voicewarmup". + /// Converts a to a short form like "voicewarmup". /// /// Additional context for conversion. /// The culture to use for conversion. diff --git a/src/PowerShell/Microsoft.Tools.WindowsInstaller.PowerShell.dll-Help.xml b/src/PowerShell/Microsoft.Tools.WindowsInstaller.PowerShell.dll-Help.xml index 48de308..bd63741 100644 --- a/src/PowerShell/Microsoft.Tools.WindowsInstaller.PowerShell.dll-Help.xml +++ b/src/PowerShell/Microsoft.Tools.WindowsInstaller.PowerShell.dll-Help.xml @@ -1 +1,6609 @@ -Add-MSISourceAdds a registered network source or URL from a product or patch.AddMSISourceWindows Installer products and patches can have zero or more registered locations that direct Windows Installer where to look for package source. This cmdlet will add a network source or URL to a product or patch and optionally return the remaining registered source locations through the pipeline.Add-MSISourceProductCodeThe ProductCode for a product or applied patch.StringStringLiteralPathThe directory or URL to register. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PassThruWhether to return the remaining registered source through the pipeline.SwitchParameterPatchCodeThe patch code for a patch.StringStringUserContextThe user context for a product or patch.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe user SID for a product or patch.StringStringAdd-MSISourceProductCodeThe ProductCode for a product or applied patch.StringStringPathThe directory or URL to register. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]PassThruWhether to return the remaining registered source through the pipeline.SwitchParameterPatchCodeThe patch code for a patch.StringStringUserContextThe user context for a product or patch.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe user SID for a product or patch.StringStringLiteralPathThe directory or URL to register. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PassThruWhether to return the remaining registered source through the pipeline.SwitchParameterPatchCodeThe patch code for a patch.StringStringPathThe directory or URL to register. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ProductCodeThe ProductCode for a product or applied patch.StringStringUserContextThe user context for a product or patch.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe user SID for a product or patch.StringStringMicrosoft.Tools.WindowsInstaller.SourceInfoSource information for an installed product.Microsoft.Tools.WindowsInstaller.PatchSourceInfoSource information for an applied patch.-------------- EXAMPLE 1 --------------C:\PS>add-msisource '{707ABAE4-4DC5-478C-9D36-7CC5C1A85A3C}' 'C:\Package Cache\'Adds the C:\Package Cache source location from the specified product.Clear-MSISourceGet-MSISourceRemove-MSISourceClear-MSISourceClears all registered network sources and URLs from a product or patch.ClearMSISourceWindows Installer products and patches can have zero or more registered locations that direct Windows Installer where to look for package source. This cmdlet will clear all network sources and URLs from a product or patch.Clear-MSISourceProductCodeThe ProductCode for a product or applied patch.StringStringPatchCodeThe patch code for a patch.StringStringUserContextThe user context for a product or patch.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe user SID for a product or patch.StringStringPatchCodeThe patch code for a patch.StringStringProductCodeThe ProductCode for a product or applied patch.StringStringUserContextThe user context for a product or patch.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe user SID for a product or patch.StringStringMicrosoft.Tools.WindowsInstaller.SourceInfoSource information for an installed product.Microsoft.Tools.WindowsInstaller.PatchSourceInfoSource information for an applied patch.-------------- EXAMPLE 1 --------------C:\PS>get-msiproductinfo '{707ABAE4-4DC5-478C-9D36-7CC5C1A85A3C}' | clear-msisourceClears all registered source from the specified product.Add-MSISourceGet-MSISourceRemove-MSISourceEdit-MSIPackageOpens an install package or patch in Orca or another registered editor.EditMSIPackageOrca can be installed from the Windows SDK. If installed, MSI and MSP packages can be opened in Orca. If Orca is not installed, any application registered with the "Edit" verb for .msi or .msp file extensions is used.Edit-MSIPackagePathThe path to a package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]WaitWait until the process is closed before opening another package.SwitchParameterEdit-MSIPackageLiteralPathThe path to a package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]WaitWait until the process is closed before opening another package.SwitchParameterLiteralPathThe path to a package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PathThe path to a package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]WaitWait until the process is closed before opening another package.SwitchParameter-------------- EXAMPLE 1 --------------C:\PS>get-childitem -filter *.msi -recurse | edit-msipackageOpens all install packages in the current directory or subdirectories in separate instances of Orca.Export-MSIPatchXmlExports an XML representation of applicability information from a patch package.ExportMSIPatchXmlWindows Installer defines an XML schema that is representational of a patch package - specifically its applicability information. This allows administrators and bundle developers to not require downloading the patch package just to find out if it's applicable or even already installed.This XML file can be passed to Get-MSIPatchSequence along with other XML files or patch packages.Export-MSIPatchXmlPathThe path to the patch package from which XML is exported.StringStringFilePathThe path to the output XML file.StringStringEncodingThe encoding to use for the output XML file.System.Text.EncodingSystem.Text.EncodingUTF8FormattedWhether to indent the XML file.SwitchParameterEncodingThe encoding to use for the output XML file.System.Text.EncodingSystem.Text.EncodingUTF8FilePathThe path to the output XML file.StringStringFormattedWhether to indent the XML file.SwitchParameterPathThe path to the patch package from which XML is exported.StringString-------------- EXAMPLE 1 --------------C:\PS>export-msipatchxml .\example.msp .\example.xml -formattedExports formatted XML from the example.msp patch package in the current directory.Get-MSIPatchSequenceGet-MSIComponentInfoGets information about components registered to the current user and the machine.GetMSIComponentInfoGets information about all the components registered to the current user and to the machine. You can also limit the components to only those installed by a particular product.The information includes the state of the component and the path all based on the product that installed it, since multiple products can install the same component even to different locations.Get-MSIComponentInfoComponentCodeThe component GUIDs to retrieve information.string[]string[]Get-MSIComponentInfoComponentCodeThe component GUIDs to retrieve information.string[]string[]ProductCodeThe ProductCode of the product that installed the components to retrieve information.StringStringComponentCodeThe component GUIDs to retrieve information.string[]string[]ProductCodeThe ProductCode of the product that installed the components to retrieve information.StringStringMicrosoft.Deployment.WindowsInstaller.ComponentInstallationInformation about the components installed or registered by one or multiple products.-------------- EXAMPLE 1 --------------C:\PS>get-msicomponentinfoThis command gets all components installed or registered to the current user or to the machine.-------------- EXAMPLE 2 --------------C:\PS>get-msiproductinfo "{90120000-00BA-0409-0000-0000000FF1CE}" | get-msicomponentinfo -componentcode "{90120000-00BA-0409-0000-0E32E9F6E558}"This command gets information for the component "{90120000-00BA-0409-0000-0E32E9F6E558}" installed by the product "{90120000-00BA-0409-0000-0000000FF1CE}".Get-MSIComponentStateGet-MSIComponentStateGets the install state for all authored components for one or more products installed on the machine.GetMSIComponentStateGets the install state for all components authored into one or more products. This includes all patches applied to the product. In addition to the information returned from Get-MSIComponentInfo, the authored component identifier from the Component table is attached along with a simple boolean property that determines if the component is installed locally or not.Get-MSIComponentStateProductThe products for which authored component state is retrieved.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Get-MSIComponentStateProductCodeThe installed ProductCodes that define the components for which state information is retrieved.string[]string[]UserContextThe context for registered products. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged".Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe security identifier for a user for user-managed and user-unmanaged products.StringStringProductThe products for which authored component state is retrieved.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]ProductCodeThe installed ProductCodes that define the components for which state information is retrieved.string[]string[]UserContextThe context for registered products. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged".Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe security identifier for a user for user-managed and user-unmanaged products.StringStringMicrosoft.Deployment.WindowsInstaller.ProductInstallationProducts for which authored component state is retrieved.Microsoft.Deployment.WindowsInstaller.ComponentInstallation#StateState information about the components authored into one or more products and applied patches.-------------- EXAMPLE 1 --------------C:\PS>get-msicomponentstate "{877EF582-78AF-4D84-888B-167FDC3BCC11}"Gets state information for all components authored into the product "{877EF582-78AF-4D84-888B-167FDC3BCC11}" and all applied patches.-------------- EXAMPLE 2 --------------C:\PS>get-msiproductinfo -name *TEST* | get-msicomponentstateGets state information for all components authored into any product where the ProductName matches *TEST*.Get-MSIComponentInfoGet-MSIProductInfoGet-MSIFeatureInfoGets information about features of an installed or advertised product.GetMSIFeatureInfoA product must install or advertise one or more features. This cmdlet can query feature of a product or products to determine their state and optional usage data.Get-MSIFeatureInfoProductThe ProductInstallation object that installed or advertised specified features.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Get-MSIFeatureInfoProductCodeThe ProductCode that installed or advertised specified features.StringStringFeatureNameThe names of the features for which information is retrieved.string[]string[]FeatureNameThe names of the features for which information is retrieved.string[]string[]ProductThe ProductInstallation object that installed or advertised specified features.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]ProductCodeThe ProductCode that installed or advertised specified features.StringStringMicrosoft.Deployment.WindowsInstaller.ProductInstallationThe product or products for which features are enumerated.Microsoft.Deployment.WindowsInstaller.FeatureInstallationInformation about the features installed or advertised by one or multiple products.-------------- EXAMPLE 1 --------------C:\PS>get-msiproductinfo "{90120000-00BA-0409-0000-0000000FF1CE}" | get-msifeatureinfo | format-table -view UsageGets the usage information for all the features installed by the product "{90120000-00BA-0409-0000-0000000FF1CE}".-------------- EXAMPLE 2 --------------C:\PS>get-msifeatureinfo "{90120000-00BA-0409-0000-0000000FF1CE}" "GrooveFilesIntl_1033"Gets state information for the feature "GrooveFilesIntl_1033" installed by product "{90120000-00BA-0409-0000-0000000FF1CE}".Get-MSIProductInfoGet-MSIFileHashGets a hash of a file in a Windows Installer-compatible format.GetMSIFileHashGet-MSIFileHash returns a 128-bit file hash in 4 separate parts, compatible with columns in the MsiFileHash table in Windows Installer packages. All non-versioned files should contain this hash.You can optionally add these HashPart1, HashPart2, HashPart3, and HashPart4 properties to FileSystem items.Get-MSIFileHashPathThe path to the item or items which must resolve to a file system path. You can specify * in any part of the path to select all matching files.string[]string[]PassThruPasses the item or items passed into this cmdlet through the pipeline with additional properties for the file hash.SwitchParameterGet-MSIFileHashLiteralPathThe path to the item or items which must resolve to a file system path. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PassThruPasses the item or items passed into this cmdlet through the pipeline with additional properties for the file hash.SwitchParameterLiteralPathThe path to the item or items which must resolve to a file system path. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PassThruPasses the item or items passed into this cmdlet through the pipeline with additional properties for the file hash.SwitchParameterPathThe path to the item or items which must resolve to a file system path. You can specify * in any part of the path to select all matching files.string[]string[]Microsoft.Tools.WindowsInstaller.FileHashIf -passthru is not specified, Get-MSIFileHash returns a FileHash object containing the file hash in 4 parts.System.IO.DirectoryInfoIf -passthru is specified and the input object is a directory, the directory is returned.System.IO.FileInfoIf -passthru is specified and the input object is a file, the file is returned.-------------- EXAMPLE 1 --------------C:\PS>get-msifilehash -path * | format-table -autoThis command outputs the file hash of every file in the current directory as a table.-------------- EXAMPLE 2 --------------C:\PS>get-childitem | where-object {$_.PSIsContainer -eq $False} | get-msifilehash -passthru | format-table Name, MSI* -autoThis command outputs the name and hash parts of each file in the current directory.Get-MSIFileTypeGet-MSIFileTypeGets the Windows Installer file type.GetMSIFileTypeGets the Windows Installer file type for a given file or files.You can optionally add this MSIFileType property to FileSystem items.Get-MSIFileTypePathThe path to the item or items which must resolve to a file system path. You can specify * in any part of the path to select all matching files.string[]string[]PassThruPasses the item or items passed into this cmdlet through the pipeline with the additional property for the file type.SwitchParameterGet-MSIFileTypeLiteralPathThe path to the item or items which must resolve to a file system path. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PassThruPasses the item or items passed into this cmdlet through the pipeline with the additional property for the file type.SwitchParameterLiteralPathThe path to the item or items which must resolve to a file system path. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PassThruPasses the item or items passed into this cmdlet through the pipeline with the additional property for the file type.SwitchParameterPathThe path to the item or items which must resolve to a file system path. You can specify * in any part of the path to select all matching files.string[]string[]stringIf -passthru is not specified, Get-MSIFileType returns a string object.System.IO.DirectoryInfoIf -passthru is specified and the input object is a directory, the directory is returned.System.IO.FileInfoIf -passthru is specified and the input object is a file, the file is returned.-------------- EXAMPLE 1 --------------C:\PS>get-msifilehash -path $env:WINDIR\InstallerThis command outputs the file type of files in the Windows Installer cache directory.-------------- EXAMPLE 2 --------------C:\PS>get-childitem -path $env:WINDIR\Installer\* | where-object {$_.PSIsContainer -eq $False} | get-msifiletype -passthru | format-table Name, MSIFileType -autoThis command outputs the Windows Installer file type for files in the Windows Installer cache directory.Get-MSIFileHashGet-MSILoggingPolicyGets the Windows Installer logging policy.GetMSILoggingPolicyThe Windows Installer logging policy determines whether logs are generated by default and how much information they contain. This cmdlet gets the current logging policy and can return the logging modes as a collection of strings or the raw string value from the registry.Get-MSILoggingPolicyRawReturns the raw string value from the registry.SwitchParameterRawReturns the raw string value from the registry.SwitchParameterstringIf -raw is specified and a logging policy set, the raw registry value is returned.string[]The default output type consisting of zero or more logging modes that are set in the registry.Remove-MSILoggingPolicySet-MSILoggingPolicyGet-MSIPatchInfoGets patch information for registered patches.GetMSIPatchInfoGets patch information for a given patch or for all patches registered to a given product or products. You can get patch information for machine-registered patches, and patch information for both user-managed- and user-unmanaged-registered patches for the current or another user.Get-MSIPatchInfoProductCodeSpecifies the ProductCode or ProductCodes to get patch information.string[]string[]PatchCodeThe patch code or patch codes to retrieve patch information.string[]string[]EveryoneWhether to retrieve user-managed or user-unmanaged patches for everyone.SwitchParameterFilterThe state or states of patches to be retrieved. This can be a combination of "Applied", "Superseded", "Obsoleted", "Registered", or "All".Microsoft.Deployment.WindowsInstaller.PatchStatesMicrosoft.Deployment.WindowsInstaller.PatchStatesUserContextThe context for registered patches. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged".Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe security identifier for a user for user-managed and user-unmanaged patches.StringStringEveryoneWhether to retrieve user-managed or user-unmanaged patches for everyone.SwitchParameterFilterThe state or states of patches to be retrieved. This can be a combination of "Applied", "Superseded", "Obsoleted", "Registered", or "All".Microsoft.Deployment.WindowsInstaller.PatchStatesMicrosoft.Deployment.WindowsInstaller.PatchStatesPatchCodeThe patch code or patch codes to retrieve patch information.string[]string[]ProductCodeSpecifies the ProductCode or ProductCodes to get patch information.string[]string[]UserContextThe context for registered patches. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged".Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe security identifier for a user for user-managed and user-unmanaged patches.StringStringMicrosoft.Deployment.WindowsInstaller.PatchInstallationInformation about patches applied or registered to a product or products.-------------- EXAMPLE 1 --------------C:\PS>get-msipatchinfoThis command outputs a table of patch information for all applied patches on the machine.-------------- EXAMPLE 2 --------------C:\PS>get-msipatchinfo -filter superseded | get-childitemThis command gets file information for superseded patches on the machine.-------------- EXAMPLE 3 --------------C:\PS>get-msiproductinfo | where-object {$_.Name -match "Office"} | get-msipatchinfo -filter allThis command gets patch information for all patches applied to products with "Office" in the name.Get-MSIProductInfoGet-MSIPatchSequenceGiven a list of patches or patch XML, outputs the sequence of applicable patches for a product or products.GetMSIPatchSequencePatch packages or patch XML files can be specified along with a list of products. Each patch is added to a list and after all patches specified are processed, the sequence for all applicable patches is output for each product specified.By default, the table format is used with a grouping for each product specified.Get-MSIPatchSequencePathThe path to a package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]PackagePathThe path to a product package or packages for which the patch sequence is returned.string[]string[]Get-MSIPatchSequencePackagePathThe path to a product package or packages for which the patch sequence is returned.string[]string[]LiteralPathThe path to a package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]Get-MSIPatchSequenceProductCodeThe ProductCode or ProductCodes for products for which the patch sequence is returned.string[]string[]LiteralPathThe path to a package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]UserContextThe user context for the product listed in the ProductCode parameter.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsUserSidThe user security identifier for product listed in the ProductCode parameter.StringStringGet-MSIPatchSequencePathThe path to a package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ProductCodeThe ProductCode or ProductCodes for products for which the patch sequence is returned.string[]string[]UserContextThe user context for the product listed in the ProductCode parameter.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsUserSidThe user security identifier for product listed in the ProductCode parameter.StringStringLiteralPathThe path to a package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PackagePathThe path to a product package or packages for which the patch sequence is returned.string[]string[]PathThe path to a package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ProductCodeThe ProductCode or ProductCodes for products for which the patch sequence is returned.string[]string[]UserContextThe user context for the product listed in the ProductCode parameter.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsUserSidThe user security identifier for product listed in the ProductCode parameter.StringStringMicrosoft.Tools.WindowsInstaller.PatchSequenceThe sequence information for each applicable patch to a product or product package.Get-MSIProductInfoGets product information for registered products.GetMSIProductInfoGets product information for all per-machine, user-managed, and user-unmanaged products on the machine.Get-MSIProductInfoProductCodeThe ProductCode or ProductCodes to retrieve product information.string[]string[]EveryoneWhether to retrieve user-managed or user-unmanaged products for everyone.SwitchParameterUserContextThe context for registered products. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged".Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe security identifier for a user for user-managed and user-unmanaged products.StringStringGet-MSIProductInfoEveryoneWhether to retrieve user-managed or user-unmanaged products for everyone.SwitchParameterNameThe name of a product or products to retrieve. Wildcards are supported.string[]string[]UserContextThe context for registered products. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged".Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe security identifier for a user for user-managed and user-unmanaged products.StringStringEveryoneWhether to retrieve user-managed or user-unmanaged products for everyone.SwitchParameterNameThe name of a product or products to retrieve. Wildcards are supported.string[]string[]ProductCodeThe ProductCode or ProductCodes to retrieve product information.string[]string[]UserContextThe context for registered products. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged".Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe security identifier for a user for user-managed and user-unmanaged products.StringStringMicrosoft.Deployment.WindowsInstaller.ProductInstallationInformation about the installed or advertised product. To see just the advertised properties use the PSAdvertised property set; or, to see just the installed properties use the PSInstalled property set.-------------- EXAMPLE 1 --------------C:\PS>get-msiproductinfoThis command outputs product information for all registered products assigned to this machine.-------------- EXAMPLE 2 --------------C:\PS>get-msiproductinfo | where-object {$_.Name -match "Visual Studio"}This command outputs all product information for products with "Visual Studio" in the name assigned to this machine.-------------- EXAMPLE 3 --------------C:\PS>get-msiproductinfo -installcontext userunmanaged | where-object {$_.ProductState -eq "Installed"} | get-childitemThis command gets file information for all installed user-unmanaged products.-------------- EXAMPLE 4 --------------C:\PS>get-msiproductinfo "{1862162E-3BBC-448F-AA63-49F33152D54A}"This command gets product information for the given ProductCode.Get-MSIPatchInfoGet-MSIRelatedProductInfoGet-MSIPropertyGets properties from a product or patch package.GetMSIPropertySelects all or matching properties from a product or patch package and either returns them to the pipeline or attaches them to a file object for a product or patch package if -PassThru is specified. When propertie are attached to a file object you can select them all using the "MSIProperties" property set.Get-MSIPropertyPropertyOptional list of property names to select. Wildcard are permitted.string[]string[]PathThe path to a product or patch package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]PassThruWhether to pass the file object back to the pipeline with selected properties attached.SwitchParameterPatchThe path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]TransformThe path to a transform to apply to the product package.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]Get-MSIPropertyPropertyOptional list of property names to select. Wildcard are permitted.string[]string[]LiteralPathThe path to a product or patch package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PassThruWhether to pass the file object back to the pipeline with selected properties attached.SwitchParameterPatchThe path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]TransformThe path to a transform to apply to the product package.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]LiteralPathThe path to a product or patch package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PassThruWhether to pass the file object back to the pipeline with selected properties attached.SwitchParameterPatchThe path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]PathThe path to a product or patch package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]PropertyOptional list of property names to select. Wildcard are permitted.string[]string[]TransformThe path to a transform to apply to the product package.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]Microsoft.Tools.WindowsInstaller.RecordThe selected properties from the product or patch package.System.IO.FileInfoThe original file object with selected properties attached and referenced by the "MSIProperties" property set.-------------- EXAMPLE 1 --------------C:\PS>get-msiproperty Product*, UpgradeCode -path example.msiGets the identifying properties from the example.msi product package.-------------- EXAMPLE 2 --------------C:\PS>get-childitem -filter *.msi | get-msiproperty -passthru | select Name, MSIPropertiesAttaches all properties from each product package and shows them all along with the file name.Get-MSITableGet-MSIRelatedProductInfoGets product information for related products.GetMSIRelatedProductInfoGets product information for related products based on an UpgradeCode.Get-MSIRelatedProductInfoUpgradeCodeThe UpgradeCode for related products.string[]string[]UpgradeCodeThe UpgradeCode for related products.string[]string[]Microsoft.Deployment.WindowsInstaller.ProductInstallationInformation about the installed or advertised product. To see just the installed properties use the PSInstalled property set.-------------- EXAMPLE 1 --------------C:\PS>get-msirelatedproductinfo "{B4160C68-1EA5-458F-B1EA-E69B41E44007}"This command gets all related products based on their UpgradeCode.Get-MSIProductInfoGet-MSISharedComponentInfoGets information about shared components installed or registered for the current user or the machine.GetMSISharedComponentInfoShared components are component which are installed to the same directory by one or more products. This cmdlet gets information about all or specified shared components installed for the current user or the machine.The output is already sorted by ComponentCode then ProductCode.Get-MSISharedComponentInfoComponentCodeThe component GUIDs to retrieve information.string[]string[]CountThe minimum number count for shared components returned. The absolute minimum is 2.Int32Int322ComponentCodeThe component GUIDs to retrieve information.string[]string[]CountThe minimum number count for shared components returned. The absolute minimum is 2.Int32Int322Microsoft.Deployment.WindowsInstaller.ComponentInstallationInformation about the shared components installed or registered by one or more products.-------------- EXAMPLE 1 --------------C:\PS>get-msisharedcomponentinfo -count 4 | format-table -view ClientsGets shared components installed by at least 4 products (or features) and displays them in a table grouped by ComponentCode.Get-MSIComponentInfoGet-MSISourceGets the registered network source or URLs for a product or patch.GetMSISourceWindows Installer products and patches can have zero or more registered locations that direct Windows Installer where to look for package source. This cmdlet will enumerate those locations registered to a product or patch.Get-MSISourceProductCodeThe ProductCode for a product or applied patch.StringStringPatchCodeThe patch code for a patch.StringStringUserContextThe user context for a product or patch.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe user SID for a product or patch.StringStringPatchCodeThe patch code for a patch.StringStringProductCodeThe ProductCode for a product or applied patch.StringStringUserContextThe user context for a product or patch.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe user SID for a product or patch.StringStringMicrosoft.Tools.WindowsInstaller.SourceInfoSource information for an installed product.Microsoft.Tools.WindowsInstaller.PatchSourceInfoSource information for an applied patch.-------------- EXAMPLE 1 --------------C:\PS>get-msiproductinfo | get-msisourceGets the registered source for all installed products on the machine.Add-MSISourceClear-MSISourceRemove-MSISourceGet-MSISummaryInfoGets the summary information from a product or patch package, or from a transform.GetMSISummaryInfoThe summary information stream is used by Windows Installer to determine applicability, version requirements, and more. Use this command to view the summary information for a product or patch package, or a transform. The properties returned are adapted for each file type.Get-MSISummaryInfoPathThe path to a package or transform to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]IncludeTransformsWhether to enumerate the transforms within a patch package.SwitchParameterGet-MSISummaryInfoIncludeTransformsWhether to enumerate the transforms within a patch package.SwitchParameterLiteralPathThe path to a package or transform to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]IncludeTransformsWhether to enumerate the transforms within a patch package.SwitchParameterLiteralPathThe path to a package or transform to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PathThe path to a package or transform to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]Microsoft.Deployment.WindowsInstaller.Package.TransformInfoSummary information for a transform within a patch package.Microsoft.Tools.WindowsInstaller.SummaryInfoSummary information for a product or patch package, or a transform.-------------- EXAMPLE 1 --------------C:\PS>get-childitem -filter *.ms* | get-msisummaryinfoGets summary information for any file matching *.ms*, including .msi, .msp, and .mst packages.-------------- EXAMPLE 2 --------------C:\PS>get-msisummaryinfo *.msp -includetransformsGets the patch and embedded transform summary information.Get-MSITableSelects records from a table or custom query from a product or patch package.GetMSITableYou can query all records from a table or records matching a custom query from a product or patch package. The Windows Installer SDK has more information about custom queries, since the SQL-like syntax is rather constrained.When no table or query is provided all tables from the package are displayed. Specifying a patch or transform will cause tables added by the patch or transform to be displayed, along with the operation performed on that table by the patch or transform in the MSIOperation property.Records are returned with properties matching column names. If records are selected from a single table, the table name is also part of the type name queryable from the PSTypeNames object property. If the column name is prefixed with the table name - required to disambiguate names, or optional otherwise - a property is returned as typed in the original query string. Note that Windows PowerShell allows periods in property names but may require in some scenarios that a property name with periods is contained in quotes, like 'File.Attributes'.For attribute columns in standard Windows Installer tables, you may also query for specific attribute values by specifying a special property name on the end of the attribute column name, like 'File.Attributes'.HasVital, to query for any columns that have the attribute value set. You can define an $MsiAttributeColumnFormat variable to control the display format of attribute columns, though the underlying value will not be changed. Run 'help about_MSI' for more information.Note that patch packages do not typically have more than a couple of tables. The patch has to be applied to a product package to view any changes it has made. When applying a patch or transforms, records will contain an operation performed on the record by the patch or transform in the MSIOperation property.Get-MSITableTableThe table from which all records are selected. If no table name is provided all tables in the database are displayed.StringStringPathThe path to a product package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]PatchThe path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]TransformThe path to a transform to apply to the product package.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]Get-MSITableProductAn installed product to query.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]IgnoreMachineStateWhether to apply any patches current installed to the product.SwitchParameterfalseQueryA custom query for which records are selected. Ambiguous column names must be prefixed with the table name to which they belong.StringStringGet-MSITableTableThe table from which all records are selected. If no table name is provided all tables in the database are displayed.StringStringProductAn installed product to query.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]IgnoreMachineStateWhether to apply any patches current installed to the product.SwitchParameterfalseGet-MSITableLiteralPathThe path to a product package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PatchThe path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]QueryA custom query for which records are selected. Ambiguous column names must be prefixed with the table name to which they belong.StringStringTransformThe path to a transform to apply to the product package.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]Get-MSITableTableThe table from which all records are selected. If no table name is provided all tables in the database are displayed.StringStringLiteralPathThe path to a product package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PatchThe path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]TransformThe path to a transform to apply to the product package.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]Get-MSITablePathThe path to a product package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]PatchThe path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]QueryA custom query for which records are selected. Ambiguous column names must be prefixed with the table name to which they belong.StringStringTransformThe path to a transform to apply to the product package.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]IgnoreMachineStateWhether to apply any patches current installed to the product.SwitchParameterfalseLiteralPathThe path to a product package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PatchThe path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]PathThe path to a product package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ProductAn installed product to query.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]QueryA custom query for which records are selected. Ambiguous column names must be prefixed with the table name to which they belong.StringStringTableThe table from which all records are selected. If no table name is provided all tables in the database are displayed.StringStringTransformThe path to a transform to apply to the product package.Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]Microsoft.Deployment.WindowsInstaller.ProductInstallationAn existing product to query. By default any patches already applied to the product are applied to the database.Microsoft.Tools.WindowsInstaller.RecordSelected records for a table or custom query where properties match column names.Microsoft.Tools.WindowsInstaller.TableInfoInformation about a table contained in the database or added by a patch or transform.-------------- EXAMPLE 1 --------------C:\PS>get-msitable .\example.msi -table PropertyGets all records from the Property table.-------------- EXAMPLE 2 --------------C:\PS>$productCode = get-msitable .\example.msi -table Property | where-object { $_.Property -eq "ProductCode" } | select-object -expand ValueSelects just the ProductCode property from the example.msi package and assigns the value to a variable.-------------- EXAMPLE 3 --------------C:\PS>get-childitem -filter *.msi | get-msitable -query "SELECT ComponentId, FileName, FileSize FROM Component, File WHERE Component_ = Component"Selects the component GUID, file name, and file size for all files in all packages in the current directory.-------------- EXAMPLE 4 --------------C:\PS>get-msitable .\example.msi -query "SELECT ComponentId, FileName, File.Attributes FROM Component, File WHERE Component_ = Component" | where-object { $_.'File.Attributes'.HasVital }Selects all vital files and displays the component GUID, file name, and all file attribtes from the example.msi package.Note that in the query filter the 'File.Attributes' column is contained in quotes; otherwise, Windows PowerShell will attempt to filter based on an Attributes property of a File property of the current pipeline object. The 'File.Attributes' column is contained in quotes in the original query because the Component table also contains a column named Attributes. Windows Installer requires that you disambiguate column names.-------------- EXAMPLE 5 --------------C:\PS>get-msitable .\example.msi -patch .\example.msp | get-msitable | where-object { $_.MSIOperation -ne 'None' }Gets all records in the example.msi package added or modified by the example.msp patch package.-------------- EXAMPLE 6 --------------C:\PS>get-msiproductinfo '{877EF582-78AF-4D84-888B-167FDC3BCC11}' | get-msitable -table PropertySelects records from the installed product along with any patches currently installed.Get-MSIProductInfoGet-MSIPropertyInstall-MSIAdvertisedFeatureInstalls advertised features.InstallMSIAdvertisedFeatureSome or all features can be advertised for a product. This may be by design or incidental if certain patching problems occur. You can use this cmdlet to to install some or all advertise features for some or all products.You can also scan for all advertised features using the -WhatIf parameter to see what would be done to your system without performing those operations. Use -Confirm if you want to approve the operation to each product.Install-MSIAdvertisedFeatureFeatureNameOne or more specific features to install. Feature names are case-sensitive.string[]string[]ConfirmConfirm installing advertised features for each product.SwitchParameterForcePerform each operation without confirmation.SwitchParameterProductCodeOne or more ProductCodes to limit which products are scanned for advertised features.string[]string[]PropertiesAdditional properties to pass to the installation operation.string[]string[]WhatIfShow what operations would be performed without actually performing them.SwitchParameterInstall-MSIAdvertisedFeatureFeatureNameOne or more specific features to install. Feature names are case-sensitive.string[]string[]ConfirmConfirm installing advertised features for each product.SwitchParameterForcePerform each operation without confirmation.SwitchParameterProductOne or more products passed through the pipeline to limit which products are scanned for advertised features.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]PropertiesAdditional properties to pass to the installation operation.string[]string[]WhatIfShow what operations would be performed without actually performing them.SwitchParameterConfirmConfirm installing advertised features for each product.SwitchParameterFeatureNameOne or more specific features to install. Feature names are case-sensitive.string[]string[]ForcePerform each operation without confirmation.SwitchParameterProductOne or more products passed through the pipeline to limit which products are scanned for advertised features.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]ProductCodeOne or more ProductCodes to limit which products are scanned for advertised features.string[]string[]PropertiesAdditional properties to pass to the installation operation.string[]string[]WhatIfShow what operations would be performed without actually performing them.SwitchParameterMicrosoft.Deployment.WindowsInstaller.ProductInstallationAn existing product for which advertised features should be installed.-------------- EXAMPLE 1 --------------C:\PS>install-msiadvertisedfeature -whatifScans all features in all products for advertised features and reports what operation would be performed.-------------- EXAMPLE 2 --------------C:\PS>get-msiproductinfo '{12341234-1234-1234-1234-123412341234}' | install-msiadvertisedfeature CompleteInstalls the 'Complete' feature for the specified product.Get-MSIProductInfoInstall-MSIProductInstall-MSIPatchInstalls a patch package or packages for all or only specified products.InstallMSIPatchYou can install one or more patch packages to all installed targets products or to just a subset of products.Progress, warnings, and errors during the install are sent through the pipeline making this command fully integrated.Install-MSIPatchPathThe path to a patch package to install. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed patch information after installation to the pipeline.SwitchParameterProductCodeThe ProductCode or ProductCodes to which the patch or patches should be applied.string[]string[]PropertiesAdditional property=value pairs to pass during install.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringUserContextThe user context for the product listed in the ProductCode parameter.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsMachineUserSidThe user security identifier for product listed in the ProductCode parameter.StringStringInstall-MSIPatchChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed patch information after installation to the pipeline.SwitchParameterPatchInformation about a patch or patches to install to other products.Microsoft.Deployment.WindowsInstaller.PatchInstallation[]Microsoft.Deployment.WindowsInstaller.PatchInstallation[]ProductCodeThe ProductCode or ProductCodes to which the patch or patches should be applied.string[]string[]PropertiesAdditional property=value pairs to pass during install.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringUserContextThe user context for the product listed in the ProductCode parameter.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsMachineUserSidThe user security identifier for product listed in the ProductCode parameter.StringStringInstall-MSIPatchChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLiteralPathThe path to a patch package to install. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]LogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed patch information after installation to the pipeline.SwitchParameterProductCodeThe ProductCode or ProductCodes to which the patch or patches should be applied.string[]string[]PropertiesAdditional property=value pairs to pass during install.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringUserContextThe user context for the product listed in the ProductCode parameter.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsMachineUserSidThe user security identifier for product listed in the ProductCode parameter.StringStringChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLiteralPathThe path to a patch package to install. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]LogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed patch information after installation to the pipeline.SwitchParameterPatchInformation about a patch or patches to install to other products.Microsoft.Deployment.WindowsInstaller.PatchInstallation[]Microsoft.Deployment.WindowsInstaller.PatchInstallation[]PathThe path to a patch package to install. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ProductCodeThe ProductCode or ProductCodes to which the patch or patches should be applied.string[]string[]PropertiesAdditional property=value pairs to pass during install.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringUserContextThe user context for the product listed in the ProductCode parameter.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsMachineUserSidThe user security identifier for product listed in the ProductCode parameter.StringStringMicrosoft.Deployment.WindowsInstaller.PatchInstallationInformation for the newly installed patch or patches.-------------- EXAMPLE 1 --------------C:\PS>install-msipatch .\example.msp MSIFASTINSTALL=2Install the example.msp patch package for all installed target products with MSIFASTINSTALL set to only do file costing before installation.-------------- EXAMPLE 2 --------------C:\PS>get-msiproductinfo -name TEST | install-msipatch .\example.msp -log $env:TEMP\patch.log -passthruInstall the example.msp patch package only for the product with ProductName "TEST" and log to the TEMP directory.Return information about the patch after logging.Uninstall-MSIPatchInstall-MSIProductInstalls or modifies a product package.InstallMSIProductInstalls a product package or adds features to existing products.Ultimately, this cmdlet can install, modify, repair, and even uninstall a product package or install patches but specialized cmdlets have been added for those tasks.Progress, warnings, and errors during the install are sent through the pipeline making this command fully integrated.Install-MSIProductPathThe path to a product package to install. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterDestinationThe target directory where the product should be installed.Note that the product package must be authored to support installing to TARGETDIR.StringStringForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed product information after installation to the pipeline.SwitchParameterPropertiesAdditional property=value pairs to pass during install.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringInstall-MSIProductChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed product information after installation to the pipeline.SwitchParameterProductAn existing product to modify.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]PropertiesAdditional property=value pairs to pass during install.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringInstall-MSIProductChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterDestinationThe target directory where the product should be installed.Note that the product package must be authored to support installing to TARGETDIR.StringStringForceWhether to suppress all prompts.SwitchParameterLiteralPathThe path to a product package to install. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]LogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed product information after installation to the pipeline.SwitchParameterPropertiesAdditional property=value pairs to pass during install.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringInstall-MSIProductChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed product information after installation to the pipeline.SwitchParameterProductCodeThe ProductCode of an existing product to modify.string[]string[]PropertiesAdditional property=value pairs to pass during install.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterDestinationThe target directory where the product should be installed.Note that the product package must be authored to support installing to TARGETDIR.StringStringForceWhether to suppress all prompts.SwitchParameterLiteralPathThe path to a product package to install. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]LogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed product information after installation to the pipeline.SwitchParameterPathThe path to a product package to install. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ProductAn existing product to modify.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]ProductCodeThe ProductCode of an existing product to modify.string[]string[]PropertiesAdditional property=value pairs to pass during install.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringMicrosoft.Deployment.WindowsInstaller.ProductInstallationAn existing product to modify.Microsoft.Deployment.WindowsInstaller.ProductInstallationInformation for the newly installed or modified product.-------------- EXAMPLE 1 --------------C:\PS>install-msiproduct .\example.msi NOBLOCK=1Installs the example.msi product package passing the ficticious NOBLOCK=1 property.-------------- EXAMPLE 2 --------------C:\PS>get-msiproductinfo -name TEST | install-msiproduct ADDLOCAL=Addin -log $env:TEMP\install.logModifies the existing product with ProductName TEST to add the "Addin" feature locally and log to the TEMP directory.Install-MSIPatchRepair-MSIProductUninstall-MSIPatchUninstall-MSIProductMeasure-MSIProductGets drive costs for components that would be installed to any drive.MeasureMSIProductYou can use this command to get the costs for components that will be installed to any drive mounted to the system. If multiple product packages are specified the total costs for all components in all specified products are returned.Measure-MSIProductPathThe path to a product package to measure. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]DestinationThe target directory where the product should be installed.Note that the product package must be authored to support installing to TARGETDIR.StringStringPatchThe path to a patch package or packages to apply to the product package before measuring. Patches are applied in sequence order.string[]string[]PropertiesAdditional properties to pass to the session.Note that you can mark all features for installation using ADDLOCAL=ALL or set public directories using this parameter.string[]string[]TransformThe path to a transform or transforms to apply to the product package before measuring.string[]string[]Measure-MSIProductDestinationThe target directory where the product should be installed.Note that the product package must be authored to support installing to TARGETDIR.StringStringLiteralPathThe path to a product package to measure. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PatchThe path to a patch package or packages to apply to the product package before measuring. Patches are applied in sequence order.string[]string[]PropertiesAdditional properties to pass to the session.Note that you can mark all features for installation using ADDLOCAL=ALL or set public directories using this parameter.string[]string[]TransformThe path to a transform or transforms to apply to the product package before measuring.string[]string[]DestinationThe target directory where the product should be installed.Note that the product package must be authored to support installing to TARGETDIR.StringStringLiteralPathThe path to a product package to measure. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PatchThe path to a patch package or packages to apply to the product package before measuring. Patches are applied in sequence order.string[]string[]PathThe path to a product package to measure. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]PropertiesAdditional properties to pass to the session.Note that you can mark all features for installation using ADDLOCAL=ALL or set public directories using this parameter.string[]string[]TransformThe path to a transform or transforms to apply to the product package before measuring.string[]string[]System.Management.Automation.PSDriveInfoA PSDriveInfo object with MSISpaceRequired and MSITemporarySpaceRequired properties attached (measured in bytes).-------------- EXAMPLE 1 --------------C:\PS>measure-msiproduct .\example.msi -patch .\example.msp -target X:\ExampleGets the drive costs for example.msi with example.msp applied if installed to the X:\Example directory.Remove-MSILoggingPolicyRemoves the Windows Installer logging policy.RemoveMSILoggingPolicyThe Windows Installer logging policy determines whether logs are generated by default and how much information they contain. This cmdlet removes the current logging and debug policies.Remove-MSILoggingPolicyGet-MSILoggingPolicySet-MSILoggingPolicyRemove-MSISourceRemoves a registered network source or URL from a product or patch.RemoveMSISourceWindows Installer products and patches can have zero or more registered locations that direct Windows Installer where to look for package source. This cmdlet will remove a location registered to a product or patch and optionally return the remaining locations through the pipeline.Remove-MSISourceProductCodeThe ProductCode for a product or applied patch.StringStringLiteralPathThe directory or URL to unregister. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PassThruWhether to return the remaining registered source through the pipeline.SwitchParameterPatchCodeThe patch code for a patch.StringStringUserContextThe user context for a product or patch.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe user SID for a product or patch.StringStringRemove-MSISourceProductCodeThe ProductCode for a product or applied patch.StringStringPathThe directory or URL to unregister. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]PassThruWhether to return the remaining registered source through the pipeline.SwitchParameterPatchCodeThe patch code for a patch.StringStringUserContextThe user context for a product or patch.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe user SID for a product or patch.StringStringLiteralPathThe directory or URL to unregister. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]PassThruWhether to return the remaining registered source through the pipeline.SwitchParameterPatchCodeThe patch code for a patch.StringStringPathThe directory or URL to unregister. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ProductCodeThe ProductCode for a product or applied patch.StringStringUserContextThe user context for a product or patch.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsAllUserSidThe user SID for a product or patch.StringStringMicrosoft.Tools.WindowsInstaller.SourceInfoSource information for an installed product.Microsoft.Tools.WindowsInstaller.PatchSourceInfoSource information for an applied patch.-------------- EXAMPLE 1 --------------C:\PS>remove-msisource '{707ABAE4-4DC5-478C-9D36-7CC5C1A85A3C}' 'C:\Package Cache\'Removes the C:\Package Cache source location from the specified product.Add-MSISourceClear-MSISourceGet-MSISourceRepair-MSIProductRepairs or modifies a product package.RepairMSIProductBy default, simply repairs an existing product. This cmdlet can also add or remove features, patches, or even uninstall but there are specialized cmdlets for that.Progress, warnings, and errors during the install are sent through the pipeline making this command fully integrated.Repair-MSIProductPathThe path to a product package to repair. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed patch information after installation to the pipeline.SwitchParameterPropertiesAdditional property=value pairs to pass during repair.string[]string[]ReinstallModeThe REINSTALLMODE to use. You can specify the value as a string in the format used by Windows Installer. The default is equivalent to "omus".Microsoft.Deployment.WindowsInstaller.ReinstallModesMicrosoft.Deployment.WindowsInstaller.ReinstallModesFileOlderVersion,MachineData,UserData,ShortcutResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringRepair-MSIProductChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed patch information after installation to the pipeline.SwitchParameterProductAn existing product to repair or modify.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]PropertiesAdditional property=value pairs to pass during repair.string[]string[]ReinstallModeThe REINSTALLMODE to use. You can specify the value as a string in the format used by Windows Installer. The default is equivalent to "omus".Microsoft.Deployment.WindowsInstaller.ReinstallModesMicrosoft.Deployment.WindowsInstaller.ReinstallModesFileOlderVersion,MachineData,UserData,ShortcutResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringRepair-MSIProductChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLiteralPathThe path to a product package to repair. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]LogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed patch information after installation to the pipeline.SwitchParameterPropertiesAdditional property=value pairs to pass during repair.string[]string[]ReinstallModeThe REINSTALLMODE to use. You can specify the value as a string in the format used by Windows Installer. The default is equivalent to "omus".Microsoft.Deployment.WindowsInstaller.ReinstallModesMicrosoft.Deployment.WindowsInstaller.ReinstallModesFileOlderVersion,MachineData,UserData,ShortcutResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringRepair-MSIProductChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed patch information after installation to the pipeline.SwitchParameterProductCodeThe ProductCode of an existing product to repair or modify.string[]string[]PropertiesAdditional property=value pairs to pass during repair.string[]string[]ReinstallModeThe REINSTALLMODE to use. You can specify the value as a string in the format used by Windows Installer. The default is equivalent to "omus".Microsoft.Deployment.WindowsInstaller.ReinstallModesMicrosoft.Deployment.WindowsInstaller.ReinstallModesFileOlderVersion,MachineData,UserData,ShortcutResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLiteralPathThe path to a product package to repair. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]LogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPassThruWhether to pass the newly installed patch information after installation to the pipeline.SwitchParameterPathThe path to a product package to repair. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ProductAn existing product to repair or modify.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]ProductCodeThe ProductCode of an existing product to repair or modify.string[]string[]PropertiesAdditional property=value pairs to pass during repair.string[]string[]ReinstallModeThe REINSTALLMODE to use. You can specify the value as a string in the format used by Windows Installer. The default is equivalent to "omus".Microsoft.Deployment.WindowsInstaller.ReinstallModesMicrosoft.Deployment.WindowsInstaller.ReinstallModesFileOlderVersion,MachineData,UserData,ShortcutResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringMicrosoft.Deployment.WindowsInstaller.ProductInstallationThe product to repair or modify.Microsoft.Deployment.WindowsInstaller.ProductInstallationInformation for the newly repaired product.-------------- EXAMPLE 1 --------------C:\PS>repair-msiproduct -productcode {12341234-1234-1234-1234-123412341234} -reinstall "pecmsu" -log $env:TEMP\repair.logRepair the specified product using REINSTALLMODE="pecmsu" and log to the TEMP directory.-------------- EXAMPLE 2 --------------C:\PS>get-msiproductinfo -name *TEST* | repair-msiproduct -chainRepair all products with ProductName matching *TEST* and show a single progress bar for the entire operation.Install-MSIProductUninstall-MSIProductSet-MSILoggingPolicySets the Windows Installer logging policy.SetMSILoggingPolicyThe Windows Installer logging policy determines whether logs are generated by default and how much information they contain. This cmdlet sets the logging policy and can return the logging modes as a collection of strings or the raw string value from the registry if -passthru is specified.Set-MSILoggingPolicyLoggingPolicyThe logging mode to set in the registry. If "ExtraDebug" or "x" are set, the Debug policy is also set to 7; however, if neither are set the current Debug policy is not removed.This can be a combination of "None", "ActionData", "ActionStart", "CommonData", "Error", "ExtraDebug", "FatalExit", "Information", "OutOfDiskSpace", "PropertyDump", "User", "Verbose", "Warning", "All", and "FlushEachLine"; or you can specify the Windows Installer command line options consisting of any combination of the characters "voicewarmupx!".Note that "All" does not include "FlushEachLine", but is equivalent to "voicewarmupx".Microsoft.Tools.WindowsInstaller.LoggingPoliciesMicrosoft.Tools.WindowsInstaller.LoggingPoliciesPassThruReturns the logging modes set in the registry.SwitchParameterRawAlong with -passthru, returns the raw string value from the registry.SwitchParameterLoggingPolicyThe logging mode to set in the registry. If "ExtraDebug" or "x" are set, the Debug policy is also set to 7; however, if neither are set the current Debug policy is not removed.This can be a combination of "None", "ActionData", "ActionStart", "CommonData", "Error", "ExtraDebug", "FatalExit", "Information", "OutOfDiskSpace", "PropertyDump", "User", "Verbose", "Warning", "All", and "FlushEachLine"; or you can specify the Windows Installer command line options consisting of any combination of the characters "voicewarmupx!".Note that "All" does not include "FlushEachLine", but is equivalent to "voicewarmupx".Microsoft.Tools.WindowsInstaller.LoggingPoliciesMicrosoft.Tools.WindowsInstaller.LoggingPoliciesPassThruReturns the logging modes set in the registry.SwitchParameterRawAlong with -passthru, returns the raw string value from the registry.SwitchParameterstringIf -passthru and -raw are specified and a logging policy set, the raw registry value is returned.string[]If -passthru is specified, the default output type consisting of zero or more logging modes that are set in the registry.Get-MSILoggingPolicyRemove-MSILoggingPolicyTest-MSIProductRuns internal consistency evaluators (ICEs) against the product package or packages.TestMSIProductInternal consistency evaluators (ICEs) are custom actions that validate whether a product is authored as specified. If Orca or MsiVal2 is installed, the default ICE .cub ("ICE cube") file is used by default, and you can specify custom ICE cube.You can also apply any number of patches or transforms before running ICEs. This allows you to evaluate a product that is transformed by, for example, a patch to also make sure the changes made by a patch or valid.Test-MSIProductPathThe path to a package to evaluate. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]AdditionalCubeOne or more ICE .cub files to use for evaluation.string[]string[]ExcludeThe names of ICEs to exclude from evaluation (all other ICEs are included).string[]string[]IncludeThe names of ICEs to include from evaluation (all other ICEs are excluded).string[]string[]NoDefaultDo not import darice.cub if installed with Orca or MsiVal2.SwitchParameterPatchThe path to a patch package or packages to apply to the product package before evaluation. Patches are applied in sequence order.string[]string[]TransformThe path to a transform or transforms to apply to the product package before evaluation.string[]string[]Test-MSIProductAdditionalCubeOne or more ICE .cub files to use for evaluation.string[]string[]ExcludeThe names of ICEs to exclude from evaluation (all other ICEs are included).string[]string[]IncludeThe names of ICEs to include from evaluation (all other ICEs are excluded).string[]string[]LiteralPathThe path to a package to evaluate. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]NoDefaultDo not import darice.cub if installed with Orca or MsiVal2.SwitchParameterPatchThe path to a patch package or packages to apply to the product package before evaluation. Patches are applied in sequence order.string[]string[]TransformThe path to a transform or transforms to apply to the product package before evaluation.string[]string[]AdditionalCubeOne or more ICE .cub files to use for evaluation.string[]string[]ExcludeThe names of ICEs to exclude from evaluation (all other ICEs are included).string[]string[]IncludeThe names of ICEs to include from evaluation (all other ICEs are excluded).string[]string[]LiteralPathThe path to a package to evaluate. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]NoDefaultDo not import darice.cub if installed with Orca or MsiVal2.SwitchParameterPatchThe path to a patch package or packages to apply to the product package before evaluation. Patches are applied in sequence order.string[]string[]PathThe path to a package to evaluate. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]TransformThe path to a transform or transforms to apply to the product package before evaluation.string[]string[]Microsoft.Tools.WindowsInstaller.IceMessageInformation generated from each ICE. Specifying -Verbose will show additional information from each ICE.-------------- EXAMPLE 1 --------------C:\PS>test-msiproduct .\example.msi -include ICE0* -exclude ICE03 -vOutput all messages from ICEs 01 through 09 except for ICE03.-------------- EXAMPLE 2 --------------C:\PS>test-msiproduct .\example.msi -patch .\example.msp -add .\tests\custom.cubApply example.msp to example.msi, then run all the default and custom ICEs.Uninstall-MSIPatchInstalls a patch package or packages for all or only specified products.UninstallMSIPatchUninstalls one or more packages from all products which they're applied or only from the specified set of products based on their ProductCode.Progress, warnings, and errors during the install are sent through the pipeline making this command fully integrated.Uninstall-MSIPatchPathThe path to a patch package to uninstall. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringProductCodeThe ProductCode or ProductCodes from which patches are removed.string[]string[]PropertiesAdditional property=value pairs to pass during uninstall.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringUserContextThe user context for the product listed in the ProductCode parameter.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsMachineUserSidThe user security identifier for product listed in the ProductCode parameter.StringStringUninstall-MSIPatchChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPatchInformation about a patch or patches to uninstall.Microsoft.Deployment.WindowsInstaller.PatchInstallation[]Microsoft.Deployment.WindowsInstaller.PatchInstallation[]ProductCodeThe ProductCode or ProductCodes from which patches are removed.string[]string[]PropertiesAdditional property=value pairs to pass during uninstall.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringUserContextThe user context for the product listed in the ProductCode parameter.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsMachineUserSidThe user security identifier for product listed in the ProductCode parameter.StringStringUninstall-MSIPatchChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLiteralPathThe path to a patch package to uninstall. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]LogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringProductCodeThe ProductCode or ProductCodes from which patches are removed.string[]string[]PropertiesAdditional property=value pairs to pass during uninstall.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringUserContextThe user context for the product listed in the ProductCode parameter.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsMachineUserSidThe user security identifier for product listed in the ProductCode parameter.StringStringChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLiteralPathThe path to a patch package to uninstall. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]LogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPatchInformation about a patch or patches to uninstall.Microsoft.Deployment.WindowsInstaller.PatchInstallation[]Microsoft.Deployment.WindowsInstaller.PatchInstallation[]PathThe path to a patch package to uninstall. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ProductCodeThe ProductCode or ProductCodes from which patches are removed.string[]string[]PropertiesAdditional property=value pairs to pass during uninstall.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringUserContextThe user context for the product listed in the ProductCode parameter.Microsoft.Deployment.WindowsInstaller.UserContextsMicrosoft.Deployment.WindowsInstaller.UserContextsMachineUserSidThe user security identifier for product listed in the ProductCode parameter.StringString-------------- EXAMPLE 1 --------------C:\PS>get-msiproductifo -name TEST | get-msipatchinfo | uninstall-msipatch -log $env:TEMP\unpatch.logUninstalls all patches applied to the product with ProductName TEST and logs to the TEMP directory.Install-MSIPatchUninstall-MSIProductUninstalls a product package or packages, or an existing product on the machine.UninstallMSIProductThis cmdlet, unlike related cmdlets, is designed to uninstalled one or more products. While there are ways to override this behavior, it is not recommend and you should instead use specialized cmdlets for this purpose. See the related links for suggestions.Progress, warnings, and errors during the install are sent through the pipeline making this command fully integrated.Uninstall-MSIProductPathThe path to a product package to uninstall. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPropertiesAdditional property=value pairs to pass during uninstall.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringUninstall-MSIProductChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringProductThe product to uninstall.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]PropertiesAdditional property=value pairs to pass during uninstall.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringUninstall-MSIProductChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLiteralPathThe path to a product package to uninstall. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]LogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPropertiesAdditional property=value pairs to pass during uninstall.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringUninstall-MSIProductChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringProductCodeThe ProductCode of a product to uninstall.string[]string[]PropertiesAdditional property=value pairs to pass during uninstall.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringChainWhether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible.SwitchParameterForceWhether to suppress all prompts.SwitchParameterLiteralPathThe path to a product package to uninstall. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards.string[]string[]LogThe path to the log file. This use the file name as the base name and will append timestamp and product-specific information.StringStringPathThe path to a product package to uninstall. Wildcards are permitted. You can specify * in any part of the path to select all matching files.string[]string[]ProductThe product to uninstall.Microsoft.Deployment.WindowsInstaller.ProductInstallation[]Microsoft.Deployment.WindowsInstaller.ProductInstallation[]ProductCodeThe ProductCode of a product to uninstall.string[]string[]PropertiesAdditional property=value pairs to pass during uninstall.string[]string[]ResultVariableThe name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable.StringStringMicrosoft.Deployment.WindowsInstaller.ProductInstallationThe product to uninstall.-------------- EXAMPLE 1 --------------C:\PS>uninstall-msiproduct .\example.msi -log $env:TEMP\uninstall.logUninstall the example.msi product package and log to the TEMP directory.-------------- EXAMPLE 2 --------------C:\PS>get-msiproductinfo -name *TEST* | uninstall-msiproduct -chainUninstall all products with ProductName matching *TEST* and show a single progress bar for the entire operation.Install-MSIProductRepair-MSIProduct \ No newline at end of file + + + + + Add-MSISource + + Adds a registered network source or URL from a product or patch. + + Add + MSISource + + + Windows Installer products and patches can have zero or more registered locations that direct Windows Installer where to look for package source. This cmdlet will add a network source or URL to a product or patch and optionally return the remaining registered source locations through the pipeline. + + + + Add-MSISource + + ProductCode + + The ProductCode for a product or applied patch. + + String + + String + + + + LiteralPath + + The directory or URL to register. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Force + + Whether to validate that directories exist before they are added to the source list. + + + SwitchParameter + + + + PassThru + + Whether to return the remaining registered source through the pipeline. + + + SwitchParameter + + + + PatchCode + + The patch code for a patch. + + String + + String + + + + UserContext + + The user context for a product or patch. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The user SID for a product or patch. + + String + + String + + + + + Add-MSISource + + ProductCode + + The ProductCode for a product or applied patch. + + String + + String + + + + Path + + The directory or URL to register. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Force + + Whether to validate that directories exist before they are added to the source list. + + + SwitchParameter + + + + PassThru + + Whether to return the remaining registered source through the pipeline. + + + SwitchParameter + + + + PatchCode + + The patch code for a patch. + + String + + String + + + + UserContext + + The user context for a product or patch. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The user SID for a product or patch. + + String + + String + + + + + + + LiteralPath + + The directory or URL to register. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Force + + Whether to validate that directories exist before they are added to the source list. + + + SwitchParameter + + + + PassThru + + Whether to return the remaining registered source through the pipeline. + + + SwitchParameter + + + + PatchCode + + The patch code for a patch. + + String + + String + + + + Path + + The directory or URL to register. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + ProductCode + + The ProductCode for a product or applied patch. + + String + + String + + + + UserContext + + The user context for a product or patch. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The user SID for a product or patch. + + String + + String + + + + + + + Microsoft.Tools.WindowsInstaller.SourceInfo + + Source information for an installed product. + + + + + + Microsoft.Tools.WindowsInstaller.PatchSourceInfo + + Source information for an applied patch. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + add-msisource '{707ABAE4-4DC5-478C-9D36-7CC5C1A85A3C}' 'C:\Package Cache\' + + Adds the C:\Package Cache source location from the specified product. + + + + + + + Clear-MSISource + + + Get-MSISource + + + Remove-MSISource + + + + + + Clear-MSISource + + Clears all registered network sources and URLs from a product or patch. + + Clear + MSISource + + + Windows Installer products and patches can have zero or more registered locations that direct Windows Installer where to look for package source. This cmdlet will clear all network sources and URLs from a product or patch. + + + + Clear-MSISource + + ProductCode + + The ProductCode for a product or applied patch. + + String + + String + + + + PatchCode + + The patch code for a patch. + + String + + String + + + + UserContext + + The user context for a product or patch. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The user SID for a product or patch. + + String + + String + + + + + + + PatchCode + + The patch code for a patch. + + String + + String + + + + ProductCode + + The ProductCode for a product or applied patch. + + String + + String + + + + UserContext + + The user context for a product or patch. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The user SID for a product or patch. + + String + + String + + + + + + + Microsoft.Tools.WindowsInstaller.SourceInfo + + Source information for an installed product. + + + + + + Microsoft.Tools.WindowsInstaller.PatchSourceInfo + + Source information for an applied patch. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msiproductinfo '{707ABAE4-4DC5-478C-9D36-7CC5C1A85A3C}' | clear-msisource + + Clears all registered source from the specified product. + + + + + + + Add-MSISource + + + Get-MSISource + + + Remove-MSISource + + + + + + Edit-MSIPackage + + Opens an install package or patch in Orca or another registered editor. + + Edit + MSIPackage + + + Orca can be installed from the Windows SDK. If installed, MSI and MSP packages can be opened in Orca. If Orca is not installed, any application registered with the "Edit" verb for .msi or .msp file extensions is used. + + + + Edit-MSIPackage + + Path + + The path to a package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Wait + + Wait until the process is closed before opening another package. + + + SwitchParameter + + + + + Edit-MSIPackage + + LiteralPath + + The path to a package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Wait + + Wait until the process is closed before opening another package. + + + SwitchParameter + + + + + + + LiteralPath + + The path to a package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Path + + The path to a package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Wait + + Wait until the process is closed before opening another package. + + + SwitchParameter + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-childitem -filter *.msi -recurse | edit-msipackage + + Opens all install packages in the current directory or subdirectories in separate instances of Orca. + + + + + + + + Export-MSIPatchXml + + Exports an XML representation of applicability information from a patch package. + + Export + MSIPatchXml + + + Windows Installer defines an XML schema that is representational of a patch package - specifically its applicability information. This allows administrators and bundle developers to not require downloading the patch package just to find out if it's applicable or even already installed. + + This XML file can be passed to Get-MSIPatchSequence along with other XML files or patch packages. + + + + Export-MSIPatchXml + + Path + + The path to the patch package from which XML is exported. + + String + + String + + + + FilePath + + The path to the output XML file. + + String + + String + + + + Encoding + + The encoding to use for the output XML file. + + System.Text.Encoding + + System.Text.Encoding + + UTF8 + + + Formatted + + Whether to indent the XML file. + + + SwitchParameter + + + + + + + Encoding + + The encoding to use for the output XML file. + + System.Text.Encoding + + System.Text.Encoding + + UTF8 + + + FilePath + + The path to the output XML file. + + String + + String + + + + Formatted + + Whether to indent the XML file. + + + SwitchParameter + + + + Path + + The path to the patch package from which XML is exported. + + String + + String + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + export-msipatchxml .\example.msp .\example.xml -formatted + + Exports formatted XML from the example.msp patch package in the current directory. + + + + + + + Get-MSIPatchSequence + + + + + + Get-MSIComponentInfo + + Gets information about components registered to the current user and the machine. + + Get + MSIComponentInfo + + + Gets information about all the components registered to the current user and to the machine. You can also limit the components to only those installed by a particular product. + + The information includes the state of the component and the path all based on the product that installed it, since multiple products can install the same component even to different locations. + + + + Get-MSIComponentInfo + + ComponentCode + + The component GUIDs to retrieve information. + + string[] + + string[] + + + + + Get-MSIComponentInfo + + ComponentCode + + The component GUIDs to retrieve information. + + string[] + + string[] + + + + ProductCode + + The ProductCode of the product that installed the components to retrieve information. + + String + + String + + + + + + + ComponentCode + + The component GUIDs to retrieve information. + + string[] + + string[] + + + + ProductCode + + The ProductCode of the product that installed the components to retrieve information. + + String + + String + + + + + + + Microsoft.Deployment.WindowsInstaller.ComponentInstallation + + Information about the components installed or registered by one or multiple products. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msicomponentinfo + + This command gets all components installed or registered to the current user or to the machine. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-msiproductinfo "{90120000-00BA-0409-0000-0000000FF1CE}" | get-msicomponentinfo -componentcode "{90120000-00BA-0409-0000-0E32E9F6E558}" + + This command gets information for the component "{90120000-00BA-0409-0000-0E32E9F6E558}" installed by the product "{90120000-00BA-0409-0000-0000000FF1CE}". + + + + + + + Get-MSIComponentState + + + + + + Get-MSIComponentState + + Gets the install state for all authored components for one or more products installed on the machine. + + Get + MSIComponentState + + + Gets the install state for all components authored into one or more products. This includes all patches applied to the product. In addition to the information returned from Get-MSIComponentInfo, the authored component identifier from the Component table is attached along with a simple boolean property that determines if the component is installed locally or not. + + + + Get-MSIComponentState + + Product + + The products for which authored component state is retrieved. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + + Get-MSIComponentState + + ProductCode + + The installed ProductCodes that define the components for which state information is retrieved. + + string[] + + string[] + + + + UserContext + + The context for registered products. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged". + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The security identifier for a user for user-managed and user-unmanaged products. + + String + + String + + + + + + + Product + + The products for which authored component state is retrieved. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + ProductCode + + The installed ProductCodes that define the components for which state information is retrieved. + + string[] + + string[] + + + + UserContext + + The context for registered products. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged". + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The security identifier for a user for user-managed and user-unmanaged products. + + String + + String + + + + + + + Microsoft.Deployment.WindowsInstaller.ProductInstallation + + Products for which authored component state is retrieved. + + + + + + + + Microsoft.Deployment.WindowsInstaller.ComponentInstallation#State + + State information about the components authored into one or more products and applied patches. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msicomponentstate "{877EF582-78AF-4D84-888B-167FDC3BCC11}" + + Gets state information for all components authored into the product "{877EF582-78AF-4D84-888B-167FDC3BCC11}" and all applied patches. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-msiproductinfo -name *TEST* | get-msicomponentstate + + Gets state information for all components authored into any product where the ProductName matches *TEST*. + + + + + + + Get-MSIComponentInfo + + + Get-MSIProductInfo + + + + + + Get-MSIFeatureInfo + + Gets information about features of an installed or advertised product. + + Get + MSIFeatureInfo + + + A product must install or advertise one or more features. This cmdlet can query feature of a product or products to determine their state and optional usage data. + + + + Get-MSIFeatureInfo + + Product + + The ProductInstallation object that installed or advertised specified features. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + + Get-MSIFeatureInfo + + ProductCode + + The ProductCode that installed or advertised specified features. + + String + + String + + + + FeatureName + + The names of the features for which information is retrieved. + + string[] + + string[] + + + + + + + FeatureName + + The names of the features for which information is retrieved. + + string[] + + string[] + + + + Product + + The ProductInstallation object that installed or advertised specified features. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + ProductCode + + The ProductCode that installed or advertised specified features. + + String + + String + + + + + + + Microsoft.Deployment.WindowsInstaller.ProductInstallation + + The product or products for which features are enumerated. + + + + + + + + Microsoft.Deployment.WindowsInstaller.FeatureInstallation + + Information about the features installed or advertised by one or multiple products. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msiproductinfo "{90120000-00BA-0409-0000-0000000FF1CE}" | get-msifeatureinfo | format-table -view Usage + + Gets the usage information for all the features installed by the product "{90120000-00BA-0409-0000-0000000FF1CE}". + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-msifeatureinfo "{90120000-00BA-0409-0000-0000000FF1CE}" "GrooveFilesIntl_1033" + + Gets state information for the feature "GrooveFilesIntl_1033" installed by product "{90120000-00BA-0409-0000-0000000FF1CE}". + + + + + + + Get-MSIProductInfo + + + + + + Get-MSIFileHash + + Gets a hash of a file in a Windows Installer-compatible format. + + Get + MSIFileHash + + + Get-MSIFileHash returns a 128-bit file hash in 4 separate parts, compatible with columns in the MsiFileHash table in Windows Installer packages. All non-versioned files should contain this hash. + + You can optionally add these HashPart1, HashPart2, HashPart3, and HashPart4 properties to FileSystem items. + + + + Get-MSIFileHash + + Path + + The path to the item or items which must resolve to a file system path. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + PassThru + + Passes the item or items passed into this cmdlet through the pipeline with additional properties for the file hash. + + + SwitchParameter + + + + + Get-MSIFileHash + + LiteralPath + + The path to the item or items which must resolve to a file system path. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + PassThru + + Passes the item or items passed into this cmdlet through the pipeline with additional properties for the file hash. + + + SwitchParameter + + + + + + + LiteralPath + + The path to the item or items which must resolve to a file system path. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + PassThru + + Passes the item or items passed into this cmdlet through the pipeline with additional properties for the file hash. + + + SwitchParameter + + + + Path + + The path to the item or items which must resolve to a file system path. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + + + + Microsoft.Tools.WindowsInstaller.FileHash + + If -passthru is not specified, Get-MSIFileHash returns a FileHash object containing the file hash in 4 parts. + + + + + + System.IO.DirectoryInfo + + If -passthru is specified and the input object is a directory, the directory is returned. + + + + + + System.IO.FileInfo + + If -passthru is specified and the input object is a file, the file is returned. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msifilehash -path * | format-table -auto + + This command outputs the file hash of every file in the current directory as a table. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-childitem | where-object {$_.PSIsContainer -eq $False} | get-msifilehash -passthru | format-table Name, MSI* -auto + + This command outputs the name and hash parts of each file in the current directory. + + + + + + + Get-MSIFileType + + + + + + Get-MSIFileType + + Gets the Windows Installer file type. + + Get + MSIFileType + + + Gets the Windows Installer file type for a given file or files. + + You can optionally add this MSIFileType property to FileSystem items. + + + + Get-MSIFileType + + Path + + The path to the item or items which must resolve to a file system path. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + PassThru + + Passes the item or items passed into this cmdlet through the pipeline with the additional property for the file type. + + + SwitchParameter + + + + + Get-MSIFileType + + LiteralPath + + The path to the item or items which must resolve to a file system path. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + PassThru + + Passes the item or items passed into this cmdlet through the pipeline with the additional property for the file type. + + + SwitchParameter + + + + + + + LiteralPath + + The path to the item or items which must resolve to a file system path. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + PassThru + + Passes the item or items passed into this cmdlet through the pipeline with the additional property for the file type. + + + SwitchParameter + + + + Path + + The path to the item or items which must resolve to a file system path. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + + + + string + + If -passthru is not specified, Get-MSIFileType returns a string object. + + + + + + System.IO.DirectoryInfo + + If -passthru is specified and the input object is a directory, the directory is returned. + + + + + + System.IO.FileInfo + + If -passthru is specified and the input object is a file, the file is returned. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msifilehash -path $env:WINDIR\Installer + + This command outputs the file type of files in the Windows Installer cache directory. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-childitem -path $env:WINDIR\Installer\* | where-object {$_.PSIsContainer -eq $False} | get-msifiletype -passthru | format-table Name, MSIFileType -auto + + This command outputs the Windows Installer file type for files in the Windows Installer cache directory. + + + + + + + Get-MSIFileHash + + + + + + Get-MSILoggingPolicy + + Gets the Windows Installer logging policy. + + Get + MSILoggingPolicy + + + The Windows Installer logging policy determines whether logs are generated by default and how much information they contain. This cmdlet gets the current logging policy and can return the logging modes as a collection of strings or the raw string value from the registry. + + + + Get-MSILoggingPolicy + + Raw + + Returns the raw string value from the registry. + + + SwitchParameter + + + + + + + Raw + + Returns the raw string value from the registry. + + + SwitchParameter + + + + + + + string + + If -raw is specified and a logging policy set, the raw registry value is returned. + + + + + + string[] + + The default output type consisting of zero or more logging modes that are set in the registry. + + + + + + + Remove-MSILoggingPolicy + + + Set-MSILoggingPolicy + + + + + + Get-MSIPatchInfo + + Gets patch information for registered patches. + + Get + MSIPatchInfo + + + Gets patch information for a given patch or for all patches registered to a given product or products. You can get patch information for machine-registered patches, and patch information for both user-managed- and user-unmanaged-registered patches for the current or another user. + + + + Get-MSIPatchInfo + + ProductCode + + Specifies the ProductCode or ProductCodes to get patch information. + + string[] + + string[] + + + + PatchCode + + The patch code or patch codes to retrieve patch information. + + string[] + + string[] + + + + Everyone + + Whether to retrieve user-managed or user-unmanaged patches for everyone. + + + SwitchParameter + + + + Filter + + The state or states of patches to be retrieved. This can be a combination of "Applied", "Superseded", "Obsoleted", "Registered", or "All". + + Microsoft.Deployment.WindowsInstaller.PatchStates + + Microsoft.Deployment.WindowsInstaller.PatchStates + + + + UserContext + + The context for registered patches. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged". + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The security identifier for a user for user-managed and user-unmanaged patches. + + String + + String + + + + + + + Everyone + + Whether to retrieve user-managed or user-unmanaged patches for everyone. + + + SwitchParameter + + + + Filter + + The state or states of patches to be retrieved. This can be a combination of "Applied", "Superseded", "Obsoleted", "Registered", or "All". + + Microsoft.Deployment.WindowsInstaller.PatchStates + + Microsoft.Deployment.WindowsInstaller.PatchStates + + + + PatchCode + + The patch code or patch codes to retrieve patch information. + + string[] + + string[] + + + + ProductCode + + Specifies the ProductCode or ProductCodes to get patch information. + + string[] + + string[] + + + + UserContext + + The context for registered patches. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged". + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The security identifier for a user for user-managed and user-unmanaged patches. + + String + + String + + + + + + + Microsoft.Deployment.WindowsInstaller.PatchInstallation + + Information about patches applied or registered to a product or products. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msipatchinfo + + This command outputs a table of patch information for all applied patches on the machine. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-msipatchinfo -filter superseded | get-childitem + + This command gets file information for superseded patches on the machine. + + + + + -------------- EXAMPLE 3 -------------- + + C:\PS> + + get-msiproductinfo | where-object {$_.Name -match "Office"} | get-msipatchinfo -filter all + + This command gets patch information for all patches applied to products with "Office" in the name. + + + + + + + Get-MSIProductInfo + + + + + + Get-MSIPatchSequence + + Given a list of patches or patch XML, outputs the sequence of applicable patches for a product or products. + + Get + MSIPatchSequence + + + Patch packages or patch XML files can be specified along with a list of products. Each patch is added to a list and after all patches specified are processed, the sequence for all applicable patches is output for each product specified. + + By default, the table format is used with a grouping for each product specified. + + + + Get-MSIPatchSequence + + Path + + The path to a package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + PackagePath + + The path to a product package or packages for which the patch sequence is returned. + + string[] + + string[] + + + + + Get-MSIPatchSequence + + PackagePath + + The path to a product package or packages for which the patch sequence is returned. + + string[] + + string[] + + + + LiteralPath + + The path to a package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + + Get-MSIPatchSequence + + ProductCode + + The ProductCode or ProductCodes for products for which the patch sequence is returned. + + string[] + + string[] + + + + LiteralPath + + The path to a package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + UserContext + + The user context for the product listed in the ProductCode parameter. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + + + UserSid + + The user security identifier for product listed in the ProductCode parameter. + + String + + String + + + + + Get-MSIPatchSequence + + Path + + The path to a package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + ProductCode + + The ProductCode or ProductCodes for products for which the patch sequence is returned. + + string[] + + string[] + + + + UserContext + + The user context for the product listed in the ProductCode parameter. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + + + UserSid + + The user security identifier for product listed in the ProductCode parameter. + + String + + String + + + + + + + LiteralPath + + The path to a package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + PackagePath + + The path to a product package or packages for which the patch sequence is returned. + + string[] + + string[] + + + + Path + + The path to a package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + ProductCode + + The ProductCode or ProductCodes for products for which the patch sequence is returned. + + string[] + + string[] + + + + UserContext + + The user context for the product listed in the ProductCode parameter. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + + + UserSid + + The user security identifier for product listed in the ProductCode parameter. + + String + + String + + + + + + + Microsoft.Tools.WindowsInstaller.PatchSequence + + The sequence information for each applicable patch to a product or product package. + + + + + + + + Get-MSIProductInfo + + Gets product information for registered products. + + Get + MSIProductInfo + + + Gets product information for all per-machine, user-managed, and user-unmanaged products on the machine. + + + + Get-MSIProductInfo + + ProductCode + + The ProductCode or ProductCodes to retrieve product information. + + string[] + + string[] + + + + Everyone + + Whether to retrieve user-managed or user-unmanaged products for everyone. + + + SwitchParameter + + + + UserContext + + The context for registered products. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged". + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The security identifier for a user for user-managed and user-unmanaged products. + + String + + String + + + + + Get-MSIProductInfo + + Everyone + + Whether to retrieve user-managed or user-unmanaged products for everyone. + + + SwitchParameter + + + + Name + + The name of a product or products to retrieve. Wildcards are supported. + + string[] + + string[] + + + + UserContext + + The context for registered products. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged". + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The security identifier for a user for user-managed and user-unmanaged products. + + String + + String + + + + + + + Everyone + + Whether to retrieve user-managed or user-unmanaged products for everyone. + + + SwitchParameter + + + + Name + + The name of a product or products to retrieve. Wildcards are supported. + + string[] + + string[] + + + + ProductCode + + The ProductCode or ProductCodes to retrieve product information. + + string[] + + string[] + + + + UserContext + + The context for registered products. This can be a combination of "Machine", "UserManaged", or "UserUnmanaged". + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The security identifier for a user for user-managed and user-unmanaged products. + + String + + String + + + + + + + Microsoft.Deployment.WindowsInstaller.ProductInstallation + + Information about the installed or advertised product. To see just the advertised properties use the PSAdvertised property set; or, to see just the installed properties use the PSInstalled property set. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msiproductinfo + + This command outputs product information for all registered products assigned to this machine. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-msiproductinfo | where-object {$_.Name -match "Visual Studio"} + + This command outputs all product information for products with "Visual Studio" in the name assigned to this machine. + + + + + -------------- EXAMPLE 3 -------------- + + C:\PS> + + get-msiproductinfo -installcontext userunmanaged | where-object {$_.ProductState -eq "Installed"} | get-childitem + + This command gets file information for all installed user-unmanaged products. + + + + + -------------- EXAMPLE 4 -------------- + + C:\PS> + + get-msiproductinfo "{1862162E-3BBC-448F-AA63-49F33152D54A}" + + This command gets product information for the given ProductCode. + + + + + + + Get-MSIPatchInfo + + + Get-MSIRelatedProductInfo + + + + + + Get-MSIProperty + + Gets properties from a product or patch package. + + Get + MSIProperty + + + Selects all or matching properties from a product or patch package and either returns them to the pipeline or attaches them to a file object for a product or patch package if -PassThru is specified. When propertie are attached to a file object you can select them all using the "MSIProperties" property set. + + + + Get-MSIProperty + + Property + + Optional list of property names to select. Wildcard are permitted. + + string[] + + string[] + + + + Path + + The path to a product or patch package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + PassThru + + Whether to pass the file object back to the pipeline with selected properties attached. + + + SwitchParameter + + + + Patch + + The path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Transform + + The path to a transform to apply to the product package. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + + Get-MSIProperty + + Property + + Optional list of property names to select. Wildcard are permitted. + + string[] + + string[] + + + + LiteralPath + + The path to a product or patch package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + PassThru + + Whether to pass the file object back to the pipeline with selected properties attached. + + + SwitchParameter + + + + Patch + + The path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Transform + + The path to a transform to apply to the product package. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + + + + LiteralPath + + The path to a product or patch package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + PassThru + + Whether to pass the file object back to the pipeline with selected properties attached. + + + SwitchParameter + + + + Patch + + The path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Path + + The path to a product or patch package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Property + + Optional list of property names to select. Wildcard are permitted. + + string[] + + string[] + + + + Transform + + The path to a transform to apply to the product package. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + + + + Microsoft.Tools.WindowsInstaller.Record + + The selected properties from the product or patch package. + + + + + + System.IO.FileInfo + + The original file object with selected properties attached and referenced by the "MSIProperties" property set. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msiproperty Product*, UpgradeCode -path example.msi + + Gets the identifying properties from the example.msi product package. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-childitem -filter *.msi | get-msiproperty -passthru | select Name, MSIProperties + + Attaches all properties from each product package and shows them all along with the file name. + + + + + + + Get-MSITable + + + + + + Get-MSIRelatedProductInfo + + Gets product information for related products. + + Get + MSIRelatedProductInfo + + + Gets product information for related products based on an UpgradeCode. + + + + Get-MSIRelatedProductInfo + + UpgradeCode + + The UpgradeCode for related products. + + string[] + + string[] + + + + + + + UpgradeCode + + The UpgradeCode for related products. + + string[] + + string[] + + + + + + + Microsoft.Deployment.WindowsInstaller.ProductInstallation + + Information about the installed or advertised product. To see just the installed properties use the PSInstalled property set. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msirelatedproductinfo "{B4160C68-1EA5-458F-B1EA-E69B41E44007}" + + This command gets all related products based on their UpgradeCode. + + + + + + + Get-MSIProductInfo + + + + + + Get-MSISharedComponentInfo + + Gets information about shared components installed or registered for the current user or the machine. + + Get + MSISharedComponentInfo + + + Shared components are component which are installed to the same directory by one or more products. This cmdlet gets information about all or specified shared components installed for the current user or the machine. + + The output is already sorted by ComponentCode then ProductCode. + + + + Get-MSISharedComponentInfo + + ComponentCode + + The component GUIDs to retrieve information. + + string[] + + string[] + + + + Count + + The minimum number count for shared components returned. The absolute minimum is 2. + + Int32 + + Int32 + + 2 + + + + + + ComponentCode + + The component GUIDs to retrieve information. + + string[] + + string[] + + + + Count + + The minimum number count for shared components returned. The absolute minimum is 2. + + Int32 + + Int32 + + 2 + + + + + + Microsoft.Deployment.WindowsInstaller.ComponentInstallation + + Information about the shared components installed or registered by one or more products. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msisharedcomponentinfo -count 4 | format-table -view Clients + + Gets shared components installed by at least 4 products (or features) and displays them in a table grouped by ComponentCode. + + + + + + + Get-MSIComponentInfo + + + + + + Get-MSISource + + Gets the registered network source or URLs for a product or patch. + + Get + MSISource + + + Windows Installer products and patches can have zero or more registered locations that direct Windows Installer where to look for package source. This cmdlet will enumerate those locations registered to a product or patch. + + + + Get-MSISource + + ProductCode + + The ProductCode for a product or applied patch. + + String + + String + + + + PatchCode + + The patch code for a patch. + + String + + String + + + + UserContext + + The user context for a product or patch. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The user SID for a product or patch. + + String + + String + + + + + + + PatchCode + + The patch code for a patch. + + String + + String + + + + ProductCode + + The ProductCode for a product or applied patch. + + String + + String + + + + UserContext + + The user context for a product or patch. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The user SID for a product or patch. + + String + + String + + + + + + + Microsoft.Tools.WindowsInstaller.SourceInfo + + Source information for an installed product. + + + + + + Microsoft.Tools.WindowsInstaller.PatchSourceInfo + + Source information for an applied patch. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msiproductinfo | get-msisource + + Gets the registered source for all installed products on the machine. + + + + + + + Add-MSISource + + + Clear-MSISource + + + Remove-MSISource + + + + + + Get-MSISummaryInfo + + Gets the summary information from a product or patch package, or from a transform. + + Get + MSISummaryInfo + + + The summary information stream is used by Windows Installer to determine applicability, version requirements, and more. Use this command to view the summary information for a product or patch package, or a transform. The properties returned are adapted for each file type. + + + + Get-MSISummaryInfo + + Path + + The path to a package or transform to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + IncludeTransforms + + Whether to enumerate the transforms within a patch package. + + + SwitchParameter + + + + + Get-MSISummaryInfo + + IncludeTransforms + + Whether to enumerate the transforms within a patch package. + + + SwitchParameter + + + + LiteralPath + + The path to a package or transform to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + + + + IncludeTransforms + + Whether to enumerate the transforms within a patch package. + + + SwitchParameter + + + + LiteralPath + + The path to a package or transform to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Path + + The path to a package or transform to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + + + + Microsoft.Deployment.WindowsInstaller.Package.TransformInfo + + Summary information for a transform within a patch package. + + + + + + Microsoft.Tools.WindowsInstaller.SummaryInfo + + Summary information for a product or patch package, or a transform. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-childitem -filter *.ms* | get-msisummaryinfo + + Gets summary information for any file matching *.ms*, including .msi, .msp, and .mst packages. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-msisummaryinfo *.msp -includetransforms + + Gets the patch and embedded transform summary information. + + + + + + + + Get-MSITable + + Selects records from a table or custom query from a product or patch package. + + Get + MSITable + + + You can query all records from a table or records matching a custom query from a product or patch package. The Windows Installer SDK has more information about custom queries, since the SQL-like syntax is rather constrained. + + When no table or query is provided all tables from the package are displayed. Specifying a patch or transform will cause tables added by the patch or transform to be displayed, along with the operation performed on that table by the patch or transform in the MSIOperation property. + + Records are returned with properties matching column names. If records are selected from a single table, the table name is also part of the type name queryable from the PSTypeNames object property. If the column name is prefixed with the table name - required to disambiguate names, or optional otherwise - a property is returned as typed in the original query string. Note that Windows PowerShell allows periods in property names but may require in some scenarios that a property name with periods is contained in quotes, like 'File.Attributes'. + + For attribute columns in standard Windows Installer tables, you may also query for specific attribute values by specifying a special property name on the end of the attribute column name, like 'File.Attributes'.HasVital, to query for any columns that have the attribute value set. You can define an $MsiAttributeColumnFormat variable to control the display format of attribute columns, though the underlying value will not be changed. Run 'help about_MSI' for more information. + + Note that patch packages do not typically have more than a couple of tables. The patch has to be applied to a product package to view any changes it has made. When applying a patch or transforms, records will contain an operation performed on the record by the patch or transform in the MSIOperation property. + + + + Get-MSITable + + Table + + The table from which all records are selected. If no table name is provided all tables in the database are displayed. + + String + + String + + + + Path + + The path to a product package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Patch + + The path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Transform + + The path to a transform to apply to the product package. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + + Get-MSITable + + Product + + An installed product to query. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + IgnoreMachineState + + Whether to apply any patches current installed to the product. + + + SwitchParameter + + false + + + Query + + A custom query for which records are selected. Ambiguous column names must be prefixed with the table name to which they belong. + + String + + String + + + + + Get-MSITable + + Table + + The table from which all records are selected. If no table name is provided all tables in the database are displayed. + + String + + String + + + + Product + + An installed product to query. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + IgnoreMachineState + + Whether to apply any patches current installed to the product. + + + SwitchParameter + + false + + + + Get-MSITable + + LiteralPath + + The path to a product package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Patch + + The path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Query + + A custom query for which records are selected. Ambiguous column names must be prefixed with the table name to which they belong. + + String + + String + + + + Transform + + The path to a transform to apply to the product package. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + + Get-MSITable + + Table + + The table from which all records are selected. If no table name is provided all tables in the database are displayed. + + String + + String + + + + LiteralPath + + The path to a product package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Patch + + The path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Transform + + The path to a transform to apply to the product package. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + + Get-MSITable + + Path + + The path to a product package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Patch + + The path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Query + + A custom query for which records are selected. Ambiguous column names must be prefixed with the table name to which they belong. + + String + + String + + + + Transform + + The path to a transform to apply to the product package. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + + + + IgnoreMachineState + + Whether to apply any patches current installed to the product. + + + SwitchParameter + + false + + + LiteralPath + + The path to a product package to open. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Patch + + The path to a patch package to apply to the product package. Multiple patches are applied in authored sequence order. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Path + + The path to a product package to open. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Product + + An installed product to query. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + Query + + A custom query for which records are selected. Ambiguous column names must be prefixed with the table name to which they belong. + + String + + String + + + + Table + + The table from which all records are selected. If no table name is provided all tables in the database are displayed. + + String + + String + + + + Transform + + The path to a transform to apply to the product package. + + Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + + + + Microsoft.Deployment.WindowsInstaller.ProductInstallation + + An existing product to query. By default any patches already applied to the product are applied to the database. + + + + + + + + Microsoft.Tools.WindowsInstaller.Record + + Selected records for a table or custom query where properties match column names. + + + + + + Microsoft.Tools.WindowsInstaller.TableInfo + + Information about a table contained in the database or added by a patch or transform. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msitable .\example.msi -table Property + + Gets all records from the Property table. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + $productCode = get-msitable .\example.msi -table Property | where-object { $_.Property -eq "ProductCode" } | select-object -expand Value + + Selects just the ProductCode property from the example.msi package and assigns the value to a variable. + + + + + -------------- EXAMPLE 3 -------------- + + C:\PS> + + get-childitem -filter *.msi | get-msitable -query "SELECT ComponentId, FileName, FileSize FROM Component, File WHERE Component_ = Component" + + Selects the component GUID, file name, and file size for all files in all packages in the current directory. + + + + + -------------- EXAMPLE 4 -------------- + + C:\PS> + + get-msitable .\example.msi -query "SELECT ComponentId, FileName, File.Attributes FROM Component, File WHERE Component_ = Component" | where-object { $_.'File.Attributes'.HasVital } + + Selects all vital files and displays the component GUID, file name, and all file attribtes from the example.msi package. + + Note that in the query filter the 'File.Attributes' column is contained in quotes; otherwise, Windows PowerShell will attempt to filter based on an Attributes property of a File property of the current pipeline object. The 'File.Attributes' column is contained in quotes in the original query because the Component table also contains a column named Attributes. Windows Installer requires that you disambiguate column names. + + + + + -------------- EXAMPLE 5 -------------- + + C:\PS> + + get-msitable .\example.msi -patch .\example.msp | get-msitable | where-object { $_.MSIOperation -ne 'None' } + + Gets all records in the example.msi package added or modified by the example.msp patch package. + + + + + -------------- EXAMPLE 6 -------------- + + C:\PS> + + get-msiproductinfo '{877EF582-78AF-4D84-888B-167FDC3BCC11}' | get-msitable -table Property + + Selects records from the installed product along with any patches currently installed. + + + + + + + Get-MSIProductInfo + + + Get-MSIProperty + + + + + + Install-MSIAdvertisedFeature + + Installs advertised features. + + Install + MSIAdvertisedFeature + + + Some or all features can be advertised for a product. This may be by design or incidental if certain patching problems occur. You can use this cmdlet to to install some or all advertise features for some or all products. + + You can also scan for all advertised features using the -WhatIf parameter to see what would be done to your system without performing those operations. Use -Confirm if you want to approve the operation to each product. + + + + Install-MSIAdvertisedFeature + + FeatureName + + One or more specific features to install. Feature names are case-sensitive. + + string[] + + string[] + + + + Confirm + + Confirm installing advertised features for each product. + + + SwitchParameter + + + + Force + + Perform each operation without confirmation. + + + SwitchParameter + + + + ProductCode + + One or more ProductCodes to limit which products are scanned for advertised features. + + string[] + + string[] + + + + Properties + + Additional properties to pass to the installation operation. + + string[] + + string[] + + + + WhatIf + + Show what operations would be performed without actually performing them. + + + SwitchParameter + + + + + Install-MSIAdvertisedFeature + + FeatureName + + One or more specific features to install. Feature names are case-sensitive. + + string[] + + string[] + + + + Confirm + + Confirm installing advertised features for each product. + + + SwitchParameter + + + + Force + + Perform each operation without confirmation. + + + SwitchParameter + + + + Product + + One or more products passed through the pipeline to limit which products are scanned for advertised features. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + Properties + + Additional properties to pass to the installation operation. + + string[] + + string[] + + + + WhatIf + + Show what operations would be performed without actually performing them. + + + SwitchParameter + + + + + + + Confirm + + Confirm installing advertised features for each product. + + + SwitchParameter + + + + FeatureName + + One or more specific features to install. Feature names are case-sensitive. + + string[] + + string[] + + + + Force + + Perform each operation without confirmation. + + + SwitchParameter + + + + Product + + One or more products passed through the pipeline to limit which products are scanned for advertised features. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + ProductCode + + One or more ProductCodes to limit which products are scanned for advertised features. + + string[] + + string[] + + + + Properties + + Additional properties to pass to the installation operation. + + string[] + + string[] + + + + WhatIf + + Show what operations would be performed without actually performing them. + + + SwitchParameter + + + + + + + Microsoft.Deployment.WindowsInstaller.ProductInstallation + + An existing product for which advertised features should be installed. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + install-msiadvertisedfeature -whatif + + Scans all features in all products for advertised features and reports what operation would be performed. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-msiproductinfo '{12341234-1234-1234-1234-123412341234}' | install-msiadvertisedfeature Complete + + Installs the 'Complete' feature for the specified product. + + + + + + + Get-MSIProductInfo + + + Install-MSIProduct + + + + + + Install-MSIPatch + + Installs a patch package or packages for all or only specified products. + + Install + MSIPatch + + + You can install one or more patch packages to all installed targets products or to just a subset of products. + + Progress, warnings, and errors during the install are sent through the pipeline making this command fully integrated. + + + + Install-MSIPatch + + Path + + The path to a patch package to install. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed patch information after installation to the pipeline. + + + SwitchParameter + + + + ProductCode + + The ProductCode or ProductCodes to which the patch or patches should be applied. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during install. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + UserContext + + The user context for the product listed in the ProductCode parameter. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Machine + + + UserSid + + The user security identifier for product listed in the ProductCode parameter. + + String + + String + + + + + Install-MSIPatch + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed patch information after installation to the pipeline. + + + SwitchParameter + + + + Patch + + Information about a patch or patches to install to other products. + + Microsoft.Deployment.WindowsInstaller.PatchInstallation[] + + Microsoft.Deployment.WindowsInstaller.PatchInstallation[] + + + + ProductCode + + The ProductCode or ProductCodes to which the patch or patches should be applied. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during install. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + UserContext + + The user context for the product listed in the ProductCode parameter. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Machine + + + UserSid + + The user security identifier for product listed in the ProductCode parameter. + + String + + String + + + + + Install-MSIPatch + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + LiteralPath + + The path to a patch package to install. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed patch information after installation to the pipeline. + + + SwitchParameter + + + + ProductCode + + The ProductCode or ProductCodes to which the patch or patches should be applied. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during install. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + UserContext + + The user context for the product listed in the ProductCode parameter. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Machine + + + UserSid + + The user security identifier for product listed in the ProductCode parameter. + + String + + String + + + + + + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + LiteralPath + + The path to a patch package to install. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed patch information after installation to the pipeline. + + + SwitchParameter + + + + Patch + + Information about a patch or patches to install to other products. + + Microsoft.Deployment.WindowsInstaller.PatchInstallation[] + + Microsoft.Deployment.WindowsInstaller.PatchInstallation[] + + + + Path + + The path to a patch package to install. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + ProductCode + + The ProductCode or ProductCodes to which the patch or patches should be applied. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during install. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + UserContext + + The user context for the product listed in the ProductCode parameter. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Machine + + + UserSid + + The user security identifier for product listed in the ProductCode parameter. + + String + + String + + + + + + + Microsoft.Deployment.WindowsInstaller.PatchInstallation + + Information for the newly installed patch or patches. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + install-msipatch .\example.msp MSIFASTINSTALL=2 + + Install the example.msp patch package for all installed target products with MSIFASTINSTALL set to only do file costing before installation. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-msiproductinfo -name TEST | install-msipatch .\example.msp -log $env:TEMP\patch.log -passthru + + Install the example.msp patch package only for the product with ProductName "TEST" and log to the TEMP directory. + + Return information about the patch after logging. + + + + + + + Uninstall-MSIPatch + + + + + + Install-MSIProduct + + Installs or modifies a product package. + + Install + MSIProduct + + + Installs a product package or adds features to existing products. + + Ultimately, this cmdlet can install, modify, repair, and even uninstall a product package or install patches but specialized cmdlets have been added for those tasks. + + Progress, warnings, and errors during the install are sent through the pipeline making this command fully integrated. + + + + Install-MSIProduct + + Path + + The path to a product package to install. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Destination + + The target directory where the product should be installed. + + Note that the product package must be authored to support installing to TARGETDIR. + + String + + String + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed product information after installation to the pipeline. + + + SwitchParameter + + + + Properties + + Additional property=value pairs to pass during install. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + Install-MSIProduct + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed product information after installation to the pipeline. + + + SwitchParameter + + + + Product + + An existing product to modify. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + Properties + + Additional property=value pairs to pass during install. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + Install-MSIProduct + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Destination + + The target directory where the product should be installed. + + Note that the product package must be authored to support installing to TARGETDIR. + + String + + String + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + LiteralPath + + The path to a product package to install. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed product information after installation to the pipeline. + + + SwitchParameter + + + + Properties + + Additional property=value pairs to pass during install. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + Install-MSIProduct + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed product information after installation to the pipeline. + + + SwitchParameter + + + + ProductCode + + The ProductCode of an existing product to modify. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during install. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Destination + + The target directory where the product should be installed. + + Note that the product package must be authored to support installing to TARGETDIR. + + String + + String + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + LiteralPath + + The path to a product package to install. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed product information after installation to the pipeline. + + + SwitchParameter + + + + Path + + The path to a product package to install. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Product + + An existing product to modify. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + ProductCode + + The ProductCode of an existing product to modify. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during install. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + + + Microsoft.Deployment.WindowsInstaller.ProductInstallation + + An existing product to modify. + + + + + + + + Microsoft.Deployment.WindowsInstaller.ProductInstallation + + Information for the newly installed or modified product. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + install-msiproduct .\example.msi NOBLOCK=1 + + Installs the example.msi product package passing the ficticious NOBLOCK=1 property. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-msiproductinfo -name TEST | install-msiproduct ADDLOCAL=Addin -log $env:TEMP\install.log + + Modifies the existing product with ProductName TEST to add the "Addin" feature locally and log to the TEMP directory. + + + + + + + Install-MSIPatch + + + Repair-MSIProduct + + + Uninstall-MSIPatch + + + Uninstall-MSIProduct + + + + + + Measure-MSIProduct + + Gets drive costs for components that would be installed to any drive. + + Measure + MSIProduct + + + You can use this command to get the costs for components that will be installed to any drive mounted to the system. If multiple product packages are specified the total costs for all components in all specified products are returned. + + + + Measure-MSIProduct + + Path + + The path to a product package to measure. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Destination + + The target directory where the product should be installed. + + Note that the product package must be authored to support installing to TARGETDIR. + + String + + String + + + + Patch + + The path to a patch package or packages to apply to the product package before measuring. Patches are applied in sequence order. + + string[] + + string[] + + + + Properties + + Additional properties to pass to the session. + + Note that you can mark all features for installation using ADDLOCAL=ALL or set public directories using this parameter. + + string[] + + string[] + + + + Transform + + The path to a transform or transforms to apply to the product package before measuring. + + string[] + + string[] + + + + + Measure-MSIProduct + + Destination + + The target directory where the product should be installed. + + Note that the product package must be authored to support installing to TARGETDIR. + + String + + String + + + + LiteralPath + + The path to a product package to measure. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Patch + + The path to a patch package or packages to apply to the product package before measuring. Patches are applied in sequence order. + + string[] + + string[] + + + + Properties + + Additional properties to pass to the session. + + Note that you can mark all features for installation using ADDLOCAL=ALL or set public directories using this parameter. + + string[] + + string[] + + + + Transform + + The path to a transform or transforms to apply to the product package before measuring. + + string[] + + string[] + + + + + + + Destination + + The target directory where the product should be installed. + + Note that the product package must be authored to support installing to TARGETDIR. + + String + + String + + + + LiteralPath + + The path to a product package to measure. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Patch + + The path to a patch package or packages to apply to the product package before measuring. Patches are applied in sequence order. + + string[] + + string[] + + + + Path + + The path to a product package to measure. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Properties + + Additional properties to pass to the session. + + Note that you can mark all features for installation using ADDLOCAL=ALL or set public directories using this parameter. + + string[] + + string[] + + + + Transform + + The path to a transform or transforms to apply to the product package before measuring. + + string[] + + string[] + + + + + + + System.Management.Automation.PSDriveInfo + + A PSDriveInfo object with MSISpaceRequired and MSITemporarySpaceRequired properties attached (measured in bytes). + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + measure-msiproduct .\example.msi -patch .\example.msp -target X:\Example + + Gets the drive costs for example.msi with example.msp applied if installed to the X:\Example directory. + + + + + + + + Remove-MSILoggingPolicy + + Removes the Windows Installer logging policy. + + Remove + MSILoggingPolicy + + + The Windows Installer logging policy determines whether logs are generated by default and how much information they contain. This cmdlet removes the current logging and debug policies. + + + + Remove-MSILoggingPolicy + + + + + Get-MSILoggingPolicy + + + Set-MSILoggingPolicy + + + + + + Remove-MSISource + + Removes a registered network source or URL from a product or patch. + + Remove + MSISource + + + Windows Installer products and patches can have zero or more registered locations that direct Windows Installer where to look for package source. This cmdlet will remove a location registered to a product or patch and optionally return the remaining locations through the pipeline. + + + + Remove-MSISource + + ProductCode + + The ProductCode for a product or applied patch. + + String + + String + + + + LiteralPath + + The directory or URL to unregister. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + PassThru + + Whether to return the remaining registered source through the pipeline. + + + SwitchParameter + + + + PatchCode + + The patch code for a patch. + + String + + String + + + + UserContext + + The user context for a product or patch. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The user SID for a product or patch. + + String + + String + + + + + Remove-MSISource + + ProductCode + + The ProductCode for a product or applied patch. + + String + + String + + + + Path + + The directory or URL to unregister. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + PassThru + + Whether to return the remaining registered source through the pipeline. + + + SwitchParameter + + + + PatchCode + + The patch code for a patch. + + String + + String + + + + UserContext + + The user context for a product or patch. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The user SID for a product or patch. + + String + + String + + + + + + + LiteralPath + + The directory or URL to unregister. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + PassThru + + Whether to return the remaining registered source through the pipeline. + + + SwitchParameter + + + + PatchCode + + The patch code for a patch. + + String + + String + + + + Path + + The directory or URL to unregister. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + ProductCode + + The ProductCode for a product or applied patch. + + String + + String + + + + UserContext + + The user context for a product or patch. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + All + + + UserSid + + The user SID for a product or patch. + + String + + String + + + + + + + Microsoft.Tools.WindowsInstaller.SourceInfo + + Source information for an installed product. + + + + + + Microsoft.Tools.WindowsInstaller.PatchSourceInfo + + Source information for an applied patch. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + remove-msisource '{707ABAE4-4DC5-478C-9D36-7CC5C1A85A3C}' 'C:\Package Cache\' + + Removes the C:\Package Cache source location from the specified product. + + + + + + + Add-MSISource + + + Clear-MSISource + + + Get-MSISource + + + + + + Repair-MSIProduct + + Repairs or modifies a product package. + + Repair + MSIProduct + + + By default, simply repairs an existing product. This cmdlet can also add or remove features, patches, or even uninstall but there are specialized cmdlets for that. + + Progress, warnings, and errors during the install are sent through the pipeline making this command fully integrated. + + + + Repair-MSIProduct + + Path + + The path to a product package to repair. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed patch information after installation to the pipeline. + + + SwitchParameter + + + + Properties + + Additional property=value pairs to pass during repair. + + string[] + + string[] + + + + ReinstallMode + + The REINSTALLMODE to use. You can specify the value as a string in the format used by Windows Installer. The default is equivalent to "omus". + + Microsoft.Deployment.WindowsInstaller.ReinstallModes + + Microsoft.Deployment.WindowsInstaller.ReinstallModes + + FileOlderVersion,MachineData,UserData,Shortcut + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + Repair-MSIProduct + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed patch information after installation to the pipeline. + + + SwitchParameter + + + + Product + + An existing product to repair or modify. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + Properties + + Additional property=value pairs to pass during repair. + + string[] + + string[] + + + + ReinstallMode + + The REINSTALLMODE to use. You can specify the value as a string in the format used by Windows Installer. The default is equivalent to "omus". + + Microsoft.Deployment.WindowsInstaller.ReinstallModes + + Microsoft.Deployment.WindowsInstaller.ReinstallModes + + FileOlderVersion,MachineData,UserData,Shortcut + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + Repair-MSIProduct + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + LiteralPath + + The path to a product package to repair. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed patch information after installation to the pipeline. + + + SwitchParameter + + + + Properties + + Additional property=value pairs to pass during repair. + + string[] + + string[] + + + + ReinstallMode + + The REINSTALLMODE to use. You can specify the value as a string in the format used by Windows Installer. The default is equivalent to "omus". + + Microsoft.Deployment.WindowsInstaller.ReinstallModes + + Microsoft.Deployment.WindowsInstaller.ReinstallModes + + FileOlderVersion,MachineData,UserData,Shortcut + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + Repair-MSIProduct + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed patch information after installation to the pipeline. + + + SwitchParameter + + + + ProductCode + + The ProductCode of an existing product to repair or modify. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during repair. + + string[] + + string[] + + + + ReinstallMode + + The REINSTALLMODE to use. You can specify the value as a string in the format used by Windows Installer. The default is equivalent to "omus". + + Microsoft.Deployment.WindowsInstaller.ReinstallModes + + Microsoft.Deployment.WindowsInstaller.ReinstallModes + + FileOlderVersion,MachineData,UserData,Shortcut + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + LiteralPath + + The path to a product package to repair. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + PassThru + + Whether to pass the newly installed patch information after installation to the pipeline. + + + SwitchParameter + + + + Path + + The path to a product package to repair. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Product + + An existing product to repair or modify. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + ProductCode + + The ProductCode of an existing product to repair or modify. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during repair. + + string[] + + string[] + + + + ReinstallMode + + The REINSTALLMODE to use. You can specify the value as a string in the format used by Windows Installer. The default is equivalent to "omus". + + Microsoft.Deployment.WindowsInstaller.ReinstallModes + + Microsoft.Deployment.WindowsInstaller.ReinstallModes + + FileOlderVersion,MachineData,UserData,Shortcut + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + + + Microsoft.Deployment.WindowsInstaller.ProductInstallation + + The product to repair or modify. + + + + + + + + Microsoft.Deployment.WindowsInstaller.ProductInstallation + + Information for the newly repaired product. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + repair-msiproduct -productcode {12341234-1234-1234-1234-123412341234} -reinstall "pecmsu" -log $env:TEMP\repair.log + + Repair the specified product using REINSTALLMODE="pecmsu" and log to the TEMP directory. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-msiproductinfo -name *TEST* | repair-msiproduct -chain + + Repair all products with ProductName matching *TEST* and show a single progress bar for the entire operation. + + + + + + + Install-MSIProduct + + + Uninstall-MSIProduct + + + + + + Set-MSILoggingPolicy + + Sets the Windows Installer logging policy. + + Set + MSILoggingPolicy + + + The Windows Installer logging policy determines whether logs are generated by default and how much information they contain. This cmdlet sets the logging policy and can return the logging modes as a collection of strings or the raw string value from the registry if -passthru is specified. + + + + Set-MSILoggingPolicy + + LoggingPolicy + + The logging mode to set in the registry. If "ExtraDebug" or "x" are set, the Debug policy is also set to 7; however, if neither are set the current Debug policy is not removed. + + This can be a combination of "None", "ActionData", "ActionStart", "CommonData", "Error", "ExtraDebug", "FatalExit", "Information", "OutOfDiskSpace", "PropertyDump", "User", "Verbose", "Warning", "All", and "FlushEachLine"; or you can specify the Windows Installer command line options consisting of any combination of the characters "voicewarmupx!". + + Note that "All" does not include "FlushEachLine", but is equivalent to "voicewarmupx". + + Microsoft.Tools.WindowsInstaller.LoggingPolicies + + Microsoft.Tools.WindowsInstaller.LoggingPolicies + + + + PassThru + + Returns the logging modes set in the registry. + + + SwitchParameter + + + + Raw + + Along with -passthru, returns the raw string value from the registry. + + + SwitchParameter + + + + + + + LoggingPolicy + + The logging mode to set in the registry. If "ExtraDebug" or "x" are set, the Debug policy is also set to 7; however, if neither are set the current Debug policy is not removed. + + This can be a combination of "None", "ActionData", "ActionStart", "CommonData", "Error", "ExtraDebug", "FatalExit", "Information", "OutOfDiskSpace", "PropertyDump", "User", "Verbose", "Warning", "All", and "FlushEachLine"; or you can specify the Windows Installer command line options consisting of any combination of the characters "voicewarmupx!". + + Note that "All" does not include "FlushEachLine", but is equivalent to "voicewarmupx". + + Microsoft.Tools.WindowsInstaller.LoggingPolicies + + Microsoft.Tools.WindowsInstaller.LoggingPolicies + + + + PassThru + + Returns the logging modes set in the registry. + + + SwitchParameter + + + + Raw + + Along with -passthru, returns the raw string value from the registry. + + + SwitchParameter + + + + + + + string + + If -passthru and -raw are specified and a logging policy set, the raw registry value is returned. + + + + + + string[] + + If -passthru is specified, the default output type consisting of zero or more logging modes that are set in the registry. + + + + + + + Get-MSILoggingPolicy + + + Remove-MSILoggingPolicy + + + + + + Test-MSIProduct + + Runs internal consistency evaluators (ICEs) against the product package or packages. + + Test + MSIProduct + + + Internal consistency evaluators (ICEs) are custom actions that validate whether a product is authored as specified. If Orca or MsiVal2 is installed, the default ICE .cub ("ICE cube") file is used by default, and you can specify custom ICE cube. + + You can also apply any number of patches or transforms before running ICEs. This allows you to evaluate a product that is transformed by, for example, a patch to also make sure the changes made by a patch or valid. + + + + Test-MSIProduct + + Path + + The path to a package to evaluate. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + AdditionalCube + + One or more ICE .cub files to use for evaluation. + + string[] + + string[] + + + + Exclude + + The names of ICEs to exclude from evaluation (all other ICEs are included). + + string[] + + string[] + + + + Include + + The names of ICEs to include from evaluation (all other ICEs are excluded). + + string[] + + string[] + + + + NoDefault + + Do not import darice.cub if installed with Orca or MsiVal2. + + + SwitchParameter + + + + Patch + + The path to a patch package or packages to apply to the product package before evaluation. Patches are applied in sequence order. + + string[] + + string[] + + + + Transform + + The path to a transform or transforms to apply to the product package before evaluation. + + string[] + + string[] + + + + + Test-MSIProduct + + AdditionalCube + + One or more ICE .cub files to use for evaluation. + + string[] + + string[] + + + + Exclude + + The names of ICEs to exclude from evaluation (all other ICEs are included). + + string[] + + string[] + + + + Include + + The names of ICEs to include from evaluation (all other ICEs are excluded). + + string[] + + string[] + + + + LiteralPath + + The path to a package to evaluate. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + NoDefault + + Do not import darice.cub if installed with Orca or MsiVal2. + + + SwitchParameter + + + + Patch + + The path to a patch package or packages to apply to the product package before evaluation. Patches are applied in sequence order. + + string[] + + string[] + + + + Transform + + The path to a transform or transforms to apply to the product package before evaluation. + + string[] + + string[] + + + + + + + AdditionalCube + + One or more ICE .cub files to use for evaluation. + + string[] + + string[] + + + + Exclude + + The names of ICEs to exclude from evaluation (all other ICEs are included). + + string[] + + string[] + + + + Include + + The names of ICEs to include from evaluation (all other ICEs are excluded). + + string[] + + string[] + + + + LiteralPath + + The path to a package to evaluate. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + NoDefault + + Do not import darice.cub if installed with Orca or MsiVal2. + + + SwitchParameter + + + + Patch + + The path to a patch package or packages to apply to the product package before evaluation. Patches are applied in sequence order. + + string[] + + string[] + + + + Path + + The path to a package to evaluate. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Transform + + The path to a transform or transforms to apply to the product package before evaluation. + + string[] + + string[] + + + + + + + Microsoft.Tools.WindowsInstaller.IceMessage + + Information generated from each ICE. Specifying -Verbose will show additional information from each ICE. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + test-msiproduct .\example.msi -include ICE0* -exclude ICE03 -v + + Output all messages from ICEs 01 through 09 except for ICE03. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + test-msiproduct .\example.msi -patch .\example.msp -add .\tests\custom.cub + + Apply example.msp to example.msi, then run all the default and custom ICEs. + + + + + + + + Uninstall-MSIPatch + + Installs a patch package or packages for all or only specified products. + + Uninstall + MSIPatch + + + Uninstalls one or more packages from all products which they're applied or only from the specified set of products based on their ProductCode. + + Progress, warnings, and errors during the install are sent through the pipeline making this command fully integrated. + + + + Uninstall-MSIPatch + + Path + + The path to a patch package to uninstall. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + ProductCode + + The ProductCode or ProductCodes from which patches are removed. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during uninstall. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + UserContext + + The user context for the product listed in the ProductCode parameter. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Machine + + + UserSid + + The user security identifier for product listed in the ProductCode parameter. + + String + + String + + + + + Uninstall-MSIPatch + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + Patch + + Information about a patch or patches to uninstall. + + Microsoft.Deployment.WindowsInstaller.PatchInstallation[] + + Microsoft.Deployment.WindowsInstaller.PatchInstallation[] + + + + ProductCode + + The ProductCode or ProductCodes from which patches are removed. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during uninstall. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + UserContext + + The user context for the product listed in the ProductCode parameter. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Machine + + + UserSid + + The user security identifier for product listed in the ProductCode parameter. + + String + + String + + + + + Uninstall-MSIPatch + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + LiteralPath + + The path to a patch package to uninstall. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + ProductCode + + The ProductCode or ProductCodes from which patches are removed. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during uninstall. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + UserContext + + The user context for the product listed in the ProductCode parameter. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Machine + + + UserSid + + The user security identifier for product listed in the ProductCode parameter. + + String + + String + + + + + + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + LiteralPath + + The path to a patch package to uninstall. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + Patch + + Information about a patch or patches to uninstall. + + Microsoft.Deployment.WindowsInstaller.PatchInstallation[] + + Microsoft.Deployment.WindowsInstaller.PatchInstallation[] + + + + Path + + The path to a patch package to uninstall. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + ProductCode + + The ProductCode or ProductCodes from which patches are removed. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during uninstall. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + UserContext + + The user context for the product listed in the ProductCode parameter. + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Microsoft.Deployment.WindowsInstaller.UserContexts + + Machine + + + UserSid + + The user security identifier for product listed in the ProductCode parameter. + + String + + String + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + get-msiproductifo -name TEST | get-msipatchinfo | uninstall-msipatch -log $env:TEMP\unpatch.log + + Uninstalls all patches applied to the product with ProductName TEST and logs to the TEMP directory. + + + + + + + Install-MSIPatch + + + + + + Uninstall-MSIProduct + + Uninstalls a product package or packages, or an existing product on the machine. + + Uninstall + MSIProduct + + + This cmdlet, unlike related cmdlets, is designed to uninstalled one or more products. While there are ways to override this behavior, it is not recommend and you should instead use specialized cmdlets for this purpose. See the related links for suggestions. + + Progress, warnings, and errors during the install are sent through the pipeline making this command fully integrated. + + + + Uninstall-MSIProduct + + Path + + The path to a product package to uninstall. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + Properties + + Additional property=value pairs to pass during uninstall. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + Uninstall-MSIProduct + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + Product + + The product to uninstall. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + Properties + + Additional property=value pairs to pass during uninstall. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + Uninstall-MSIProduct + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + LiteralPath + + The path to a product package to uninstall. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + Properties + + Additional property=value pairs to pass during uninstall. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + Uninstall-MSIProduct + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + ProductCode + + The ProductCode of a product to uninstall. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during uninstall. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + + + Chain + + Whether to install all packages together. If elevated, a single restore point is created for all packages in the chain and reboots are suppressed when possible. + + + SwitchParameter + + + + Force + + Whether to suppress all prompts. + + + SwitchParameter + + + + LiteralPath + + The path to a product package to uninstall. The value of -LiteralPath is used exactly as typed. No characters are interpreted as wildcards. + + string[] + + string[] + + + + Log + + The path to the log file. This use the file name as the base name and will append timestamp and product-specific information. + + String + + String + + + + Path + + The path to a product package to uninstall. Wildcards are permitted. You can specify * in any part of the path to select all matching files. + + string[] + + string[] + + + + Product + + The product to uninstall. + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + Microsoft.Deployment.WindowsInstaller.ProductInstallation[] + + + + ProductCode + + The ProductCode of a product to uninstall. + + string[] + + string[] + + + + Properties + + Additional property=value pairs to pass during uninstall. + + string[] + + string[] + + + + ResultVariable + + The name of a variable to store operation results. Optionally prefix with "+" to combine results with existing results variable. + + String + + String + + + + + + + Microsoft.Deployment.WindowsInstaller.ProductInstallation + + The product to uninstall. + + + + + + + -------------- EXAMPLE 1 -------------- + + C:\PS> + + uninstall-msiproduct .\example.msi -log $env:TEMP\uninstall.log + + Uninstall the example.msi product package and log to the TEMP directory. + + + + + -------------- EXAMPLE 2 -------------- + + C:\PS> + + get-msiproductinfo -name *TEST* | uninstall-msiproduct -chain + + Uninstall all products with ProductName matching *TEST* and show a single progress bar for the entire operation. + + + + + + + Install-MSIProduct + + + Repair-MSIProduct + + + + \ No newline at end of file diff --git a/src/PowerShell/NativeMethods.cs b/src/PowerShell/NativeMethods.cs index cb46f2e..cb56649 100644 --- a/src/PowerShell/NativeMethods.cs +++ b/src/PowerShell/NativeMethods.cs @@ -79,7 +79,8 @@ internal static extern int StgOpenStorageEx( #endregion #region Storage interfaces - [ComImport, Guid("0000000b-0000-0000-c000-000000000046")] + [ComImport] + [Guid("0000000b-0000-0000-c000-000000000046")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IStorage { @@ -160,7 +161,8 @@ void Stat( [MarshalAs(UnmanagedType.U4)] NativeMethods.STATFLAG grfStatFlag); } - [ComImport, Guid("0000000d-0000-0000-C000-000000000046")] + [ComImport] + [Guid("0000000d-0000-0000-C000-000000000046")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IEnumSTATSTG { @@ -184,33 +186,25 @@ void Clone( internal class STATSTG : IDisposable { internal IntPtr pwcsName; - [MarshalAs(UnmanagedType.U4)] internal NativeMethods.STGTY type; - [MarshalAs(UnmanagedType.U8)] internal long cbSize; + [MarshalAs(UnmanagedType.U4)] + internal NativeMethods.STGTY type; + [MarshalAs(UnmanagedType.U8)] + internal long cbSize; internal ComTypes.FILETIME mtime; internal ComTypes.FILETIME ctime; internal ComTypes.FILETIME atime; - [MarshalAs(UnmanagedType.U4)] internal NativeMethods.STGM grfMode; - [MarshalAs(UnmanagedType.U4)] internal int grfLockSupported; + [MarshalAs(UnmanagedType.U4)] + internal NativeMethods.STGM grfMode; + [MarshalAs(UnmanagedType.U4)] + internal int grfLockSupported; internal Guid clsid; - [MarshalAs(UnmanagedType.U4)] internal int grfStateBits; - [MarshalAs(UnmanagedType.U4)] internal int reserved; - - //internal string Name - //{ - // get - // { - // string name = Marshal.PtrToStringUni(pwcsName); - // return name; - // } - //} + [MarshalAs(UnmanagedType.U4)] + internal int grfStateBits; + [MarshalAs(UnmanagedType.U4)] + internal int reserved; void IDisposable.Dispose() { - //if (IntPtr.Zero != pwcsName) - //{ - // Marshal.FreeCoTaskMem(pwcsName); - //} - GC.SuppressFinalize(this); } } @@ -284,15 +278,19 @@ out StateManagerStatus pSMgrStatus [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] internal struct RestorePointInfo { - [MarshalAs(UnmanagedType.U4)] internal RestorePointEventType EventType; - [MarshalAs(UnmanagedType.U4)] internal RestorePointType Type; + [MarshalAs(UnmanagedType.U4)] + internal RestorePointEventType EventType; + [MarshalAs(UnmanagedType.U4)] + internal RestorePointType Type; internal long SequenceNumber; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] internal string Description; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Description; } internal struct StateManagerStatus { - [MarshalAs(UnmanagedType.U4)] internal int ErrorCode; + [MarshalAs(UnmanagedType.U4)] + internal int ErrorCode; internal long SequenceNumber; } diff --git a/src/PowerShell/PackageInfo.cs b/src/PowerShell/PackageInfo.cs index 34a0bf9..e06a5ba 100644 --- a/src/PowerShell/PackageInfo.cs +++ b/src/PowerShell/PackageInfo.cs @@ -1,10 +1,27 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY -// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. +// The MIT License (MIT) +// +// Copyright (c) Microsoft Corporation +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System.IO; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller { diff --git a/src/PowerShell/PatchApplicator.cs b/src/PowerShell/PatchApplicator.cs index fbbd85d..8e49270 100644 --- a/src/PowerShell/PatchApplicator.cs +++ b/src/PowerShell/PatchApplicator.cs @@ -20,12 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Deployment.WindowsInstaller.Package; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Deployment.WindowsInstaller.Package; namespace Microsoft.Tools.WindowsInstaller { @@ -49,7 +49,7 @@ internal sealed class PatchApplicator private PatchSequencer sequencer; /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// /// The to transform. internal PatchApplicator(InstallPackage db) @@ -85,6 +85,7 @@ internal void Add(string path) /// /// Applies applicable transforms in order of sequenced patches. /// + /// Whether to throw an exception if an error occurs. internal void Apply(bool throwOnError = false) { // Need to make a copy of the database since exclusivity is required. @@ -121,7 +122,7 @@ internal void Apply(bool throwOnError = false) } } - [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] + [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "Will dispose later")] private static InstallPackage Copy(InstallPackage db) { var temp = Path.ChangeExtension(Path.GetTempFileName(), ".msi"); diff --git a/src/PowerShell/PatchSequencer.cs b/src/PowerShell/PatchSequencer.cs index 6593a3f..7b86e73 100644 --- a/src/PowerShell/PatchSequencer.cs +++ b/src/PowerShell/PatchSequencer.cs @@ -20,14 +20,14 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Deployment.WindowsInstaller.Package; -using Microsoft.Tools.WindowsInstaller.PowerShell; using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Xml.XPath; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Deployment.WindowsInstaller.Package; +using Microsoft.Tools.WindowsInstaller.PowerShell; namespace Microsoft.Tools.WindowsInstaller { @@ -42,7 +42,7 @@ internal sealed class PatchSequencer private GetApplicablePatchesAction action; /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// internal PatchSequencer() { @@ -145,6 +145,18 @@ internal IEnumerable EndGetApplicablePatches(IAsyncResult result) return this.action.EndInvoke(result); } + private static bool IsPatch(string path) + { + try + { + return FileType.Patch == PowerShell.FileInfo.GetFileTypeInternal(path); + } + catch + { + return false; + } + } + private IEnumerable DetermineApplicablePatches(string product, string userSid, UserContexts context) { var patches = this.Patches.ToArray(); @@ -204,51 +216,5 @@ private void AddTargetProductCodesFromXml(string path) } } } - - private static bool IsPatch(string path) - { - try - { - return FileType.Patch == PowerShell.FileInfo.GetFileTypeInternal(path); - } - catch - { - return false; - } - } - } - - /// - /// Contains information about inapplicable patches. - /// - internal sealed class InapplicablePatchEventArgs : EventArgs - { - /// - /// Creates a new instance of the class. - /// - /// The path to the patch or patch XML file that is not applicable. - /// The ProductCode for or path to the target product. - /// Exception information about why the patch is not applicable. - internal InapplicablePatchEventArgs(string patch, string product, Exception exception) - { - this.Patch = patch; - this.Product = product; - this.Exception = exception; - } - - /// - /// Gets the path to the patch or patch XML file. - /// - internal string Patch { get; private set; } - - /// - /// Gets the ProductCode for or path to the target product. - /// - internal string Product { get; private set; } - - /// - /// Gets exception information about why the patch is not applicable. - /// - internal Exception Exception { get; private set; } } } diff --git a/src/PowerShell/PatchSourceInfo.cs b/src/PowerShell/PatchSourceInfo.cs index dbd9210..53d28a2 100644 --- a/src/PowerShell/PatchSourceInfo.cs +++ b/src/PowerShell/PatchSourceInfo.cs @@ -30,7 +30,7 @@ namespace Microsoft.Tools.WindowsInstaller public class PatchSourceInfo : SourceInfo { /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// /// The ProductCode to which the source is registered. /// The patch code to which the source is regisered. diff --git a/src/PowerShell/PowerShell.csproj b/src/PowerShell/PowerShell.csproj index 21e130b..7f3128b 100644 --- a/src/PowerShell/PowerShell.csproj +++ b/src/PowerShell/PowerShell.csproj @@ -43,6 +43,7 @@ + @@ -161,10 +162,15 @@ True Designer - + + Designer + - - + + + + false + @@ -184,6 +190,11 @@ True + + + + + diff --git a/src/PowerShell/PowerShell/AttributeColumnPropertyAdapter.cs b/src/PowerShell/PowerShell/AttributeColumnPropertyAdapter.cs index c1f1f9a..1f17ef1 100644 --- a/src/PowerShell/PowerShell/AttributeColumnPropertyAdapter.cs +++ b/src/PowerShell/PowerShell/AttributeColumnPropertyAdapter.cs @@ -82,7 +82,7 @@ public override PSAdaptedProperty GetProperty(object baseObject, string property /// Gets the native name for the property value. /// /// The property to check. - /// Always returns the full type name for a . + /// Always returns the full type name for a . public override string GetPropertyTypeName(PSAdaptedProperty adaptedProperty) { var column = adaptedProperty.BaseObject as AttributeColumn; diff --git a/src/PowerShell/PowerShell/AttributeColumnTypeConverter.cs b/src/PowerShell/PowerShell/AttributeColumnTypeConverter.cs index ba623ac..c42adaa 100644 --- a/src/PowerShell/PowerShell/AttributeColumnTypeConverter.cs +++ b/src/PowerShell/PowerShell/AttributeColumnTypeConverter.cs @@ -26,12 +26,12 @@ namespace Microsoft.Tools.WindowsInstaller.PowerShell { /// - /// Converts an (or nullable) to an . + /// Converts an (or nullable) to an . /// public sealed class AttributeColumnTypeConverter : PSTypeConverter { /// - /// Always returns false. + /// Determines if the can be converted to the . /// /// The value to convert from. /// The type to convert to. @@ -42,11 +42,11 @@ public override bool CanConvertFrom(object sourceValue, Type destinationType) } /// - /// Returns true if the is an (or nullable). + /// Returns true if the is an (or nullable). /// /// Should always be an . /// The type to convert to. - /// True if the is an (or nullable). + /// True if the is an (or nullable). public override bool CanConvertTo(object sourceValue, Type destinationType) { if (null != sourceValue && typeof(AttributeColumn) == sourceValue.GetType()) @@ -72,13 +72,13 @@ public override object ConvertFrom(object sourceValue, Type destinationType, IFo } /// - /// Returns an (or null) from an . + /// Returns an (or null) from an . /// /// The to convert. /// The type to convert to. /// An to use during conversion. /// Whether to ignore case during conversion. - /// An (or null) from an . + /// An (or null) from an . /// Conversion to the is not supported. public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) { diff --git a/src/PowerShell/PowerShell/Commands/AddSourceCommand.cs b/src/PowerShell/PowerShell/Commands/AddSourceCommand.cs index 48a8d32..338d25d 100644 --- a/src/PowerShell/PowerShell/Commands/AddSourceCommand.cs +++ b/src/PowerShell/PowerShell/Commands/AddSourceCommand.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Tools.WindowsInstaller.Properties; using System.IO; using System.Management.Automation; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -33,6 +33,23 @@ namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands public sealed class AddSourceCommand : SourcePathCommandBase { private static readonly string ErrorId = "DirectoryNotFound"; + private bool shouldExist = true; + + /// + /// Gets or sets whether to validate that directories exist before they are added to the source list. + /// + [Parameter] + public SwitchParameter Force + { + get { return !this.shouldExist; } + set { this.shouldExist = !value; } + } + + protected override bool ShouldExist + { + get { return this.shouldExist; } + set { this.shouldExist = value; } + } /// /// Registers a source path to a product or patch. @@ -46,7 +63,7 @@ protected override void EndProcessing() { foreach (var path in param.Paths) { - if (this.Validate(path)) + if (this.Force || this.Validate(path)) { installation.SourceList.Add(path); } diff --git a/src/PowerShell/PowerShell/Commands/EditPackageCommand.cs b/src/PowerShell/PowerShell/Commands/EditPackageCommand.cs index e689512..14117e5 100644 --- a/src/PowerShell/PowerShell/Commands/EditPackageCommand.cs +++ b/src/PowerShell/PowerShell/Commands/EditPackageCommand.cs @@ -20,12 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Tools.WindowsInstaller.Properties; using System; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Management.Automation; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/src/PowerShell/PowerShell/Commands/ExportPatchXmlCommand.cs b/src/PowerShell/PowerShell/Commands/ExportPatchXmlCommand.cs index 469fd5d..0de6ec3 100644 --- a/src/PowerShell/PowerShell/Commands/ExportPatchXmlCommand.cs +++ b/src/PowerShell/PowerShell/Commands/ExportPatchXmlCommand.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System.Management.Automation; using System.Text; using System.Xml; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -51,8 +51,9 @@ public sealed class ExportPatchXmlCommand : PSCmdlet /// /// You may also pass a string or code page integer form of an . /// + [Encoding] [Parameter] - [Encoding, ValidateNotNullOrEmpty] + [ValidateNotNullOrEmpty] public Encoding Encoding { get; set; } /// diff --git a/src/PowerShell/PowerShell/Commands/GetComponentCommand.cs b/src/PowerShell/PowerShell/Commands/GetComponentCommand.cs index 7eaa7ff..ca3fa1b 100644 --- a/src/PowerShell/PowerShell/Commands/GetComponentCommand.cs +++ b/src/PowerShell/PowerShell/Commands/GetComponentCommand.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -41,7 +41,8 @@ public sealed class GetComponentCommand : PSCmdlet [Parameter(ParameterSetName = ParameterSet.Component, Position = 0, ValueFromPipelineByPropertyName = true)] [Parameter(ParameterSetName = ParameterSet.Product, Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true)] [Alias("ComponentId")] - [ValidateNotNullOrEmpty, ValidateGuid] + [ValidateNotNullOrEmpty] + [ValidateGuid] public string[] ComponentCode { get; set; } /// @@ -102,7 +103,6 @@ protected override void EndProcessing() } } }); - } /// diff --git a/src/PowerShell/PowerShell/Commands/GetFeatureCommand.cs b/src/PowerShell/PowerShell/Commands/GetFeatureCommand.cs index 80d6bcd..0f503c6 100644 --- a/src/PowerShell/PowerShell/Commands/GetFeatureCommand.cs +++ b/src/PowerShell/PowerShell/Commands/GetFeatureCommand.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System.Diagnostics.CodeAnalysis; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -36,7 +36,7 @@ public sealed class GetFeatureCommand : PSCmdlet /// /// Gets or sets the for which features are enumerated. /// - [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Required by older PowerShell")] [Parameter(ParameterSetName = ParameterSet.Product, Position = 0, Mandatory = true, ValueFromPipeline = true)] public ProductInstallation[] Product { get; set; } @@ -50,7 +50,7 @@ public sealed class GetFeatureCommand : PSCmdlet /// /// Gets or sets the feature names to enumerate. /// - [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Required by older PowerShell")] [Parameter(ParameterSetName = ParameterSet.Feature, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true)] [Alias("Name")] public string[] FeatureName { get; set; } diff --git a/src/PowerShell/PowerShell/Commands/GetLoggingPolicyCommand.cs b/src/PowerShell/PowerShell/Commands/GetLoggingPolicyCommand.cs index 75874ce..a1246f8 100644 --- a/src/PowerShell/PowerShell/Commands/GetLoggingPolicyCommand.cs +++ b/src/PowerShell/PowerShell/Commands/GetLoggingPolicyCommand.cs @@ -32,7 +32,7 @@ namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands public sealed class GetLoggingPolicyCommand : LoggingPolicyCommandBase { /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// public GetLoggingPolicyCommand() : base(null) @@ -40,7 +40,7 @@ public GetLoggingPolicyCommand() } /// - /// Creates a new instance of the class with the given . + /// Initializes a new instance of the class. /// /// The to use. The default is the current instance. internal GetLoggingPolicyCommand(ILoggingPolicyService loggingService = null) diff --git a/src/PowerShell/PowerShell/Commands/GetPatchCommand.cs b/src/PowerShell/PowerShell/Commands/GetPatchCommand.cs index 4fb9ede..e747277 100644 --- a/src/PowerShell/PowerShell/Commands/GetPatchCommand.cs +++ b/src/PowerShell/PowerShell/Commands/GetPatchCommand.cs @@ -20,12 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -45,7 +45,7 @@ public sealed class GetPatchCommand : PSCmdlet /// /// Gets or sets the ProductCodes for which patches are enumerated. /// - [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Required by older PowerShell")] [Parameter(ParameterSetName = ParameterSet.Patch, Position = 0, ValueFromPipelineByPropertyName = true)] [ValidateGuid] public string[] ProductCode { get; set; } @@ -53,7 +53,7 @@ public sealed class GetPatchCommand : PSCmdlet /// /// Gets or sets patch codes for which information is retrieved. /// - [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Required by older PowerShell")] [Parameter(ParameterSetName = ParameterSet.Patch, Position = 1, ValueFromPipelineByPropertyName = true)] [ValidateGuid] public string[] PatchCode { get; set; } @@ -64,7 +64,11 @@ public sealed class GetPatchCommand : PSCmdlet [Parameter(ValueFromPipelineByPropertyName = true)] public PatchStates Filter { - get { return this.filter; } + get + { + return this.filter; + } + set { if (value == PatchStates.None) @@ -83,7 +87,11 @@ public PatchStates Filter [Alias("Context", "InstallContext")] // Backward compatibility. public UserContexts UserContext { - get { return this.context; } + get + { + return this.context; + } + set { if (value == UserContexts.None) @@ -121,8 +129,8 @@ protected override void ProcessRecord() { this.allParameters.Add(new Parameters { - ProductCode = this.ProductCode != null && this.ProductCode.Length > 0 ? this.ProductCode : new string[] { null}, - PatchCode = this.PatchCode != null && this.PatchCode.Length > 0 ? this.PatchCode : new string[] { null}, + ProductCode = this.ProductCode != null && this.ProductCode.Length > 0 ? this.ProductCode : new string[] { null }, + PatchCode = this.PatchCode != null && this.PatchCode.Length > 0 ? this.PatchCode : new string[] { null }, Filter = this.Filter, UserContext = this.UserContext, UserSid = this.UserSid, diff --git a/src/PowerShell/PowerShell/Commands/GetPatchSequenceCommand.cs b/src/PowerShell/PowerShell/Commands/GetPatchSequenceCommand.cs index 71d78db..c794f9a 100644 --- a/src/PowerShell/PowerShell/Commands/GetPatchSequenceCommand.cs +++ b/src/PowerShell/PowerShell/Commands/GetPatchSequenceCommand.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -83,7 +83,8 @@ public override string[] LiteralPath /// [Parameter(ParameterSetName = "Path,ProductCode")] [Parameter(ParameterSetName = "LiteralPath,ProductCode")] - [Alias("User"), Sid] + [Alias("User")] + [Sid] public string UserSid { get; set; } private bool IsProductCode diff --git a/src/PowerShell/PowerShell/Commands/GetProductCommand.cs b/src/PowerShell/PowerShell/Commands/GetProductCommand.cs index 508aca0..5161bdd 100644 --- a/src/PowerShell/PowerShell/Commands/GetProductCommand.cs +++ b/src/PowerShell/PowerShell/Commands/GetProductCommand.cs @@ -20,12 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -42,15 +42,15 @@ public sealed class GetProductCommand : PSCmdlet /// /// Gets or sets the ProductCodes to enumerate. /// - [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Required by older PowerShell")] [Parameter(ParameterSetName = ParameterSet.Product, Position = 0, ValueFromPipelineByPropertyName = true)] [ValidateGuid] public string[] ProductCode { get; set; } /// - /// Sets the wildcard names to enumerate. + /// Gets or sets the wildcard names to enumerate. /// - [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Required by older PowerShell")] [Parameter(ParameterSetName = ParameterSet.Name, Mandatory = true)] public string[] Name { get; set; } @@ -61,7 +61,11 @@ public sealed class GetProductCommand : PSCmdlet [Alias("Context", "InstallContext")] // Backward compatibility. public UserContexts UserContext { - get { return this.context; } + get + { + return this.context; + } + set { if (value == UserContexts.None) @@ -132,6 +136,7 @@ protected override void EndProcessing() this.WriteProducts(null, param.UserSid, param.UserContext); } } + // Enumerate all products in context and match the names using regex. else if (param.ParameterSetName == ParameterSet.Name) { diff --git a/src/PowerShell/PowerShell/Commands/GetPropertyCommand.cs b/src/PowerShell/PowerShell/Commands/GetPropertyCommand.cs index 99544ec..e8f74a4 100644 --- a/src/PowerShell/PowerShell/Commands/GetPropertyCommand.cs +++ b/src/PowerShell/PowerShell/Commands/GetPropertyCommand.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller.Package; using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller.Package; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/src/PowerShell/PowerShell/Commands/GetRelatedProductCommand.cs b/src/PowerShell/PowerShell/Commands/GetRelatedProductCommand.cs index 6075d40..16734c8 100644 --- a/src/PowerShell/PowerShell/Commands/GetRelatedProductCommand.cs +++ b/src/PowerShell/PowerShell/Commands/GetRelatedProductCommand.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -39,7 +39,7 @@ public sealed class GetRelatedProductCommand : PSCmdlet /// /// Gets or sets the UpgradeCode to enumerate related products. /// - [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] + [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Required by older PowerShell")] [Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true)] [ValidateGuid] public string[] UpgradeCode { get; set; } @@ -70,7 +70,7 @@ protected override void EndProcessing() /// /// Enumerates related products and writes them to the pipeline. /// - /// + /// The UpgradeCode of products to write to the pipeline. private void WriteProducts(string upgradeCode) { foreach (ProductInstallation product in ProductInstallation.GetRelatedProducts(upgradeCode)) diff --git a/src/PowerShell/PowerShell/Commands/GetSummaryInfoCommand.cs b/src/PowerShell/PowerShell/Commands/GetSummaryInfoCommand.cs index 8c38956..c2b138b 100644 --- a/src/PowerShell/PowerShell/Commands/GetSummaryInfoCommand.cs +++ b/src/PowerShell/PowerShell/Commands/GetSummaryInfoCommand.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller.Package; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller.Package; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -35,7 +35,8 @@ public sealed class GetSummaryInfoCommand : ItemCommandBase /// /// Gets or sets whether transforms within a patch should be enumerated. /// - [Parameter, Alias("Transforms")] + [Parameter] + [Alias("Transforms")] public SwitchParameter IncludeTransforms { get; set; } /// diff --git a/src/PowerShell/PowerShell/Commands/GetTableCommand.cs b/src/PowerShell/PowerShell/Commands/GetTableCommand.cs index 5f71038..93f8017 100644 --- a/src/PowerShell/PowerShell/Commands/GetTableCommand.cs +++ b/src/PowerShell/PowerShell/Commands/GetTableCommand.cs @@ -20,12 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Tools.WindowsInstaller.Properties; using System; using System.ComponentModel; using System.Globalization; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -230,7 +230,7 @@ private Session OpenProduct(ProductInstallation product) { return Installer.OpenPackage(path, this.IgnoreMachineState); } - else if (product.IsAdvertised && !String.IsNullOrEmpty(product.AdvertisedPackageName)) + else if (product.IsAdvertised && !string.IsNullOrEmpty(product.AdvertisedPackageName)) { // Product is advertised and has no locally installed package. var message = string.Format(Properties.Resources.Error_Advertised, product.ProductCode); diff --git a/src/PowerShell/PowerShell/Commands/InstallCommandActionData.cs b/src/PowerShell/PowerShell/Commands/InstallCommandActionData.cs index 4e8014f..7189666 100644 --- a/src/PowerShell/PowerShell/Commands/InstallCommandActionData.cs +++ b/src/PowerShell/PowerShell/Commands/InstallCommandActionData.cs @@ -85,7 +85,10 @@ public long Weight return this.weight; } - set { this.weight = value; } + set + { + this.weight = value; + } } /// @@ -95,7 +98,8 @@ public long Weight /// A object to resolve the file path. /// A wrapping a file path. /// An instance of an class. - public static T CreateActionData(PathIntrinsics resolver, PSObject file) where T : InstallCommandActionData, new() + public static T CreateActionData(PathIntrinsics resolver, PSObject file) + where T : InstallCommandActionData, new() { if (null == resolver) { diff --git a/src/PowerShell/PowerShell/Commands/InstallCommandBase.cs b/src/PowerShell/PowerShell/Commands/InstallCommandBase.cs index 8ac0572..2cc0238 100644 --- a/src/PowerShell/PowerShell/Commands/InstallCommandBase.cs +++ b/src/PowerShell/PowerShell/Commands/InstallCommandBase.cs @@ -20,8 +20,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Tools.WindowsInstaller.Properties; using System; using System.Collections.Generic; using System.ComponentModel; @@ -29,13 +27,17 @@ using System.Globalization; using System.Management.Automation; using System.Text; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { /// /// Base class for product and patch install commands. /// - public abstract class InstallCommandBase : PSCmdlet where T : InstallCommandActionData, new() + /// A derivative of . + public abstract class InstallCommandBase : PSCmdlet + where T : InstallCommandActionData, new() { /// /// The default install level. @@ -47,7 +49,7 @@ namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands private ProgressDataCollection progress; /// - /// Initializes the cmdlet. + /// Initializes a new instance of the class. /// protected InstallCommandBase() { @@ -117,7 +119,7 @@ public string[] LiteralPath public string ResultVariable { get; set; } /// - /// The queued actions to perform for installation. + /// Gets the queued actions to perform for installation. /// protected ActionQueue Actions { get; private set; } @@ -298,7 +300,7 @@ protected MessageResult OnActionStart(Deployment.WindowsInstaller.Record record) else if (null != record && 2 < record.FieldCount) { var action = record.GetString(1); - Debug.Assert(!string.IsNullOrEmpty(action)); + Debug.Assert(!string.IsNullOrEmpty(action), "Action should not be null at this point"); this.progress.CurrentAction = record.GetString(2); this.progress.CurrentActionTemplate = record.GetString(3); @@ -467,6 +469,7 @@ protected MessageResult OnProgress(Deployment.WindowsInstaller.Record record) { current.Total += 50; } + break; // Update progress information. @@ -491,6 +494,7 @@ protected MessageResult OnProgress(Deployment.WindowsInstaller.Record record) this.progress.Current.EnableActionData = true; this.progress.Current.Step = record.GetInteger(2); } + break; // Report progress information. @@ -510,6 +514,7 @@ protected MessageResult OnProgress(Deployment.WindowsInstaller.Record record) { this.progress.Current.Complete -= record.GetInteger(2); } + break; // Expand the total. diff --git a/src/PowerShell/PowerShell/Commands/InstallPatchActionData.cs b/src/PowerShell/PowerShell/Commands/InstallPatchActionData.cs index d240122..4a51c66 100644 --- a/src/PowerShell/PowerShell/Commands/InstallPatchActionData.cs +++ b/src/PowerShell/PowerShell/Commands/InstallPatchActionData.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System.Collections.Generic; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -31,7 +31,7 @@ namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands public class InstallPatchActionData : InstallCommandActionData { /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// public InstallPatchActionData() { diff --git a/src/PowerShell/PowerShell/Commands/InstallPatchCommand.cs b/src/PowerShell/PowerShell/Commands/InstallPatchCommand.cs index 58189a2..e03a23b 100644 --- a/src/PowerShell/PowerShell/Commands/InstallPatchCommand.cs +++ b/src/PowerShell/PowerShell/Commands/InstallPatchCommand.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/src/PowerShell/PowerShell/Commands/InstallPatchCommandBase.cs b/src/PowerShell/PowerShell/Commands/InstallPatchCommandBase.cs index 04f16aa..1d9052d 100644 --- a/src/PowerShell/PowerShell/Commands/InstallPatchCommandBase.cs +++ b/src/PowerShell/PowerShell/Commands/InstallPatchCommandBase.cs @@ -20,22 +20,24 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Tools.WindowsInstaller.Properties; using System; using System.Collections.Generic; using System.Globalization; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { /// /// Base class for patch-related commands. /// - public abstract class InstallPatchCommandBase : InstallCommandBase where T : InstallPatchActionData, new() + /// A derivative of . + public abstract class InstallPatchCommandBase : InstallCommandBase + where T : InstallPatchActionData, new() { /// - /// Creates a new instance of the class and sets default property values. + /// Initializes a new instance of the class. /// protected InstallPatchCommandBase() { @@ -67,7 +69,8 @@ protected InstallPatchCommandBase() /// Gets or sets the user security identifier for products to which patches apply. /// [Parameter(ValueFromPipelineByPropertyName = true)] - [Alias("User"), Sid] + [Alias("User")] + [Sid] public string UserSid { get; set; } /// diff --git a/src/PowerShell/PowerShell/Commands/InstallProductCommand.cs b/src/PowerShell/PowerShell/Commands/InstallProductCommand.cs index ed1ec78..b3afc35 100644 --- a/src/PowerShell/PowerShell/Commands/InstallProductCommand.cs +++ b/src/PowerShell/PowerShell/Commands/InstallProductCommand.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Tools.WindowsInstaller.Properties; using System.Globalization; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/src/PowerShell/PowerShell/Commands/InstallProductCommandBase.cs b/src/PowerShell/PowerShell/Commands/InstallProductCommandBase.cs index 27c483f..16d6e33 100644 --- a/src/PowerShell/PowerShell/Commands/InstallProductCommandBase.cs +++ b/src/PowerShell/PowerShell/Commands/InstallProductCommandBase.cs @@ -20,16 +20,17 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { /// /// Base class for product-related commands. /// - /// - public abstract class InstallProductCommandBase : InstallCommandBase where T : InstallProductActionData, new() + /// A derivative of . + public abstract class InstallProductCommandBase : InstallCommandBase + where T : InstallProductActionData, new() { /// /// Gets or sets the ProductCode to install. diff --git a/src/PowerShell/PowerShell/Commands/ItemCommandBase.cs b/src/PowerShell/PowerShell/Commands/ItemCommandBase.cs index 618abb1..406f35a 100644 --- a/src/PowerShell/PowerShell/Commands/ItemCommandBase.cs +++ b/src/PowerShell/PowerShell/Commands/ItemCommandBase.cs @@ -20,11 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.Globalization; using System.IO; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -53,7 +53,7 @@ public virtual string[] LiteralPath } /// - /// Gets whether the parameter set name contains "LiteralPath". + /// Gets a value indicating whether the parameter set name contains "LiteralPath". /// protected bool IsLiteralPath { diff --git a/src/PowerShell/PowerShell/Commands/LoggingPolicyCommandBase.cs b/src/PowerShell/PowerShell/Commands/LoggingPolicyCommandBase.cs index 1fbd308..f54a097 100644 --- a/src/PowerShell/PowerShell/Commands/LoggingPolicyCommandBase.cs +++ b/src/PowerShell/PowerShell/Commands/LoggingPolicyCommandBase.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Win32; using System; using System.Management.Automation; +using Microsoft.Win32; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -43,7 +43,7 @@ public abstract class LoggingPolicyCommandBase : Cmdlet, ILoggingPolicyService private readonly ILoggingPolicyService loggingService; /// - /// Creates a new instance of the class using the given . + /// Initializes a new instance of the class. /// /// The to use. The default is the current instance. internal LoggingPolicyCommandBase(ILoggingPolicyService loggingService = null) diff --git a/src/PowerShell/PowerShell/Commands/MeasureProductCommand.cs b/src/PowerShell/PowerShell/Commands/MeasureProductCommand.cs index d3fb90e..9fc470d 100644 --- a/src/PowerShell/PowerShell/Commands/MeasureProductCommand.cs +++ b/src/PowerShell/PowerShell/Commands/MeasureProductCommand.cs @@ -20,12 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Tools.WindowsInstaller.Properties; using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -36,10 +35,10 @@ namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands [OutputType(typeof(PSDriveInfo))] public sealed class MeasureProductCommand : PackageCommandBase { - private static readonly char[] propertyQuotes = new char[] { '\'', '\"' }; - private static readonly char[] propertySeparator = new char[] { '=' }; - private static readonly string viewCustomActions = "SELECT `Action` FROM `CustomAction` WHERE `Type` = 51"; - private static readonly string viewExecuteActions = "SELECT `Action` FROM `InstallExecuteSequence` ORDER BY `Sequence`"; + private static readonly char[] PropertyQuotes = new char[] { '\'', '\"' }; + private static readonly char[] PropertySeparator = new char[] { '=' }; + private static readonly string ViewCustomActions = "SELECT `Action` FROM `CustomAction` WHERE `Type` = 51"; + private static readonly string ViewExecuteActions = "SELECT `Action` FROM `InstallExecuteSequence` ORDER BY `Sequence`"; private InstallUIOptions previousInternalUI = InstallUIOptions.Default; private SpaceRequirementsCollection spaceRequirements = new SpaceRequirementsCollection(); @@ -95,11 +94,11 @@ protected override void ProcessItem(PSObject item) { foreach (var property in this.Properties) { - var pair = property.Split(MeasureProductCommand.propertySeparator, 2); + var pair = property.Split(MeasureProductCommand.PropertySeparator, 2); if (2 == pair.Count()) { // Trim surrounding quotes from the property value. - session[pair[0]] = pair[1].Trim(MeasureProductCommand.propertyQuotes); + session[pair[0]] = pair[1].Trim(MeasureProductCommand.PropertyQuotes); } } } @@ -112,7 +111,7 @@ protected override void ProcessItem(PSObject item) // Invoke any of AppSearch and type 51 custom actions that might affect costing. var actions = MeasureProductCommand.GetCustomActions(db); - using (var view = db.OpenView(MeasureProductCommand.viewExecuteActions)) + using (var view = db.OpenView(MeasureProductCommand.ViewExecuteActions)) { string action = null; @@ -226,7 +225,7 @@ private static Set GetCustomActions(Database db) if (db.Tables.Contains("CustomAction")) { actions = new Set(StringComparer.Ordinal); - using (var view = db.OpenView(MeasureProductCommand.viewCustomActions)) + using (var view = db.OpenView(MeasureProductCommand.ViewCustomActions)) { view.Execute(); @@ -258,7 +257,7 @@ private void WriteInvalidPackageError(string path) private class SpaceRequirements { /// - /// Creates an instance of space requirements for the given . + /// Initializes a new instance of the class. /// /// The drive letter for space requirements. internal SpaceRequirements(string driveLetter) @@ -269,7 +268,7 @@ internal SpaceRequirements(string driveLetter) } /// - /// Gets or sets the drive letter for space requirements. + /// Gets the drive letter for space requirements. /// internal string DriveLetter { get; private set; } @@ -307,6 +306,7 @@ internal SpaceRequirements Get(string driveLetter) return spaceRequirements; } } + /// /// Gets the key for the . /// diff --git a/src/PowerShell/PowerShell/Commands/PackageCommandBase.cs b/src/PowerShell/PowerShell/Commands/PackageCommandBase.cs index 00dfd91..cb7898d 100644 --- a/src/PowerShell/PowerShell/Commands/PackageCommandBase.cs +++ b/src/PowerShell/PowerShell/Commands/PackageCommandBase.cs @@ -20,13 +20,13 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Deployment.WindowsInstaller.Package; -using Microsoft.Tools.WindowsInstaller.Properties; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Deployment.WindowsInstaller.Package; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -51,13 +51,15 @@ public override string[] Path /// /// Gets or sets patch packages to apply before validation. /// - [Parameter, ValidateNotNullOrEmpty] + [Parameter] + [ValidateNotNullOrEmpty] public virtual string[] Patch { get; set; } /// /// Gets or sets transforms to apply before validation. /// - [Parameter, ValidateNotNullOrEmpty] + [Parameter] + [ValidateNotNullOrEmpty] public virtual string[] Transform { get; set; } /// @@ -120,7 +122,7 @@ protected void ApplyTransforms(InstallPackage db) /// /// The path to the database to open. /// A object that must be disposed, or null if not a product or patch database. - [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] + [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "Will dispose later")] protected Database OpenDatabase(string path) { var type = FileInfo.GetFileTypeInternal(path); @@ -164,6 +166,5 @@ protected IEnumerable ResolveFiles(IEnumerable paths) } } } - } } diff --git a/src/PowerShell/PowerShell/Commands/ParameterSet.cs b/src/PowerShell/PowerShell/Commands/ParameterSet.cs index 1873d3e..c160557 100644 --- a/src/PowerShell/PowerShell/Commands/ParameterSet.cs +++ b/src/PowerShell/PowerShell/Commands/ParameterSet.cs @@ -20,7 +20,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. - namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { /// diff --git a/src/PowerShell/PowerShell/Commands/RemoveLoggingPolicyCommand.cs b/src/PowerShell/PowerShell/Commands/RemoveLoggingPolicyCommand.cs index 32b2d61..616aef8 100644 --- a/src/PowerShell/PowerShell/Commands/RemoveLoggingPolicyCommand.cs +++ b/src/PowerShell/PowerShell/Commands/RemoveLoggingPolicyCommand.cs @@ -31,7 +31,7 @@ namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands public sealed class RemoveLoggingPolicyCommand : LoggingPolicyCommandBase { /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// public RemoveLoggingPolicyCommand() : base(null) @@ -39,7 +39,7 @@ public RemoveLoggingPolicyCommand() } /// - /// Creates a new instance of the class with the given . + /// Initializes a new instance of the class. /// /// The to use. The default is the current instance. internal RemoveLoggingPolicyCommand(ILoggingPolicyService loggingService = null) diff --git a/src/PowerShell/PowerShell/Commands/RepairProductActionData.cs b/src/PowerShell/PowerShell/Commands/RepairProductActionData.cs index 9c15fa7..2c998da 100644 --- a/src/PowerShell/PowerShell/Commands/RepairProductActionData.cs +++ b/src/PowerShell/PowerShell/Commands/RepairProductActionData.cs @@ -35,7 +35,7 @@ public class RepairProductActionData : InstallProductActionData public const ReinstallModes Default = ReinstallModes.FileOlderVersion | ReinstallModes.MachineData | ReinstallModes.UserData | ReinstallModes.Shortcut; /// - /// Creates a new instance of the with the . + /// Initializes a new instance of the class. /// public RepairProductActionData() { diff --git a/src/PowerShell/PowerShell/Commands/RepairProductCommand.cs b/src/PowerShell/PowerShell/Commands/RepairProductCommand.cs index 5a31dfc..33c7d9f 100644 --- a/src/PowerShell/PowerShell/Commands/RepairProductCommand.cs +++ b/src/PowerShell/PowerShell/Commands/RepairProductCommand.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +using System.Management.Automation; using Microsoft.Deployment.WindowsInstaller; using Microsoft.Tools.WindowsInstaller.Properties; -using System.Management.Automation; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -36,7 +36,7 @@ public sealed class RepairProductCommand : InstallProductCommandBase - /// Creates a new instance of the with the default . + /// Initializes a new instance of the class. /// public RepairProductCommand() { diff --git a/src/PowerShell/PowerShell/Commands/SetLoggingPolicyCommand.cs b/src/PowerShell/PowerShell/Commands/SetLoggingPolicyCommand.cs index 3301db3..83a57db 100644 --- a/src/PowerShell/PowerShell/Commands/SetLoggingPolicyCommand.cs +++ b/src/PowerShell/PowerShell/Commands/SetLoggingPolicyCommand.cs @@ -32,7 +32,7 @@ namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands public sealed class SetLoggingPolicyCommand : LoggingPolicyCommandBase { /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// public SetLoggingPolicyCommand() : base(null) @@ -40,7 +40,7 @@ public SetLoggingPolicyCommand() } /// - /// Creates a new instance of the class with the given . + /// Initializes a new instance of the class. /// /// The to use. The default is the current instance. internal SetLoggingPolicyCommand(ILoggingPolicyService loggingService = null) diff --git a/src/PowerShell/PowerShell/Commands/SourceCommandBase.cs b/src/PowerShell/PowerShell/Commands/SourceCommandBase.cs index ec240c8..a9a423e 100644 --- a/src/PowerShell/PowerShell/Commands/SourceCommandBase.cs +++ b/src/PowerShell/PowerShell/Commands/SourceCommandBase.cs @@ -20,11 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -34,7 +34,7 @@ namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands public abstract class SourceCommandBase : PSCmdlet { /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// protected SourceCommandBase() { @@ -57,7 +57,8 @@ protected SourceCommandBase() /// /// Gets or sets the user SID of the product or patch. /// - [Alias("User"), Sid] + [Alias("User")] + [Sid] [Parameter(ValueFromPipelineByPropertyName = true)] public string UserSid { get; set; } @@ -198,7 +199,7 @@ protected void WriteSourceList(Installation installation) protected class Parameters { /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// internal Parameters() { @@ -206,22 +207,22 @@ internal Parameters() } /// - /// Gets or sets the ProductCode parameter. + /// Gets the ProductCode parameter. /// public string ProductCode { get; internal set; } /// - /// Gets or sets the PatchCode parameter. + /// Gets the PatchCode parameter. /// public string PatchCode { get; internal set; } /// - /// Gets or sets the UserSid parameter. + /// Gets the UserSid parameter. /// public string UserSid { get; internal set; } /// - /// Gets or sets the UserContext parameter. + /// Gets the UserContext parameter. /// public UserContexts UserContext { get; internal set; } @@ -237,7 +238,7 @@ internal Parameters() protected class ParametersCollection : KeyedCollection { /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// public ParametersCollection() : base(StringComparer.OrdinalIgnoreCase) @@ -248,7 +249,6 @@ public ParametersCollection() /// Adds a new instance or updates the of an existing one. /// /// The instance to add or merge into an existing one. - /// The updated instance. public new void Add(Parameters param) { var key = this.GetKeyForItem(param); diff --git a/src/PowerShell/PowerShell/Commands/SourcePathCommandBase.cs b/src/PowerShell/PowerShell/Commands/SourcePathCommandBase.cs index d260834..9c74ff0 100644 --- a/src/PowerShell/PowerShell/Commands/SourcePathCommandBase.cs +++ b/src/PowerShell/PowerShell/Commands/SourcePathCommandBase.cs @@ -20,6 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +using System.Collections.Generic; using System.Management.Automation; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands @@ -53,20 +54,33 @@ public string[] LiteralPath [Parameter] public SwitchParameter PassThru { get; set; } + /// + /// Gets or sets a value indicating whether the or must exist. + /// + protected virtual bool ShouldExist { get; set; } + /// /// Adds the resolved path to the . /// /// The to update. protected override void UpdateParameters(Parameters param) { - var items = this.InvokeProvider.Item.Get(this.Path, true, ParameterSet.LiteralPath == this.ParameterSetName); - - foreach (var item in items) + IEnumerable paths; + if (this.ShouldExist) { - var path = item.GetPropertyValue("PSPath"); - path = this.SessionState.Path.GetUnresolvedProviderPathFromPSPath(path); + paths = this.InvokeProvider.Item + .Get(this.Path, true, ParameterSet.LiteralPath == this.ParameterSetName) + .Select(item => item.GetPropertyValue("PSPath")); + } + else + { + paths = this.Path; + } - param.Paths.Add(path); + foreach (var path in paths) + { + var providerPath = this.SessionState.Path.GetUnresolvedProviderPathFromPSPath(path); + param.Paths.Add(providerPath); } } } diff --git a/src/PowerShell/PowerShell/Commands/TestProductCommand.cs b/src/PowerShell/PowerShell/Commands/TestProductCommand.cs index e979d16..f03fa2f 100644 --- a/src/PowerShell/PowerShell/Commands/TestProductCommand.cs +++ b/src/PowerShell/PowerShell/Commands/TestProductCommand.cs @@ -20,14 +20,14 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Deployment.WindowsInstaller.Package; -using Microsoft.Tools.WindowsInstaller.Properties; using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Deployment.WindowsInstaller.Package; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -42,13 +42,15 @@ public sealed class TestProductCommand : PackageCommandBase private ExternalUIRecordHandler previousExternalUI = null; // Used by nested classes. - private Queue Output = new Queue(); - private string CurrentPath = null; + private Queue output = new Queue(); + private string currentPath = null; /// /// Gets or sets additional ICE .cub files to use for validation. /// - [Parameter, Alias("Cube"), ValidateNotNullOrEmpty] + [Parameter] + [Alias("Cube")] + [ValidateNotNullOrEmpty] public string[] AdditionalCube { get; set; } /// @@ -60,17 +62,19 @@ public sealed class TestProductCommand : PackageCommandBase /// /// Gets or sets the wilcard patterns of ICEs to include. By default, all ICEs are included. /// - [Parameter, ValidateNotNullOrEmpty] + [Parameter] + [ValidateNotNullOrEmpty] public string[] Include { get; set; } /// /// Gets or sets the wilcard patterns of ICEs to exclude. By default, all ICEs are included. /// - [Parameter, ValidateNotNullOrEmpty] + [Parameter] + [ValidateNotNullOrEmpty] public string[] Exclude { get; set; } /// - /// Gets whether the standard Verbose parameter was set. + /// Gets a value indicating whether the standard Verbose parameter was set. /// private bool IsVerbose { @@ -102,7 +106,7 @@ protected override void ProcessItem(PSObject item) // Get the item path and set the current context. string path = item.GetPropertyValue("PSPath"); path = this.SessionState.Path.GetUnresolvedProviderPathFromPSPath(path); - this.CurrentPath = path; + this.currentPath = path; // Copy the database to a writable location and open. string copy = this.Copy(path); @@ -291,7 +295,7 @@ private MessageResult OnError(Deployment.WindowsInstaller.Record record) if (null != ex.ErrorRecord) { var data = new Data(DataType.Error, ex.ErrorRecord); - this.Output.Enqueue(data); + this.output.Enqueue(data); } } } @@ -306,7 +310,7 @@ private MessageResult OnWarning(Deployment.WindowsInstaller.Record record) string message = record.ToString(); var data = new Data(DataType.Warning, message); - this.Output.Enqueue(data); + this.output.Enqueue(data); } return MessageResult.OK; @@ -322,17 +326,17 @@ private MessageResult OnInformation(Deployment.WindowsInstaller.Record record) var ice = new IceMessage(message); var obj = PSObject.AsPSObject(ice); - if (!string.IsNullOrEmpty(this.CurrentPath)) + if (!string.IsNullOrEmpty(this.currentPath)) { - ice.Path = this.CurrentPath; + ice.Path = this.currentPath; // Set the PSPath for cmdlets that would use it. - string path = this.SessionState.Path.GetUnresolvedPSPathFromProviderPath(this.CurrentPath); + string path = this.SessionState.Path.GetUnresolvedPSPathFromProviderPath(this.currentPath); obj.SetPropertyValue("PSPath", path); } var data = new Data(DataType.Information, obj); - this.Output.Enqueue(data); + this.output.Enqueue(data); } } @@ -343,9 +347,9 @@ private void Flush() { // Since the session runs in a separate thread, data enqueued in an output queue // and must be dequeued in the pipeline execution thread. - while (0 < this.Output.Count) + while (0 < this.output.Count) { - var data = this.Output.Dequeue(); + var data = this.output.Dequeue(); switch (data.Type) { case DataType.Error: @@ -366,6 +370,7 @@ private void Flush() { this.WriteVerbose(data.Output.ToString()); } + break; } } diff --git a/src/PowerShell/PowerShell/Commands/UninstallPatchCommand.cs b/src/PowerShell/PowerShell/Commands/UninstallPatchCommand.cs index ed29717..1f3544c 100644 --- a/src/PowerShell/PowerShell/Commands/UninstallPatchCommand.cs +++ b/src/PowerShell/PowerShell/Commands/UninstallPatchCommand.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/src/PowerShell/PowerShell/Commands/UninstallProductCommand.cs b/src/PowerShell/PowerShell/Commands/UninstallProductCommand.cs index 73fee60..ca40c83 100644 --- a/src/PowerShell/PowerShell/Commands/UninstallProductCommand.cs +++ b/src/PowerShell/PowerShell/Commands/UninstallProductCommand.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +using System.Management.Automation; using Microsoft.Deployment.WindowsInstaller; using Microsoft.Tools.WindowsInstaller.Properties; -using System.Management.Automation; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/src/PowerShell/PowerShell/ExtensionMethods.cs b/src/PowerShell/PowerShell/ExtensionMethods.cs index 3a995be..60d5088 100644 --- a/src/PowerShell/PowerShell/ExtensionMethods.cs +++ b/src/PowerShell/PowerShell/ExtensionMethods.cs @@ -20,11 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.Collections.Generic; using System.Globalization; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell { @@ -39,7 +39,8 @@ internal static class ExtensionMethods private static readonly string ProviderSeparator = "::"; private static readonly string RegistryProvider = @"Microsoft.PowerShell.Core\Registry::"; - internal static T As(this PSObject obj) where T : class + internal static T As(this PSObject obj) + where T : class { if (null != obj) { @@ -48,10 +49,11 @@ internal static T As(this PSObject obj) where T : class return null; } + /// /// Matches a string using any of the wildcard . /// - /// The to be matched. + /// The to be matched. /// A list of objects to match. /// True if the string matches any of the ; otherwise, false if the string or patterns are null, empty, or not match is found. internal static bool Match(this string source, IList patterns) diff --git a/src/PowerShell/PowerShell/Module.cs b/src/PowerShell/PowerShell/Module.cs index 4d0ae64..d57d05f 100644 --- a/src/PowerShell/PowerShell/Module.cs +++ b/src/PowerShell/PowerShell/Module.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System.Diagnostics.CodeAnalysis; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell { diff --git a/src/PowerShell/PowerShell/PSInstallerException.cs b/src/PowerShell/PowerShell/PSInstallerException.cs index 77f0c7a..889987a 100644 --- a/src/PowerShell/PowerShell/PSInstallerException.cs +++ b/src/PowerShell/PowerShell/PSInstallerException.cs @@ -20,12 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.Globalization; using System.Management.Automation; using System.Runtime.Serialization; using System.Security.Permissions; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell { @@ -43,7 +43,7 @@ public sealed class PSInstallerException : Exception, IContainsErrorRecord, IDis private Deployment.WindowsInstaller.Record record; /// - /// Creates a from the given . + /// Initializes a new instance of the class. /// /// The containing error details. public PSInstallerException(Deployment.WindowsInstaller.Record record) @@ -53,16 +53,18 @@ public PSInstallerException(Deployment.WindowsInstaller.Record record) } /// - /// Creates a from the given inner exception. + /// Initializes a new instance of the class. /// /// The containing error details. - public PSInstallerException(InstallerException innerException) : base(null, innerException) + public PSInstallerException(InstallerException innerException) + : base(null, innerException) { this.errorRecord = null; this.record = null; } - private PSInstallerException(SerializationInfo info, StreamingContext context) : base(info, context) + private PSInstallerException(SerializationInfo info, StreamingContext context) + : base(info, context) { // ErrorRecord is cache only. this.errorRecord = null; @@ -174,21 +176,6 @@ public override string Message } } - private Deployment.WindowsInstaller.Record GetRecord() - { - if (null != this.record) - { - return this.record; - } - else if (this.InnerException is InstallerException) - { - var ex = (InstallerException)this.InnerException; - return ex.GetErrorRecord(); - } - - return null; - } - private static ErrorCategory GetErrorCategory(Deployment.WindowsInstaller.Record record, out string resource) { resource = null; @@ -241,5 +228,20 @@ private static ErrorCategory GetErrorCategory(Deployment.WindowsInstaller.Record return ErrorCategory.NotSpecified; } + + private Deployment.WindowsInstaller.Record GetRecord() + { + if (null != this.record) + { + return this.record; + } + else if (this.InnerException is InstallerException) + { + var ex = (InstallerException)this.InnerException; + return ex.GetErrorRecord(); + } + + return null; + } } } diff --git a/src/PowerShell/PowerShell/PropertySet.cs b/src/PowerShell/PowerShell/PropertySet.cs index 7c8f620..df15f15 100644 --- a/src/PowerShell/PowerShell/PropertySet.cs +++ b/src/PowerShell/PowerShell/PropertySet.cs @@ -32,9 +32,10 @@ namespace Microsoft.Tools.WindowsInstaller.PowerShell internal sealed class PropertySet : KeyedCollection { /// - /// Creates a case-insensitive instance of the class. + /// Initializes a new instance of the class. /// - internal PropertySet() : base(StringComparer.OrdinalIgnoreCase) + internal PropertySet() + : base(StringComparer.OrdinalIgnoreCase) { } @@ -61,7 +62,7 @@ protected override string GetKeyForItem(PSAdaptedProperty item) /// /// Converts the collection of items to a collection of type . /// - /// + /// A collection of adapter properties. internal Collection ToCollection() { return new Collection(this.Items); diff --git a/src/PowerShell/PowerShell/RecordPropertyAdapter.cs b/src/PowerShell/PowerShell/RecordPropertyAdapter.cs index dd10a5a..20e5847 100644 --- a/src/PowerShell/PowerShell/RecordPropertyAdapter.cs +++ b/src/PowerShell/PowerShell/RecordPropertyAdapter.cs @@ -64,6 +64,7 @@ public static string GetPath(PSObject obj) return null; } + /// /// Gets the query string that returned the for use in code methods. /// diff --git a/src/PowerShell/PowerShell/ViewManager.cs b/src/PowerShell/PowerShell/ViewManager.cs index e5a09ee..9e7ca91 100644 --- a/src/PowerShell/PowerShell/ViewManager.cs +++ b/src/PowerShell/PowerShell/ViewManager.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller.PowerShell { @@ -37,7 +37,7 @@ internal static class ViewManager private static Dictionary memberSets; /// - /// Initializes the . + /// Initializes static members of the class. /// static ViewManager() { diff --git a/src/PowerShell/Properties/Resources.Designer.cs b/src/PowerShell/Properties/Resources.Designer.cs index c9552f0..6a4627b 100644 --- a/src/PowerShell/Properties/Resources.Designer.cs +++ b/src/PowerShell/Properties/Resources.Designer.cs @@ -8,10 +8,8 @@ // //------------------------------------------------------------------------------ -namespace Microsoft.Tools.WindowsInstaller.Properties { - using System; - - +namespace Microsoft.Tools.WindowsInstaller.Properties +{ /// /// A strongly-typed resource class, for looking up localized strings, etc. /// diff --git a/src/PowerShell/Record.cs b/src/PowerShell/Record.cs index 7a7d637..c4ab04b 100644 --- a/src/PowerShell/Record.cs +++ b/src/PowerShell/Record.cs @@ -38,8 +38,7 @@ public sealed class Record internal static readonly string KeySeparator = "/"; /// - /// Creates a new instance of the class copying values - /// from the object. + /// Initializes a new instance of the class. /// /// The from which to copy values. /// The for a . diff --git a/src/PowerShell/RegistryView.cs b/src/PowerShell/RegistryView.cs index 0d8628f..227cd69 100644 --- a/src/PowerShell/RegistryView.cs +++ b/src/PowerShell/RegistryView.cs @@ -34,10 +34,6 @@ namespace Microsoft.Tools.WindowsInstaller /// internal sealed class RegistryView { - // Singleton fields. - private static volatile object syncRoot = new object(); - private static RegistryView instance = null; - // Improve performance by loading fields instead of allocating new strings each time. private static readonly string SOFTWARE = @"\SOFTWARE"; private static readonly string WOW64 = @"\Wow6432Node"; @@ -52,96 +48,100 @@ internal sealed class RegistryView private static readonly string HKLM_WOW64 = @"HKEY_LOCAL_MACHINE" + SOFTWARE_WOW64; private static readonly string HKU = "HKEY_USERS"; - private static readonly Tree tree; + private static readonly Tree Tree; + + // Singleton fields. + private static volatile object syncRoot = new object(); + private static RegistryView instance = null; static RegistryView() { // The value is false if Shared or true if Redirected. - tree = new Tree(); + Tree = new Tree(); // HKEY_CLASSES_ROOT - tree.Add(@"00:\CLSID", true); - tree.Add(@"00:\DirectShow", true); - tree.Add(@"00:\Interface", true); - tree.Add(@"00:\Media Type", true); - tree.Add(@"00:\MediaFoundation", true); + Tree.Add(@"00:\CLSID", true); + Tree.Add(@"00:\DirectShow", true); + Tree.Add(@"00:\Interface", true); + Tree.Add(@"00:\Media Type", true); + Tree.Add(@"00:\MediaFoundation", true); // HKEY_CURRENT_USER - tree.Add(@"01:\SOFTWARE\Classes\CLSID", true); - tree.Add(@"01:\SOFTWARE\Classes\DirectShow", true); - tree.Add(@"01:\SOFTWARE\Classes\Interface", true); - tree.Add(@"01:\SOFTWARE\Classes\Media Type", true); - tree.Add(@"01:\SOFTWARE\Classes\MediaFoundation", true); + Tree.Add(@"01:\SOFTWARE\Classes\CLSID", true); + Tree.Add(@"01:\SOFTWARE\Classes\DirectShow", true); + Tree.Add(@"01:\SOFTWARE\Classes\Interface", true); + Tree.Add(@"01:\SOFTWARE\Classes\Media Type", true); + Tree.Add(@"01:\SOFTWARE\Classes\MediaFoundation", true); // HKEY_LOCAL_MACHINE - tree.Add(@"02:\SOFTWARE", true); - tree.Add(@"02:\SOFTWARE\Classes", false); - tree.Add(@"02:\SOFTWARE\Classes\CLSID", true); - tree.Add(@"02:\SOFTWARE\Classes\DirectShow", true); - tree.Add(@"02:\SOFTWARE\Classes\Interface", true); - tree.Add(@"02:\SOFTWARE\Classes\Media Type", true); - tree.Add(@"02:\SOFTWARE\Classes\MediaFoundation", true); - tree.Add(@"02:\SOFTWARE\Clients", false); - tree.Add(@"02:\SOFTWARE\Microsoft\COM3", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Cryptography\Calais\Current", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Cryptography\Calais\Readers", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Cryptography\Services", false); - tree.Add(@"02:\SOFTWARE\Microsoft\CTF\SystemShared", false); - tree.Add(@"02:\SOFTWARE\Microsoft\CTF\TIP", false); - tree.Add(@"02:\SOFTWARE\Microsoft\DFS", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Driver Signing", false); - tree.Add(@"02:\SOFTWARE\Microsoft\EnterpriseCertificates", false); - tree.Add(@"02:\SOFTWARE\Microsoft\EventSystem", false); - tree.Add(@"02:\SOFTWARE\Microsoft\MSMQ", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Non-Driver Signing", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Notepad\DefaultFonts", false); - tree.Add(@"02:\SOFTWARE\Microsoft\OLE", false); - tree.Add(@"02:\SOFTWARE\Microsoft\RAS", false); - tree.Add(@"02:\SOFTWARE\Microsoft\RPC", false); - tree.Add(@"02:\SOFTWARE\Microsoft\SOFTWARE\Microsoft\Shared Tools\MSInfo", false); - tree.Add(@"02:\SOFTWARE\Microsoft\SystemCertificates", false); - tree.Add(@"02:\SOFTWARE\Microsoft\TermServLicensing", false); - tree.Add(@"02:\SOFTWARE\Microsoft\TransactionServer", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cursors\Schemes", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\KindMap", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\PreviewHandlers", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Telephony\Locations", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDpi", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontMapper", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Gre_Initialize", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Language Pack", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", false); - tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones", false); - tree.Add(@"02:\SOFTWARE\Policies", false); - tree.Add(@"02:\SOFTWARE\RegisteredApplications", false); + Tree.Add(@"02:\SOFTWARE", true); + Tree.Add(@"02:\SOFTWARE\Classes", false); + Tree.Add(@"02:\SOFTWARE\Classes\CLSID", true); + Tree.Add(@"02:\SOFTWARE\Classes\DirectShow", true); + Tree.Add(@"02:\SOFTWARE\Classes\Interface", true); + Tree.Add(@"02:\SOFTWARE\Classes\Media Type", true); + Tree.Add(@"02:\SOFTWARE\Classes\MediaFoundation", true); + Tree.Add(@"02:\SOFTWARE\Clients", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\COM3", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Cryptography\Calais\Current", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Cryptography\Calais\Readers", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Cryptography\Services", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\CTF\SystemShared", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\CTF\TIP", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\DFS", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Driver Signing", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\EnterpriseCertificates", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\EventSystem", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\MSMQ", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Non-Driver Signing", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Notepad\DefaultFonts", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\OLE", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\RAS", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\RPC", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\SOFTWARE\Microsoft\Shared Tools\MSInfo", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\SystemCertificates", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\TermServLicensing", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\TransactionServer", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cursors\Schemes", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\KindMap", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\PreviewHandlers", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows\CurrentVersion\Telephony\Locations", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDpi", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontMapper", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Gre_Initialize", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Language Pack", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", false); + Tree.Add(@"02:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones", false); + Tree.Add(@"02:\SOFTWARE\Policies", false); + Tree.Add(@"02:\SOFTWARE\RegisteredApplications", false); // HKEY_USERS - tree.Add(@"03:\*\SOFTWARE\Classes\CLSID", true); - tree.Add(@"03:\*\SOFTWARE\Classes\DirectShow", true); - tree.Add(@"03:\*\SOFTWARE\Classes\Interface", true); - tree.Add(@"03:\*\SOFTWARE\Classes\Media Type", true); - tree.Add(@"03:\*\SOFTWARE\Classes\MediaFoundation", true); + Tree.Add(@"03:\*\SOFTWARE\Classes\CLSID", true); + Tree.Add(@"03:\*\SOFTWARE\Classes\DirectShow", true); + Tree.Add(@"03:\*\SOFTWARE\Classes\Interface", true); + Tree.Add(@"03:\*\SOFTWARE\Classes\Media Type", true); + Tree.Add(@"03:\*\SOFTWARE\Classes\MediaFoundation", true); } /// /// Gets the single instance for the current process bitness. /// - /// + /// The single instance for the current process bitness. internal static RegistryView GetInstance() { if (null == instance) @@ -159,7 +159,7 @@ internal static RegistryView GetInstance() } /// - /// Creates a new instance of the class for the given bitness. + /// Initializes a new instance of the class. /// /// True if running under a 64-bit process; otherwise, false for a 32-bit process. internal RegistryView(bool is64Bit) @@ -168,7 +168,7 @@ internal RegistryView(bool is64Bit) } /// - /// Gets whether the code is executing in a 64-bit process. + /// Gets a value indicating whether the code is executing in a 64-bit process. /// internal bool Is64Bit { get; private set; } @@ -205,7 +205,7 @@ internal string MapKeyPath(string keyPath) else { // Return 64-bit paths as-is but map 32-bit paths to WOW64 node only if redirected. - if (is64Bit || !tree.Under(keyPath)) + if (is64Bit || !Tree.Under(keyPath)) { root = this.MapRoot(path, true, hive); } diff --git a/src/PowerShell/ReinstallModesConverter.cs b/src/PowerShell/ReinstallModesConverter.cs index bc4370a..1a42acb 100644 --- a/src/PowerShell/ReinstallModesConverter.cs +++ b/src/PowerShell/ReinstallModesConverter.cs @@ -20,12 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.Tools.WindowsInstaller.Properties; using System; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Tools.WindowsInstaller.Properties; namespace Microsoft.Tools.WindowsInstaller { @@ -60,33 +60,33 @@ static ReinstallModesConverter() } /// - /// Returns True when is a . + /// Returns True when is a . /// /// Additional context for conversion. /// The type of the source object. - /// True if the is a . + /// True if the is a . public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return typeof(string) == sourceType; } /// - /// Returns True when is a . + /// Returns True when is a . /// /// Additional context for conversion. /// The type of the destination object. - /// True if the is a . + /// True if the is a . public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return typeof(string) == destinationType; } /// - /// Converts a in the short form like "omus" to a enumeration. + /// Converts a in the short form like "omus" to a enumeration. /// /// Additional context for conversion. /// The culture to use for conversion. - /// The value to convert. + /// The value to convert. /// The converted enumeration. /// The short form string contains invalid characters. public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) @@ -124,13 +124,13 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c } /// - /// Converts a to a short form like "omus". + /// Converts a to a short form like "omus". /// /// Additional context for conversion. /// The culture to use for conversion. /// The to convert. /// The type of the destination object. - /// + /// The short form. public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (null != value && this.CanConvertTo(context, destinationType)) diff --git a/src/PowerShell/Result.cs b/src/PowerShell/Result.cs index d37984e..70ad6dd 100644 --- a/src/PowerShell/Result.cs +++ b/src/PowerShell/Result.cs @@ -29,38 +29,42 @@ namespace Microsoft.Tools.WindowsInstaller /// public sealed class Result { - private bool _rebootInitiated; - private bool _rebootRequired; + private bool rebootInitiated; + private bool rebootRequired; /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// internal Result() { - this._rebootInitiated = false; - this._rebootRequired = false; + this.rebootInitiated = false; + this.rebootRequired = false; } /// - /// Gets whether a reboot has been initiated already. + /// Gets a value indicating whether a reboot has been initiated already. /// public bool RebootInitiated { - get { return this._rebootInitiated; } + get + { + return this.rebootInitiated; + } + internal set { - this._rebootInitiated |= value; - this._rebootRequired |= value; + this.rebootInitiated |= value; + this.rebootRequired |= value; } } /// - /// Gets whether a reboot is required or has been initiated already. + /// Gets a value indicating whether a reboot is required or has been initiated already. /// public bool RebootRequired { - get { return this._rebootRequired; } - internal set { this._rebootRequired |= value; } + get { return this.rebootRequired; } + internal set { this.rebootRequired |= value; } } /// @@ -83,8 +87,8 @@ public bool RebootRequired var result = new Result(); - result._rebootInitiated = x._rebootInitiated | y._rebootInitiated; - result._rebootRequired = result._rebootInitiated | x._rebootRequired | y._rebootRequired; + result.rebootInitiated = x.rebootInitiated | y.rebootInitiated; + result.rebootRequired = result.rebootInitiated | x.rebootRequired | y.rebootRequired; return result; } diff --git a/src/PowerShell/Set.cs b/src/PowerShell/Set.cs index 8b7fd20..80d20c3 100644 --- a/src/PowerShell/Set.cs +++ b/src/PowerShell/Set.cs @@ -32,10 +32,11 @@ namespace Microsoft.Tools.WindowsInstaller internal sealed class Set : KeyedCollection { /// - /// Creates a new instance of the class with the given equality comparer. + /// Initializes a new instance of the class. /// /// The equality comparer to use. - internal Set(IEqualityComparer comparer = null) : base(comparer ?? EqualityComparer.Default) + internal Set(IEqualityComparer comparer = null) + : base(comparer ?? EqualityComparer.Default) { } diff --git a/src/PowerShell/SourceInfo.cs b/src/PowerShell/SourceInfo.cs index a5bcfca..01bc4e7 100644 --- a/src/PowerShell/SourceInfo.cs +++ b/src/PowerShell/SourceInfo.cs @@ -30,7 +30,7 @@ namespace Microsoft.Tools.WindowsInstaller public class SourceInfo { /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// /// The ProductCode to which the source is registered. /// The user SID of the product. diff --git a/src/PowerShell/Storage.cs b/src/PowerShell/Storage.cs index 3e4392c..7077302 100644 --- a/src/PowerShell/Storage.cs +++ b/src/PowerShell/Storage.cs @@ -61,13 +61,15 @@ internal static Storage OpenStorage(string path) NativeMethods.IStorage stg = null; Guid iid = NativeMethods.IID_IStorage; - int ret = NativeMethods.StgOpenStorageEx(path, + int ret = NativeMethods.StgOpenStorageEx( + path, NativeMethods.STGM.STGM_READ | NativeMethods.STGM.STGM_SHARE_DENY_WRITE, NativeMethods.STGFMT.STGFMT_STORAGE, 0, IntPtr.Zero, IntPtr.Zero, - ref iid, out stg); + ref iid, + out stg); if (NativeMethods.STG_E_FILEALREADYEXISTS == ret) { @@ -92,7 +94,7 @@ internal Guid ClassIdentity { get { - if (Guid.Empty == classId) + if (Guid.Empty == this.classId) { using (NativeMethods.STATSTG stat = new NativeMethods.STATSTG()) { diff --git a/src/PowerShell/SummaryInfo.cs b/src/PowerShell/SummaryInfo.cs index b333a91..ea929f6 100644 --- a/src/PowerShell/SummaryInfo.cs +++ b/src/PowerShell/SummaryInfo.cs @@ -31,8 +31,7 @@ namespace Microsoft.Tools.WindowsInstaller public sealed class SummaryInfo { /// - /// Creates a new instance of the class copying values - /// from the object. + /// Initializes a new instance of the class. /// /// The from which to copy values. /// The parameter is null. diff --git a/src/PowerShell/SystemRestorePoint.cs b/src/PowerShell/SystemRestorePoint.cs index ea93d23..138e9ee 100644 --- a/src/PowerShell/SystemRestorePoint.cs +++ b/src/PowerShell/SystemRestorePoint.cs @@ -30,9 +30,9 @@ namespace Microsoft.Tools.WindowsInstaller /// internal sealed class SystemRestorePoint { - private static ISystemRestoreService _defaultService; - private ISystemRestoreService _service; - private RestorePointInfo _info; + private static ISystemRestoreService defaultService; + private ISystemRestoreService service; + private RestorePointInfo info; /// /// Begins a system restore point. @@ -72,8 +72,8 @@ internal static SystemRestorePoint Create(RestorePointType type, string descript var instance = new SystemRestorePoint() { - _service = service ?? SystemRestorePoint.DefaultServiceProvider, - _info = info, + service = service ?? SystemRestorePoint.DefaultServiceProvider, + info = info, }; // Create the system restore point. @@ -81,7 +81,7 @@ internal static SystemRestorePoint Create(RestorePointType type, string descript // Update the sequence number. info.SequenceNumber = status.SequenceNumber; - instance._info = info; + instance.info = info; return instance; } @@ -94,8 +94,8 @@ internal static SystemRestorePoint Create(RestorePointType type, string descript /// internal static ISystemRestoreService DefaultServiceProvider { - get { return _defaultService ?? DefaultSystemRestoreService.GetInstance(); } - set { _defaultService = value; } + get { return defaultService ?? DefaultSystemRestoreService.GetInstance(); } + set { defaultService = value; } } /// @@ -103,7 +103,7 @@ internal static ISystemRestoreService DefaultServiceProvider /// internal string Description { - get { return this._info.Description; } + get { return this.info.Description; } } /// @@ -111,7 +111,7 @@ internal string Description /// internal long SequenceNumber { - get { return this._info.SequenceNumber; } + get { return this.info.SequenceNumber; } } /// @@ -119,10 +119,10 @@ internal long SequenceNumber /// internal void Commit() { - if (RestorePointEventType.EndSystemChange != _info.EventType) + if (RestorePointEventType.EndSystemChange != this.info.EventType) { // Copy information for next call. - var info = this._info; + var info = this.info; info.EventType = RestorePointEventType.EndSystemChange; this.SetRestorePoint(info); @@ -134,10 +134,10 @@ internal void Commit() /// internal void Rollback() { - if (RestorePointEventType.EndSystemChange != this._info.EventType) + if (RestorePointEventType.EndSystemChange != this.info.EventType) { // Copy information for next call. - var info = this._info; + var info = this.info; info.Type = RestorePointType.CancelledOperation; info.EventType = RestorePointEventType.EndSystemChange; @@ -152,7 +152,7 @@ private SystemRestorePoint() private StateManagerStatus SetRestorePoint(RestorePointInfo info) { StateManagerStatus status; - if (!this._service.SetRestorePoint(info, out status)) + if (!this.service.SetRestorePoint(info, out status)) { throw new Win32Exception(status.ErrorCode); } @@ -162,23 +162,23 @@ private StateManagerStatus SetRestorePoint(RestorePointInfo info) private class DefaultSystemRestoreService : ISystemRestoreService { - private static volatile object _monitor = new object(); - private static ISystemRestoreService _instance = null; + private static volatile object monitor = new object(); + private static ISystemRestoreService instance = null; internal static ISystemRestoreService GetInstance() { - if (null == _instance) + if (null == instance) { - lock (_monitor) + lock (monitor) { - if (null == _instance) + if (null == instance) { - _instance = new DefaultSystemRestoreService(); + instance = new DefaultSystemRestoreService(); } } } - return _instance; + return instance; } public bool SetRestorePoint(RestorePointInfo info, out StateManagerStatus status) @@ -186,7 +186,6 @@ public bool SetRestorePoint(RestorePointInfo info, out StateManagerStatus status return NativeMethods.SRSetRestorePoint(ref info, out status); } } - } /// diff --git a/src/PowerShell/TableInfo.cs b/src/PowerShell/TableInfo.cs index 0451104..42c1afc 100644 --- a/src/PowerShell/TableInfo.cs +++ b/src/PowerShell/TableInfo.cs @@ -20,7 +20,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.Collections.Generic; @@ -34,7 +33,7 @@ public sealed class TableInfo private static readonly IList Empty = new List(0).AsReadOnly(); /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// /// The name of the table. /// The full path to the containing the table. diff --git a/src/PowerShell/TransformView.cs b/src/PowerShell/TransformView.cs index 34df1e5..fd48cec 100644 --- a/src/PowerShell/TransformView.cs +++ b/src/PowerShell/TransformView.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using Microsoft.Deployment.WindowsInstaller; namespace Microsoft.Tools.WindowsInstaller { @@ -97,7 +97,7 @@ protected override string GetKeyForItem(Row item) private readonly IDictionary tables; /// - /// Creates a new instance of the class with information from the specified . + /// Initializes a new instance of the class. /// /// The containing the _TransformView table to process. internal TransformView(Database db) @@ -242,6 +242,7 @@ private void Initialize(Database db, Microsoft.Deployment.WindowsInstaller.Table { row.SetPrincipalOperation(RowOperation.Modify); } + break; } } diff --git a/src/PowerShell/Tree.cs b/src/PowerShell/Tree.cs index 303b77b..199c3db 100644 --- a/src/PowerShell/Tree.cs +++ b/src/PowerShell/Tree.cs @@ -38,7 +38,7 @@ internal sealed class Tree private readonly Node root; /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// /// Optional separators for any key added to the tree. The default is '\'. /// Optional string comparer for any key segment added to the tree. The default is . @@ -133,7 +133,11 @@ internal Node(Tree tree) internal T Value { - get { return this.value; } + get + { + return this.value; + } + set { this.value = value; diff --git a/src/PowerShell/Validate.cs b/src/PowerShell/Validate.cs index 346bf2a..b0284d9 100644 --- a/src/PowerShell/Validate.cs +++ b/src/PowerShell/Validate.cs @@ -20,7 +20,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using System; using System.Text.RegularExpressions; namespace Microsoft.Tools.WindowsInstaller @@ -31,18 +30,19 @@ namespace Microsoft.Tools.WindowsInstaller internal static class Validate { // Define and compile the regular expression to validate GUIDs in a format Windows Installer understands. - private static readonly Regex re = new Regex(@"\{[A-F0-9]{8}-([A-F0-9]{4}-){3}[A-F0-9]{12}\}", + private static readonly Regex Re = new Regex( + @"\{[A-F0-9]{8}-([A-F0-9]{4}-){3}[A-F0-9]{12}\}", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase | RegexOptions.Singleline); /// /// Returns whether or not the input string is a valid GUID. /// - /// The validate. + /// The validate. /// True if the input string is a valid GUID. internal static bool IsGuid(string value) { // Validate simple checks before performing a more exhaustive regex match. - return null != value && 38 == value.Length && re.IsMatch(value); + return null != value && 38 == value.Length && Re.IsMatch(value); } } } diff --git a/src/PowerShell/packages.config b/src/PowerShell/packages.config index a00e2e2..de33cce 100644 --- a/src/PowerShell/packages.config +++ b/src/PowerShell/packages.config @@ -1,4 +1,5 @@  - \ No newline at end of file + + diff --git a/src/Setup/Module.wixproj b/src/Setup/Module.wixproj index cb63d60..ac71f92 100644 --- a/src/Setup/Module.wixproj +++ b/src/Setup/Module.wixproj @@ -9,7 +9,7 @@ package {d2630778-0547-48d1-a8ca-e93d0d7a8b02} true - ICE03;ICE38;ICE64;ICE91 + ICE03;ICE38;ICE40;ICE61;ICE64;ICE91 diff --git a/stylecop.json b/stylecop.json new file mode 100644 index 0000000..dd70bfd --- /dev/null +++ b/stylecop.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "orderingRules": { + "usingDirectivesPlacement": "outsideNamespace" + }, + "documentationRules": { + "companyName": "Microsoft Corporation", + "copyrightText": "The MIT License (MIT)\n\nCopyright (c) Microsoft Corporation\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.", + "xmlHeader": false + } + } +} diff --git a/test/PowerShell.Test/AttributeColumnTests.cs b/test/PowerShell.Test/AttributeColumnTests.cs index 6c047c5..656e40c 100644 --- a/test/PowerShell.Test/AttributeColumnTests.cs +++ b/test/PowerShell.Test/AttributeColumnTests.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Globalization; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/CacheTests.cs b/test/PowerShell.Test/CacheTests.cs index d4dde9e..9a78062 100644 --- a/test/PowerShell.Test/CacheTests.cs +++ b/test/PowerShell.Test/CacheTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/EncodingConverterTests.cs b/test/PowerShell.Test/EncodingConverterTests.cs index d27d456..a939181 100644 --- a/test/PowerShell.Test/EncodingConverterTests.cs +++ b/test/PowerShell.Test/EncodingConverterTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/ExceptionAssert.cs b/test/PowerShell.Test/ExceptionAssert.cs index 992e872..05ebc8a 100644 --- a/test/PowerShell.Test/ExceptionAssert.cs +++ b/test/PowerShell.Test/ExceptionAssert.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Diagnostics.Contracts; using System.Globalization; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/ExtensionMethodsTests.cs b/test/PowerShell.Test/ExtensionMethodsTests.cs index 575e92d..fcafff8 100644 --- a/test/PowerShell.Test/ExtensionMethodsTests.cs +++ b/test/PowerShell.Test/ExtensionMethodsTests.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/IceMessageTests.cs b/test/PowerShell.Test/IceMessageTests.cs index 45e0812..a76b8db 100644 --- a/test/PowerShell.Test/IceMessageTests.cs +++ b/test/PowerShell.Test/IceMessageTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/LogTests.cs b/test/PowerShell.Test/LogTests.cs index ea5551a..be89aae 100644 --- a/test/PowerShell.Test/LogTests.cs +++ b/test/PowerShell.Test/LogTests.cs @@ -20,12 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Win32; using System; using System.Globalization; using System.IO; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Win32; namespace Microsoft.Tools.WindowsInstaller { @@ -39,7 +39,7 @@ public sealed class LogTests : TestBase public void LoggingDefaultPath() { DateTime start = DateTime.Now; - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var log = new Log(null, start); string name = Path.Combine(Path.GetTempPath(), string.Format(CultureInfo.InvariantCulture, "MSI_{0:yyyyMMddhhmmss}", start)); @@ -47,9 +47,11 @@ public void LoggingDefaultPath() string extra = null; string path = log.Next(extra); - Assert.AreEqual(InstallLogModes.Verbose | InstallLogModes.OutOfDiskSpace | InstallLogModes.Info | InstallLogModes.CommonData + Assert.AreEqual( + InstallLogModes.Verbose | InstallLogModes.OutOfDiskSpace | InstallLogModes.Info | InstallLogModes.CommonData | InstallLogModes.Error | InstallLogModes.Warning | InstallLogModes.ActionStart | InstallLogModes.ActionData - | InstallLogModes.FatalExit | InstallLogModes.User | InstallLogModes.PropertyDump, log.Mode, "The default logging mode is incorrect."); + | InstallLogModes.FatalExit | InstallLogModes.User | InstallLogModes.PropertyDump, log.Mode, + "The default logging mode is incorrect."); Assert.AreEqual(name + "_000.log", path, true, "The first default log path is incorrect."); extra = "test"; @@ -63,7 +65,7 @@ public void LoggingDefaultPath() public void LoggingCustomPath() { DateTime start = DateTime.Now; - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var log = new Log(@"C:\test.txt", start); string name = string.Format(CultureInfo.InvariantCulture, @"C:\test_{0:yyyyMMddhhmmss}", start); @@ -71,9 +73,11 @@ public void LoggingCustomPath() string extra = null; string path = log.Next(extra); - Assert.AreEqual(InstallLogModes.Verbose | InstallLogModes.OutOfDiskSpace | InstallLogModes.Info | InstallLogModes.CommonData + Assert.AreEqual( + InstallLogModes.Verbose | InstallLogModes.OutOfDiskSpace | InstallLogModes.Info | InstallLogModes.CommonData | InstallLogModes.Error | InstallLogModes.Warning | InstallLogModes.ActionStart | InstallLogModes.ActionData - | InstallLogModes.FatalExit | InstallLogModes.User | InstallLogModes.PropertyDump | InstallLogModes.ExtraDebug, log.Mode, "The default logging mode is incorrect."); + | InstallLogModes.FatalExit | InstallLogModes.User | InstallLogModes.PropertyDump | InstallLogModes.ExtraDebug, log.Mode, + "The default logging mode is incorrect."); Assert.AreEqual(name + "_000.txt", path, true, "The first custom log path is incorrect."); extra = "test"; @@ -87,7 +91,7 @@ public void LoggingCustomPath() public void LoggingPolicyMode() { DateTime start = DateTime.Now; - using (OverrideRegistry()) + using (this.OverrideRegistry()) { // Set the policy to log extra debug information. using (var key = Registry.LocalMachine.CreateSubKey(@"Software\Policies\Microsoft\Windows\Installer")) @@ -98,9 +102,11 @@ public void LoggingPolicyMode() var log = new Log(null, start); log.Next(null); - Assert.AreEqual(InstallLogModes.Verbose | InstallLogModes.OutOfDiskSpace | InstallLogModes.Info | InstallLogModes.CommonData + Assert.AreEqual( + InstallLogModes.Verbose | InstallLogModes.OutOfDiskSpace | InstallLogModes.Info | InstallLogModes.CommonData | InstallLogModes.Error | InstallLogModes.Warning | InstallLogModes.ActionStart | InstallLogModes.ActionData - | InstallLogModes.FatalExit | InstallLogModes.User | InstallLogModes.PropertyDump | InstallLogModes.ExtraDebug, log.Mode, "The default logging mode is incorrect."); + | InstallLogModes.FatalExit | InstallLogModes.User | InstallLogModes.PropertyDump | InstallLogModes.ExtraDebug, log.Mode, + "The default logging mode is incorrect."); } } } diff --git a/test/PowerShell.Test/LoggingPoliciesConverterTests.cs b/test/PowerShell.Test/LoggingPoliciesConverterTests.cs index a10ca33..21da254 100644 --- a/test/PowerShell.Test/LoggingPoliciesConverterTests.cs +++ b/test/PowerShell.Test/LoggingPoliciesConverterTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/MockRegistry.cs b/test/PowerShell.Test/MockRegistry.cs index 572b992..ebd97e3 100644 --- a/test/PowerShell.Test/MockRegistry.cs +++ b/test/PowerShell.Test/MockRegistry.cs @@ -20,13 +20,13 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Win32; using System; using System.Collections.Generic; using System.ComponentModel; using System.Reflection; using System.Runtime.InteropServices; using System.Xml; +using Microsoft.Win32; namespace Microsoft.Tools.WindowsInstaller { @@ -87,7 +87,7 @@ private SafeHandle GetRegistryHandle(RegistryKey key) } /// - /// Creates a new instance of this class and redirects supported registry hives. + /// Initializes a new instance of the class. /// /// Another instance of this class is already active. internal MockRegistry() @@ -104,29 +104,41 @@ internal MockRegistry() this.baseKeyPath = string.Format(@"Software\{0}\{1:B}", name.Name, Guid.NewGuid()); - this.classesRoot = Registry.CurrentUser.CreateSubKey(baseKeyPath + @"\HKCR"); - this.currentUser = Registry.CurrentUser.CreateSubKey(baseKeyPath + @"\HKCU"); - this.localMachine = Registry.CurrentUser.CreateSubKey(baseKeyPath + @"\HKLM"); - this.users = Registry.CurrentUser.CreateSubKey(baseKeyPath + @"\HKU"); + this.classesRoot = Registry.CurrentUser.CreateSubKey(this.baseKeyPath + @"\HKCR"); + this.currentUser = Registry.CurrentUser.CreateSubKey(this.baseKeyPath + @"\HKCU"); + this.localMachine = Registry.CurrentUser.CreateSubKey(this.baseKeyPath + @"\HKLM"); + this.users = Registry.CurrentUser.CreateSubKey(this.baseKeyPath + @"\HKU"); int ret; SafeHandle handle; - handle = GetRegistryHandle(classesRoot); + handle = this.GetRegistryHandle(this.classesRoot); ret = RegOverridePredefKey(HKEY_CLASSES_ROOT, handle.DangerousGetHandle()); - if (0 != ret) { throw new Win32Exception(ret); } + if (0 != ret) + { + throw new Win32Exception(ret); + } - handle = GetRegistryHandle(currentUser); + handle = this.GetRegistryHandle(this.currentUser); ret = RegOverridePredefKey(HKEY_CURRENT_USER, handle.DangerousGetHandle()); - if (0 != ret) { throw new Win32Exception(ret); } + if (0 != ret) + { + throw new Win32Exception(ret); + } - handle = GetRegistryHandle(localMachine); + handle = this.GetRegistryHandle(this.localMachine); ret = RegOverridePredefKey(HKEY_LOCAL_MACHINE, handle.DangerousGetHandle()); - if (0 != ret) { throw new Win32Exception(ret); } + if (0 != ret) + { + throw new Win32Exception(ret); + } - handle = GetRegistryHandle(users); + handle = this.GetRegistryHandle(this.users); ret = RegOverridePredefKey(HKEY_USERS, handle.DangerousGetHandle()); - if (0 != ret) { throw new Win32Exception(ret); } + if (0 != ret) + { + throw new Win32Exception(ret); + } // Finally increment the count if we got this far. count++; @@ -137,7 +149,7 @@ internal MockRegistry() ~MockRegistry() { - Dispose(false); + this.Dispose(false); } /// @@ -177,10 +189,10 @@ internal void Import(string path, Dictionary properties = null) public void Dispose() { GC.SuppressFinalize(this); - Dispose(true); + this.Dispose(true); } - void Dispose(bool disposing) + private void Dispose(bool disposing) { // Decrement the ref count and dispose if needed. lock (syncRoot) diff --git a/test/PowerShell.Test/PackageInfoTests.cs b/test/PowerShell.Test/PackageInfoTests.cs index f89a1c4..69b1e8b 100644 --- a/test/PowerShell.Test/PackageInfoTests.cs +++ b/test/PowerShell.Test/PackageInfoTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { @@ -43,7 +43,7 @@ public void PackageWeightFromPathTest() [TestMethod] public void PackageWeightFromProductCodeTest() { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var weight = PackageInfo.GetWeightFromProductCode("{877EF582-78AF-4D84-888B-167FDC3BCC11}"); Assert.AreEqual(1419, weight); diff --git a/test/PowerShell.Test/PatchSequencerTests.cs b/test/PowerShell.Test/PatchSequencerTests.cs index 7fee27a..5ca9ed2 100644 --- a/test/PowerShell.Test/PatchSequencerTests.cs +++ b/test/PowerShell.Test/PatchSequencerTests.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/PowerShell.Test.csproj b/test/PowerShell.Test/PowerShell.Test.csproj index b60ca91..ec4f340 100644 --- a/test/PowerShell.Test/PowerShell.Test.csproj +++ b/test/PowerShell.Test/PowerShell.Test.csproj @@ -132,6 +132,16 @@ + + + false + + + + + + + @@ -141,4 +151,4 @@ - \ No newline at end of file + diff --git a/test/PowerShell.Test/PowerShell/AttributeColumnPropertyAdapterTests.cs b/test/PowerShell.Test/PowerShell/AttributeColumnPropertyAdapterTests.cs index 3d4bb04..846babe 100644 --- a/test/PowerShell.Test/PowerShell/AttributeColumnPropertyAdapterTests.cs +++ b/test/PowerShell.Test/PowerShell/AttributeColumnPropertyAdapterTests.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +using System; using Microsoft.Deployment.WindowsInstaller; using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; namespace Microsoft.Tools.WindowsInstaller.PowerShell { diff --git a/test/PowerShell.Test/PowerShell/AttributeColumnTypeConverterTests.cs b/test/PowerShell.Test/PowerShell/AttributeColumnTypeConverterTests.cs index c15b328..8cee70a 100644 --- a/test/PowerShell.Test/PowerShell/AttributeColumnTypeConverterTests.cs +++ b/test/PowerShell.Test/PowerShell/AttributeColumnTypeConverterTests.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Globalization; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell { diff --git a/test/PowerShell.Test/PowerShell/Commands/EditPackageCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/EditPackageCommandTests.cs index 82d1f37..5d451bc 100644 --- a/test/PowerShell.Test/PowerShell/Commands/EditPackageCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/EditPackageCommandTests.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections; using System.IO; using System.Management.Automation; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -38,7 +38,7 @@ public void EditPackageInOrca() { using (var p = CreatePipeline(@"edit-msipackage example.msi -wv Warnings")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var items = p.Invoke(); @@ -58,7 +58,7 @@ public void EditPackageWithVerb() using (var p = CreatePipeline(@"edit-msipackage example.msp -wv Warnings")) { var path = Path.Combine(this.TestContext.DeploymentDirectory, "NoOrca.xml"); - using (OverrideRegistry(path)) + using (this.OverrideRegistry(path)) { p.Invoke(); @@ -79,7 +79,7 @@ public void EditPackageUnavailable() using (var p = CreatePipeline(@"edit-msipackage example.msi -wv Warnings")) { var path = Path.Combine(this.TestContext.DeploymentDirectory, "NoEditVerb.xml"); - using (OverrideRegistry(path)) + using (this.OverrideRegistry(path)) { // Should throw terminating exception. p.Invoke(); @@ -93,7 +93,7 @@ public void EditNonPackage() using (var p = CreatePipeline(@"edit-msipackage example.txt -wv Warnings")) { var path = Path.Combine(this.TestContext.DeploymentDirectory, "NoEditVerb.xml"); - using (OverrideRegistry(path)) + using (this.OverrideRegistry(path)) { var items = p.Invoke(); diff --git a/test/PowerShell.Test/PowerShell/Commands/ExportPatchXmlCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/ExportPatchXmlCommandTests.cs index 9e3e36c..8267033 100644 --- a/test/PowerShell.Test/PowerShell/Commands/ExportPatchXmlCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/ExportPatchXmlCommandTests.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.IO; using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/test/PowerShell.Test/PowerShell/Commands/GetComponentCommandTest.cs b/test/PowerShell.Test/PowerShell/Commands/GetComponentCommandTest.cs index 38f17bb..7af6ec3 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetComponentCommandTest.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetComponentCommandTest.cs @@ -20,16 +20,16 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.ObjectModel; using System.IO; using System.Management.Automation; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { /// /// Unit and functional tests for . - /// + /// [TestClass] public class GetComponentCommandTest : TestBase { @@ -38,7 +38,7 @@ public void EnumerateAllComponents() { using (var p = CreatePipeline(@"get-msicomponentinfo")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); Assert.AreEqual(36, objs.Count); @@ -51,7 +51,7 @@ public void EnumerateClients() { using (var p = CreatePipeline(@"get-msicomponentinfo '{E7F56051-B133-4702-A5C6-D8C192C04D5F}'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -66,7 +66,7 @@ public void EnumerateProductComponents() { using (var p = CreatePipeline(@"get-msicomponentinfo '{E7F56051-B133-4702-A5C6-D8C192C04D5F}', '{CB473DC3-F7BA-4E5B-9721-72CF66BC5262}' '{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); Assert.AreEqual(2, objs.Count); @@ -92,7 +92,7 @@ public void GetComponentChainedExecution() { using (var p = CreatePipeline(@"get-msicomponentinfo '{9D8E88E9-8E05-4FC7-AFC7-87759D1D417E}' | get-msicomponentinfo")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -109,7 +109,7 @@ public void ValidateFileComponentPath() using (var p = CreatePipeline(@"get-msicomponentinfo '{958A3933-8CE7-6189-F0EF-CAE467FABFF4}'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var obj = p.Invoke().FirstOrDefault(); @@ -129,7 +129,7 @@ public void ValidateRegistryComponentPath() using (var p = CreatePipeline(@"get-msicomponentinfo '{E2E70518-347A-4231-9D5D-3857059CCFA7}'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var obj = p.Invoke().FirstOrDefault(); diff --git a/test/PowerShell.Test/PowerShell/Commands/GetComponentStateFunctionTests.cs b/test/PowerShell.Test/PowerShell/Commands/GetComponentStateFunctionTests.cs index b0701c7..85c00a3 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetComponentStateFunctionTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetComponentStateFunctionTests.cs @@ -43,7 +43,7 @@ public void GetProductInstallationComponentState() using (var p = CreatePipeline(@"get-msiproductinfo '{877EF582-78AF-4D84-888B-167FDC3BCC11}' | get-msicomponentstate")) { - using (OverrideRegistry(properties: properties)) + using (this.OverrideRegistry(properties: properties)) { var output = p.Invoke(); Assert.AreEqual(2, output.Count); @@ -69,7 +69,7 @@ public void GetProductCodeComponentState() using (var p = CreatePipeline(@"get-msicomponentstate '{877EF582-78AF-4D84-888B-167FDC3BCC11}'")) { - using (OverrideRegistry(properties: properties)) + using (this.OverrideRegistry(properties: properties)) { var output = p.Invoke(); Assert.AreEqual(2, output.Count); diff --git a/test/PowerShell.Test/PowerShell/Commands/GetFeatureCommandTest.cs b/test/PowerShell.Test/PowerShell/Commands/GetFeatureCommandTest.cs index 217d42e..cf589c7 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetFeatureCommandTest.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetFeatureCommandTest.cs @@ -20,15 +20,15 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.ObjectModel; using System.Management.Automation; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { /// /// Unit and functional tests for . - /// + /// [TestClass] public class GetFeatureCommandTest : TestBase { @@ -52,7 +52,7 @@ public void EnumerateProductFeatures() // Check the number of features for a product object. using (var p = CreatePipeline(@"get-msiproductinfo -context 'all' | get-msifeatureinfo")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -101,7 +101,7 @@ public void EnumerateSpecificFeatures() // Enumerate a single named feature. using (var p = CreatePipeline(@"get-msifeatureinfo '{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}' 'Complete'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -142,7 +142,7 @@ public void GetFeatureChainedExecution() using (var p = CreatePipeline(@"get-msiproductinfo '{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}' | get-msifeatureinfo | get-msifeatureinfo")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); Assert.AreEqual(2, objs.Count); diff --git a/test/PowerShell.Test/PowerShell/Commands/GetFileHashCommandTest.cs b/test/PowerShell.Test/PowerShell/Commands/GetFileHashCommandTest.cs index 199077f..d166a3f 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetFileHashCommandTest.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetFileHashCommandTest.cs @@ -20,16 +20,16 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Management.Automation; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { /// /// Unit and functional tests for . - /// + /// [TestClass] public class GetFileHashCommandTest : TestBase { @@ -112,7 +112,9 @@ public void LiteralPathTest() // Wrapped in a try-catch since the behavior changedin PSv3. objs = p.Invoke(); } - catch { } + catch + { + } Assert.AreEqual(0, objs.Count); } diff --git a/test/PowerShell.Test/PowerShell/Commands/GetFileTypeCommandTest.cs b/test/PowerShell.Test/PowerShell/Commands/GetFileTypeCommandTest.cs index b5f495c..26d327e 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetFileTypeCommandTest.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetFileTypeCommandTest.cs @@ -20,17 +20,17 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.ObjectModel; using System.Globalization; using System.Management.Automation; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { /// /// Unit and functional tests for . - /// + /// [TestClass] public class GetFileTypeCommandTest : TestBase { @@ -113,7 +113,9 @@ public void LiteralPathTest() // Wrapped in a try-catch since the behavior changedin PSv3. objs = p.Invoke(); } - catch { } + catch + { + } Assert.AreEqual(0, objs.Count); } diff --git a/test/PowerShell.Test/PowerShell/Commands/GetPatchCommandTest.cs b/test/PowerShell.Test/PowerShell/Commands/GetPatchCommandTest.cs index c827fac..34ce71d 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetPatchCommandTest.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetPatchCommandTest.cs @@ -20,16 +20,16 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Management.Automation.Runspaces; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { /// /// Unit and functional tests for . - /// + /// [TestClass] public class GetPatchCommandTest : TestBase { @@ -38,7 +38,7 @@ public void EnumeratePatches() { using (var p = CreatePipeline(@"get-msipatchinfo")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -53,7 +53,7 @@ public void EnumerateProductPatches() { using (var p = CreatePipeline(@"get-msiproductinfo -productcode ""{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}"" | get-msipatchinfo")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -68,7 +68,7 @@ public void GetSpecificPatch() { using (var p = CreatePipeline(@"get-msipatchinfo -productcode ""{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}"" -patchcode ""{6E52C409-0D0D-4B84-AB63-463438D4D33B}""")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -83,7 +83,7 @@ public void GetSupersededPatches() { using (var p = CreatePipeline(@"get-msipatchinfo -filter superseded")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -114,7 +114,7 @@ public void InstallContextTest() var cmd = string.Format(@"get-msipatchinfo -context ""machine"""); using (var p = CreatePipeline(cmd)) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -165,7 +165,7 @@ public void GetPatchChainedExecution() { using (Pipeline p = CreatePipeline(@"get-msipatchinfo -productCode '{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}' | get-msipatchinfo")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); diff --git a/test/PowerShell.Test/PowerShell/Commands/GetPatchSequenceCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/GetPatchSequenceCommandTests.cs index 4717a41..2cf2581 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetPatchSequenceCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetPatchSequenceCommandTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -57,7 +57,7 @@ public void SequencePatchesForProduct() // Tests piping to the cmdlet. using (var p = CreatePipeline(@"get-msipatchinfo -product '{877EF582-78AF-4D84-888B-167FDC3BCC11}' | get-msipatchsequence -product '{877EF582-78AF-4D84-888B-167FDC3BCC11}'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var items = p.Invoke(); diff --git a/test/PowerShell.Test/PowerShell/Commands/GetProductCommandTest.cs b/test/PowerShell.Test/PowerShell/Commands/GetProductCommandTest.cs index 165d4ed..0b0448c 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetProductCommandTest.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetProductCommandTest.cs @@ -20,16 +20,16 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { /// /// Unit and functional tests for . - /// + /// [TestClass] public class GetProductCommandTest : TestBase { @@ -43,7 +43,7 @@ public void EnumerateProductsInDefaultContext() using (var p = CreatePipeline(@"get-msiproductinfo")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -67,7 +67,7 @@ public void EnumerateProducts() using (var p = CreatePipeline(@"get-msiproductinfo -context Machine")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -92,7 +92,7 @@ public void EnumerateUserUnmanagedProducts() using (var p = CreatePipeline(string.Format(@"get-msiproductinfo -installcontext userunmanaged -usersid '{0}'", CurrentSID))) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -114,7 +114,7 @@ public void EnumerateNamedProducts() // Use two strings that will match the same product; make sure only one product is returned. using (var p = CreatePipeline(@"get-msiproductinfo -name Silver*, *Light")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); Assert.AreEqual(1, objs.Count); @@ -129,7 +129,7 @@ public void ProductCodeTest() // Finally invoke the cmdlet for a single product. using (var p = CreatePipeline(@"get-msiproductinfo -productcode '{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -169,7 +169,7 @@ public void InstallContextTest() // Test that "Context" is a supported alias. using (var p = CreatePipeline(string.Format(@"get-msiproductinfo -context userunmanaged -usersid '{0}'", CurrentSID))) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -211,7 +211,7 @@ public void GetProductChainedExecution() { using (var p = CreatePipeline(@"get-msiproductinfo '{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}' | get-msiproductinfo")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); diff --git a/test/PowerShell.Test/PowerShell/Commands/GetPropertyCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/GetPropertyCommandTests.cs index 649575b..2f4abe6 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetPropertyCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetPropertyCommandTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Management.Automation; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/test/PowerShell.Test/PowerShell/Commands/GetRelatedProductCommandTest.cs b/test/PowerShell.Test/PowerShell/Commands/GetRelatedProductCommandTest.cs index 87ef66e..1d12488 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetRelatedProductCommandTest.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetRelatedProductCommandTest.cs @@ -20,14 +20,14 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Management.Automation.Runspaces; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { /// /// Unit and functional tests for . - /// + /// [TestClass] public class GetRelatedProductCommandTest : TestBase { @@ -36,7 +36,7 @@ public void EnumerateRelatedProducts() { using (var p = CreatePipeline(@"get-msirelatedproductinfo -upgradecode '{C1482EA4-07D3-4261-9741-7CEDE6A8C25A}'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); @@ -52,7 +52,7 @@ public void GetRelatedProductChainedExecution() { using (Pipeline p = CreatePipeline(@"get-msirelatedproductinfo '{C1482EA4-07D3-4261-9741-7CEDE6A8C25A}' | add-member -name UpgradeCode -type noteproperty -value '{C1482EA4-07D3-4261-9741-7CEDE6A8C25A}' -passthru | get-msirelatedproductinfo")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); diff --git a/test/PowerShell.Test/PowerShell/Commands/GetSharedComponentFunctionTest.cs b/test/PowerShell.Test/PowerShell/Commands/GetSharedComponentFunctionTest.cs index 1b7498d..b6f251c 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetSharedComponentFunctionTest.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetSharedComponentFunctionTest.cs @@ -35,7 +35,7 @@ public void NoParamsTest() { using (var p = CreatePipeline(@"get-msisharedcomponentinfo")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); Assert.AreEqual(5, objs.Count); @@ -48,11 +48,10 @@ public void ComponentParamTest() { using (var p = CreatePipeline(@"get-msisharedcomponentinfo -component '{9D8E88E9-8E05-4FC7-AFC7-87759D1D417E}'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); Assert.AreEqual(2, objs.Count); - } } } @@ -62,7 +61,7 @@ public void CountParamTest() { using (var p = CreatePipeline(@"get-msisharedcomponentinfo -count 3")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var objs = p.Invoke(); Assert.AreEqual(3, objs.Count); diff --git a/test/PowerShell.Test/PowerShell/Commands/GetSourceCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/GetSourceCommandTests.cs index cc99018..1cda229 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetSourceCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetSourceCommandTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -37,7 +37,7 @@ public void GetProductSource() var expected = @"c:\2014be2e43e417a3b9\"; using (var p = CreatePipeline("get-msisource '{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var output = p.Invoke(); @@ -58,7 +58,7 @@ public void GetProductSourceFromPipeline() var expected = @"c:\2014be2e43e417a3b9\"; using (var p = CreatePipeline("get-msiproductinfo '{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}' | get-msisource")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var output = p.Invoke(); @@ -79,7 +79,7 @@ public void GetCorruptProductSource() using (var p = CreatePipeline("get-msisource '{9AC08E99-230B-47e8-9721-4577B7F124EA}'")) { var path = Path.Combine(base.TestContext.DeploymentDirectory, "Corrupt.xml"); - using (OverrideRegistry(path)) + using (this.OverrideRegistry(path)) { var output = p.Invoke(); @@ -97,7 +97,7 @@ public void GetPatchSource() var expected = @"c:\updates\"; using (var p = CreatePipeline("get-msisource '{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}' -patchcode '{6E52C409-0D0D-4B84-AB63-463438D4D33B}'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var output = p.Invoke(); @@ -119,7 +119,7 @@ public void GetPatchSourceFromPipeline() var expected = @"c:\updates\"; using (var p = CreatePipeline("get-msipatchinfo '{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}' -patchcode '{6E52C409-0D0D-4B84-AB63-463438D4D33B}' | get-msisource")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var output = p.Invoke(); diff --git a/test/PowerShell.Test/PowerShell/Commands/GetSummaryInfoCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/GetSummaryInfoCommandTests.cs index 92f3961..710d811 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetSummaryInfoCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetSummaryInfoCommandTests.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.IO; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/test/PowerShell.Test/PowerShell/Commands/GetTableCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/GetTableCommandTests.cs index 4203e6b..fd4fb6a 100644 --- a/test/PowerShell.Test/PowerShell/Commands/GetTableCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/GetTableCommandTests.cs @@ -20,13 +20,13 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections; using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Management.Automation; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -245,7 +245,7 @@ public void QueryInstalledProduct() { using (var p = CreatePipeline(@"get-msiproductinfo '{877EF582-78AF-4D84-888B-167FDC3BCC11}' | get-msitable -table Registry")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var output = p.Invoke(); Assert.IsTrue(null != output && 1 == output.Count, "Output is incorrect."); @@ -266,7 +266,7 @@ public void QueryInstalledProductIgnoreMachineState() { using (var p = CreatePipeline(@"get-msiproductinfo '{877EF582-78AF-4D84-888B-167FDC3BCC11}' | get-msitable -table Registry -ignoremachinestate")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var output = p.Invoke(); Assert.IsTrue(null != output && 1 == output.Count, "Output is incorrect."); @@ -287,7 +287,7 @@ public void QueryAllColumns() { using (var p = CreatePipeline(@"get-msitable example.msi -query 'select * from Property'")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var output = p.Invoke(); Assert.IsTrue(null != output && 0 < output.Count); @@ -359,7 +359,7 @@ public void TableFromAdvertisedProduct() using (var p = CreatePipeline("get-msiproductinfo '{877EF582-78AF-4D84-888B-167FDC3BCC11}' | get-msitable -table Property -wv Warnings")) { var path = Path.Combine(this.TestContext.DeploymentDirectory, "Corrupt.xml"); - using (OverrideRegistry("Corrupt.xml")) + using (this.OverrideRegistry("Corrupt.xml")) { p.Invoke(); @@ -379,7 +379,7 @@ public void TableFromCorruptProduct() using (var p = CreatePipeline("get-msiproductinfo '{9AC08E99-230B-47e8-9721-4577B7F124EA}' | get-msitable -table Property -wv Warnings")) { var path = Path.Combine(this.TestContext.DeploymentDirectory, "Corrupt.xml"); - using (OverrideRegistry("Corrupt.xml")) + using (this.OverrideRegistry("Corrupt.xml")) { p.Invoke(); diff --git a/test/PowerShell.Test/PowerShell/Commands/InstallCommandActionDataTests.cs b/test/PowerShell.Test/PowerShell/Commands/InstallCommandActionDataTests.cs index d7fecae..e191d3b 100644 --- a/test/PowerShell.Test/PowerShell/Commands/InstallCommandActionDataTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/InstallCommandActionDataTests.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.IO; using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/test/PowerShell.Test/PowerShell/Commands/InstallCommandBaseTests.cs b/test/PowerShell.Test/PowerShell/Commands/InstallCommandBaseTests.cs index d0ffd01..8054bd9 100644 --- a/test/PowerShell.Test/PowerShell/Commands/InstallCommandBaseTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/InstallCommandBaseTests.cs @@ -20,11 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Management.Automation; using System.Management.Automation.Runspaces; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.VisualStudio.TestTools.UnitTesting; using PS = System.Management.Automation.PowerShell; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands @@ -167,6 +167,7 @@ public void ExecuteSimulatedProgress() Assert.AreEqual("Generating script...", progress.StatusDescription, "The phase 2 step {0:d} status description is incorrect.", i); } } + Assert.AreEqual(0, ps.Streams.Progress[1].PercentComplete, "The phase 2 step 1 % complete is incorrect."); Assert.AreEqual(7, ps.Streams.Progress[2].PercentComplete, "The phase 2 step 2 % complete is incorrect."); Assert.AreEqual(5, ps.Streams.Progress[3].PercentComplete, "the phase 2 step 3 % complete is incorrect."); diff --git a/test/PowerShell.Test/PowerShell/Commands/InstallProductActionDataTests.cs b/test/PowerShell.Test/PowerShell/Commands/InstallProductActionDataTests.cs index 6abe528..005829c 100644 --- a/test/PowerShell.Test/PowerShell/Commands/InstallProductActionDataTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/InstallProductActionDataTests.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +using System.Linq; using Microsoft.Deployment.WindowsInstaller; using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Linq; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/test/PowerShell.Test/PowerShell/Commands/InstallScenarioTests.cs b/test/PowerShell.Test/PowerShell/Commands/InstallScenarioTests.cs index 717477b..3e63ce7 100644 --- a/test/PowerShell.Test/PowerShell/Commands/InstallScenarioTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/InstallScenarioTests.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.IO; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs index 2964ad6..17b3dbb 100644 --- a/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/MeasureProductCommandTests.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/test/PowerShell.Test/PowerShell/Commands/RemoveLoggingPolicyCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/RemoveLoggingPolicyCommandTests.cs index 308b7b9..09cd411 100644 --- a/test/PowerShell.Test/PowerShell/Commands/RemoveLoggingPolicyCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/RemoveLoggingPolicyCommandTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Management.Automation; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/test/PowerShell.Test/PowerShell/Commands/SetLoggingPolicyCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/SetLoggingPolicyCommandTests.cs index e8ca03f..46b0cb1 100644 --- a/test/PowerShell.Test/PowerShell/Commands/SetLoggingPolicyCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/SetLoggingPolicyCommandTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { diff --git a/test/PowerShell.Test/PowerShell/Commands/SourceCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/SourceCommandTests.cs index 17f5576..981763a 100644 --- a/test/PowerShell.Test/PowerShell/Commands/SourceCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/SourceCommandTests.cs @@ -20,10 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.IO; using System.Management.Automation; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -41,27 +43,7 @@ public class SourceCommandTests : TestBase [TestMethod] public void ModifyProductSource() { - PSObject obj = null; - - // First attempt to see if there are any unmanaged products installed. - using (var p = CreatePipeline("get-msiproductinfo -context userunmanaged")) - { - var output = p.Invoke(); - if (null != output && 0 < output.Count()) - { - obj = output[0]; - } - else - { - Assert.Inconclusive("There are no unmanaged products installed with which to test source list modifications."); - } - } - - // Retain the original source locations so we can attempt to restore it. - var product = obj.As(); - var original = product.SourceList.ToArray(); - - try + this.TestProductSources((obj, product, original) => { using (var p = CreatePipeline(string.Format(@"$Input | add-msisource -path '{0}' -passthru", this.TestContext.DeploymentDirectory))) { @@ -69,7 +51,7 @@ public void ModifyProductSource() var output = p.Invoke(); Assert.IsNotNull(output); - Assert.AreEqual(original.Length + 1, output.Count()); + Assert.AreEqual(original.Count + 1, output.Count()); } using (var p = CreatePipeline(@"$Input | add-msisource -path 'ShouldNotExist.txt' -passthru")) @@ -89,8 +71,8 @@ public void ModifyProductSource() // Should return the previous number of source locations we already registered. Assert.IsNotNull(output); - Assert.AreEqual(original.Length + 1, output.Count()); - Assert.AreEqual(1, p.Error.Count); + Assert.AreEqual(original.Count + 1, output.Count()); + Assert.AreEqual(1, p.Error.Count); } using (var p = CreatePipeline(@"$Input | clear-msisource; $Input | get-msisource")) @@ -101,17 +83,17 @@ public void ModifyProductSource() Assert.IsTrue(null == output || 0 == output.Count()); } - var paths = new string[original.Length + 1]; + var paths = new string[original.Count + 1]; paths[0] = this.TestContext.DeploymentDirectory; original.CopyTo(paths, 1); - using (var p = CreatePipeline(string.Format(@"$Input | add-msisource '{0}' -passthru", product.ProductCode))) + using (var p = CreatePipeline(string.Format(@"$Input | add-msisource '{0}' -force -passthru", product.ProductCode))) { p.Input.Write(paths, true); var output = p.Invoke(); Assert.IsNotNull(output); - Assert.AreEqual(paths.Length, output.Count()); + Assert.AreEqual(paths.Length, output.Count()); } using (var p = CreatePipeline(string.Format(@"$Input | remove-msisource -path '{0}' -passthru", this.TestContext.DeploymentDirectory))) @@ -120,8 +102,110 @@ public void ModifyProductSource() var output = p.Invoke(); Assert.IsNotNull(output); - Assert.AreEqual(original.Length, output.Count()); + Assert.AreEqual(original.Count, output.Count()); + } + }); + } + + [TestMethod] + public void AddSourceTestsPath() + { + this.TestProductSources((obj, product, original) => + { + using (var p = CreatePipeline(@"$Input | add-msisource -path 'C:\ShouldNotExist\AddSourceTestsPath' -passthru")) + { + p.Input.Write(obj); + + try + { + p.Invoke(); + Assert.Fail("Expected CmdletInvocationException exception"); + } + catch (CmdletInvocationException) + { + return; + } + catch (Exception ex) + { + Assert.Fail("Expected CmdletInvocationException exception; caught {0} exception", ex.GetType().Name); + } + } + }); + } + + [TestMethod] + public void AddSourceForceNoTestsPath() + { + this.TestProductSources((obj, product, original) => + { + using (var p = CreatePipeline(@"$Input | add-msisource -path 'C:\ShouldNotExist\AddSourceForceNoTestsPath' -force -passthru")) + { + p.Input.Write(obj); + var output = p.Invoke(); + + Assert.IsFalse(p.HadErrors); + Assert.IsNotNull(output); + Assert.AreEqual(original.Count + 1, output.Count()); } + }); + } + + [TestMethod] + public void RemoveSourceNoTestsPath() + { + this.TestProductSources((obj, product, original) => + { + using (var p = CreatePipeline(@"$Input | remove-msisource -path 'C:\ShouldNotExist\RemoveSourceNoTestsPath' -passthru")) + { + p.Input.Write(obj); + var output = p.Invoke(); + + Assert.IsFalse(p.HadErrors); + Assert.IsNotNull(output); + Assert.AreEqual(original.Count, output.Count()); + } + }); + } + + private PSObject FindTestProduct() + { + using (var p = CreatePipeline("get-msiproductinfo -context userunmanaged")) + { + var output = p.Invoke(); + if (null != output && 0 < output.Count()) + { + return output[0]; + } + } + + return null; + } + + private void TestProductSources(Action> action) + { + PSObject obj = null; + + // First attempt to see if there are any unmanaged products installed. + using (var p = CreatePipeline("get-msiproductinfo -context userunmanaged")) + { + var output = p.Invoke(); + if (null != output && 0 < output.Count()) + { + obj = output[0]; + } + else + { + Assert.Inconclusive("There are no unmanaged products installed with which to test source list modifications."); + } + } + + // Retain the original source locations so we can attempt to restore it. + var product = obj.As(); + var original = product.SourceList.ToArray(); + + try + { + action(obj, product, original); } finally { diff --git a/test/PowerShell.Test/PowerShell/Commands/TestProductCommandTests.cs b/test/PowerShell.Test/PowerShell/Commands/TestProductCommandTests.cs index cca1b7e..87dd92e 100644 --- a/test/PowerShell.Test/PowerShell/Commands/TestProductCommandTests.cs +++ b/test/PowerShell.Test/PowerShell/Commands/TestProductCommandTests.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell.Commands { @@ -38,7 +38,7 @@ public void TestProductDefaultIceCube() var package = Path.Combine(this.TestContext.DeploymentDirectory, "Example.msi"); using (var p = CreatePipeline(@"get-item Example.msi | test-msiproduct -include ICE0* -exclude ICE03 -patch Example.msp -transform Example.mst -v")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var items = p.Invoke(); foreach (var item in items) @@ -62,7 +62,7 @@ public void TestProductCustomIceCube() using (var p = CreatePipeline(@"test-msiproduct Example.msi -nodefault -add test.cub")) { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { var items = p.Invoke(); foreach (var item in items) diff --git a/test/PowerShell.Test/PowerShell/ExtensionMethodsTests.cs b/test/PowerShell.Test/PowerShell/ExtensionMethodsTests.cs index 9f27cb5..346a395 100644 --- a/test/PowerShell.Test/PowerShell/ExtensionMethodsTests.cs +++ b/test/PowerShell.Test/PowerShell/ExtensionMethodsTests.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Management.Automation; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell { diff --git a/test/PowerShell.Test/PowerShell/FileInfoTests.cs b/test/PowerShell.Test/PowerShell/FileInfoTests.cs index a8e8a52..798cfbd 100644 --- a/test/PowerShell.Test/PowerShell/FileInfoTests.cs +++ b/test/PowerShell.Test/PowerShell/FileInfoTests.cs @@ -20,11 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Tools.WindowsInstaller.Properties; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections; using System.IO; using System.Management.Automation; +using Microsoft.Tools.WindowsInstaller.Properties; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell { diff --git a/test/PowerShell.Test/PowerShell/ModuleTest.cs b/test/PowerShell.Test/PowerShell/ModuleTest.cs index 75df199..6e14455 100644 --- a/test/PowerShell.Test/PowerShell/ModuleTest.cs +++ b/test/PowerShell.Test/PowerShell/ModuleTest.cs @@ -34,7 +34,7 @@ public sealed class ModuleTest : TestBase [TestMethod] public void UseTest() { - using (OverrideRegistry()) + using (this.OverrideRegistry()) { // Set initial usage data. Module.Use(); diff --git a/test/PowerShell.Test/PowerShell/PSInstallerExceptionTests.cs b/test/PowerShell.Test/PowerShell/PSInstallerExceptionTests.cs index 56f2de1..30cc692 100644 --- a/test/PowerShell.Test/PowerShell/PSInstallerExceptionTests.cs +++ b/test/PowerShell.Test/PowerShell/PSInstallerExceptionTests.cs @@ -20,12 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.IO; using System.Management.Automation; using System.Reflection; using System.Runtime.Serialization.Formatters.Binary; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell { @@ -82,7 +82,7 @@ public void CreateFromInstallerExceptionForRecord() using (var psiex = new PSInstallerException(iex)) { - var error= psiex.ErrorRecord; + var error = psiex.ErrorRecord; Assert.IsNotNull(error); Assert.AreEqual("Installed TEST", psiex.Message, true); diff --git a/test/PowerShell.Test/PowerShell/RecordPropertyAdapterTests.cs b/test/PowerShell.Test/PowerShell/RecordPropertyAdapterTests.cs index a50f8fa..39c3af2 100644 --- a/test/PowerShell.Test/PowerShell/RecordPropertyAdapterTests.cs +++ b/test/PowerShell.Test/PowerShell/RecordPropertyAdapterTests.cs @@ -20,10 +20,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Deployment.WindowsInstaller; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.IO; +using Microsoft.Deployment.WindowsInstaller; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell { diff --git a/test/PowerShell.Test/PowerShell/ValidateGuidAttributeTest.cs b/test/PowerShell.Test/PowerShell/ValidateGuidAttributeTest.cs index 96a273f..fe30021 100644 --- a/test/PowerShell.Test/PowerShell/ValidateGuidAttributeTest.cs +++ b/test/PowerShell.Test/PowerShell/ValidateGuidAttributeTest.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Management.Automation; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller.PowerShell { diff --git a/test/PowerShell.Test/RegistryViewTests.cs b/test/PowerShell.Test/RegistryViewTests.cs index fcad3c9..ea11a51 100644 --- a/test/PowerShell.Test/RegistryViewTests.cs +++ b/test/PowerShell.Test/RegistryViewTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/RegistryXml.cs b/test/PowerShell.Test/RegistryXml.cs index 9c10891..1ad86ad 100644 --- a/test/PowerShell.Test/RegistryXml.cs +++ b/test/PowerShell.Test/RegistryXml.cs @@ -20,12 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.Win32; using System; using System.Collections.Generic; using System.Diagnostics; using System.Text.RegularExpressions; using System.Xml; +using Microsoft.Win32; namespace Microsoft.Tools.WindowsInstaller { @@ -34,24 +34,26 @@ namespace Microsoft.Tools.WindowsInstaller /// internal sealed class RegistryXml { - private static readonly Regex Variables = new Regex(@"\$\((?\w+)\)", + private static readonly Regex Variables = new Regex( + @"\$\((?\w+)\)", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture | RegexOptions.Singleline); private RegistryKey key; private Stack keys; /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// /// /// Without specifying a root key, imported files must all begin with hives. /// - internal RegistryXml() : this(null) + internal RegistryXml() + : this(null) { } /// - /// Creates a new instance of the class. + /// Initializes a new instance of the class. /// /// The to import or export. /// @@ -71,7 +73,7 @@ internal RegistryXml(RegistryKey key) } /// - /// Gets the propety dictionary. + /// Gets the property dictionary. /// internal Dictionary Properties { get; private set; } @@ -80,10 +82,10 @@ internal RegistryXml(RegistryKey key) /// /// The that contains the keys and values to import. /// A hive name was specified that is not supported, or a value type was not supported. - /// A general XML exception occured. + /// A general XML exception occurred. internal void Import(XmlReader reader) { - Debug.Assert(null != reader); + Debug.Assert(null != reader, @"The argument ""reader"" is null."); while (reader.Read()) { @@ -99,44 +101,48 @@ internal void Import(XmlReader reader) { case "hive": // If empty, do nothing (no keys to create). - if (reader.IsEmptyElement) { break; } + if (reader.IsEmptyElement) + { + break; + } // Add the specified hive to the stack. switch (name) { case "HKEY_CLASSES_ROOT": - keys.Push(Registry.ClassesRoot); + this.keys.Push(Registry.ClassesRoot); break; case "HKEY_CURRENT_USER": - keys.Push(Registry.CurrentUser); + this.keys.Push(Registry.CurrentUser); break; case "HKEY_LOCAL_MACHINE": - keys.Push(Registry.LocalMachine); + this.keys.Push(Registry.LocalMachine); break; case "HKEY_USERS": - keys.Push(Registry.Users); + this.keys.Push(Registry.Users); break; default: throw new NotSupportedException(string.Format(@"Hive ""{0}"" is not supported.", name)); } + break; case "key": // Create a new key as a subkey of the key currently at the top of the stack. try { - key = keys.Peek(); + key = this.keys.Peek(); } catch (InvalidOperationException ex) { throw new NotSupportedException(string.Format(@"The key ""{0}"" requires that a root key was specified in the constructor.", name), ex); } - name = ReplaceVariables(name); + name = this.ReplaceVariables(name); RegistryKey subkey = key.CreateSubKey(name); if (reader.IsEmptyElement) { @@ -146,8 +152,9 @@ internal void Import(XmlReader reader) else { // If children exist, push this key into the key stack. - keys.Push(subkey); + this.keys.Push(subkey); } + break; case "value": @@ -157,7 +164,7 @@ internal void Import(XmlReader reader) RegistryValueKind kind = (RegistryValueKind)Enum.Parse(typeof(RegistryValueKind), type); // Replace variables first. - value = ReplaceVariables(reader.ReadString()); + value = this.ReplaceVariables(reader.ReadString()); switch (kind) { @@ -174,6 +181,7 @@ internal void Import(XmlReader reader) { value = Convert.ToInt32((string)value); } + break; case RegistryValueKind.ExpandString: @@ -193,17 +201,19 @@ internal void Import(XmlReader reader) { value = Convert.ToInt64((string)value); } + break; default: throw new NotSupportedException(string.Format(@"The registry type ""{0}"" is not supported.", type)); } - key = keys.Peek(); + key = this.keys.Peek(); key.SetValue(name, value, kind); break; } } + break; case XmlNodeType.EndElement: @@ -213,11 +223,12 @@ internal void Import(XmlReader reader) case "hive": case "key": // Pop the last key from the stack and close it. - RegistryKey key = keys.Pop(); + RegistryKey key = this.keys.Pop(); key.Close(); break; } } + break; } } @@ -231,7 +242,7 @@ private string ReplaceVariables(string value) return string.Empty; } - string replacement = Variables.Replace(value, delegate(Match m) + string replacement = Variables.Replace(value, m => { string var = m.Groups["var"].Value; if (this.Properties.ContainsKey(var)) diff --git a/test/PowerShell.Test/ReinstallModesConverterTests.cs b/test/PowerShell.Test/ReinstallModesConverterTests.cs index e247fdd..d0ed2d3 100644 --- a/test/PowerShell.Test/ReinstallModesConverterTests.cs +++ b/test/PowerShell.Test/ReinstallModesConverterTests.cs @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +using System; using Microsoft.Deployment.WindowsInstaller; using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/SetTests.cs b/test/PowerShell.Test/SetTests.cs index f7145b8..8a5d1fb 100644 --- a/test/PowerShell.Test/SetTests.cs +++ b/test/PowerShell.Test/SetTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/SubstituteDrive.cs b/test/PowerShell.Test/SubstituteDrive.cs index 105c09f..9678e88 100644 --- a/test/PowerShell.Test/SubstituteDrive.cs +++ b/test/PowerShell.Test/SubstituteDrive.cs @@ -59,7 +59,7 @@ private static extern int QueryDosDevice( ); /// - /// Creates a new drive substitution. + /// Initializes a new instance of the class. /// /// The drive letter to use for the substitution. /// The path to the folder to map to a drive letter. @@ -70,7 +70,7 @@ internal SubstituteDrive(char driveLetter, string targetPath) Contract.Requires('C' <= driveLetter && 'Z' >= driveLetter); Contract.Requires(!string.IsNullOrEmpty(targetPath)); - driveLetter = Char.ToUpperInvariant(driveLetter); + driveLetter = char.ToUpperInvariant(driveLetter); if (SubstituteDrive.IsDefined(driveLetter)) { throw new ArgumentException("The drive letter is already defined.", "driveLetter"); diff --git a/test/PowerShell.Test/SummaryInfoTests.cs b/test/PowerShell.Test/SummaryInfoTests.cs index 99aee52..b3d3ece 100644 --- a/test/PowerShell.Test/SummaryInfoTests.cs +++ b/test/PowerShell.Test/SummaryInfoTests.cs @@ -20,11 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.IO; using System.Linq; using System.Reflection; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/SystemRestorePointTests.cs b/test/PowerShell.Test/SystemRestorePointTests.cs index 56e6ccd..e1c5a78 100644 --- a/test/PowerShell.Test/SystemRestorePointTests.cs +++ b/test/PowerShell.Test/SystemRestorePointTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.ComponentModel; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/SystemRestoreTestService.cs b/test/PowerShell.Test/SystemRestoreTestService.cs index 7e268c4..c5dadee 100644 --- a/test/PowerShell.Test/SystemRestoreTestService.cs +++ b/test/PowerShell.Test/SystemRestoreTestService.cs @@ -30,7 +30,7 @@ internal class SystemRestoreTestService : ISystemRestoreService private int nextErrorCode = 0; /// - /// Creates a new instance of the test provider. + /// Initializes a new instance of the class. /// /// The sequence number to return to the caller. The default is 1. internal SystemRestoreTestService(long sequenceNumber = 1) diff --git a/test/PowerShell.Test/TestBase.cs b/test/PowerShell.Test/TestBase.cs index b501e87..a8b8433 100644 --- a/test/PowerShell.Test/TestBase.cs +++ b/test/PowerShell.Test/TestBase.cs @@ -20,12 +20,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.IO; using System.Management.Automation; using System.Management.Automation.Runspaces; using System.Security.Principal; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { @@ -43,6 +43,7 @@ namespace Microsoft.Tools.WindowsInstaller public abstract class TestBase { #region Runspace Configuration + /// /// Gets the to use for all derived tests. /// @@ -51,6 +52,7 @@ public abstract class TestBase /// /// Initializes the test assembly and loads the PowerShell module. /// + /// Context for tests within this assembly. [AssemblyInitialize] public static void AssemblyInitialize(TestContext context) { @@ -78,16 +80,6 @@ public static void AssemblyInitialize(TestContext context) TestBase.TestRunspace.Open(); } - /// - /// Initializes state before each test is run. - /// - [TestInitialize] - public void TestInitialize() - { - // Always make sure the DefaultRunspace is set before each test. - Runspace.DefaultRunspace = TestRunspace; - } - /// /// Cleans up the test configuration. /// @@ -102,9 +94,20 @@ public static void AssemblyCleanup() } } } + + /// + /// Initializes state before each test is run. + /// + [TestInitialize] + public void TestInitialize() + { + // Always make sure the DefaultRunspace is set before each test. + Runspace.DefaultRunspace = TestRunspace; + } #endregion #region System Information + /// /// Gets the SID in SDDL form for the current user. /// @@ -120,7 +123,6 @@ protected static string CurrentSID } } - /// /// Gets the username for the current user. /// @@ -155,6 +157,7 @@ protected Dictionary DefaultRegistryProperties #endregion #region Test Execution + /// /// Gets or sets the for all derived tests. /// diff --git a/test/PowerShell.Test/TransformViewTests.cs b/test/PowerShell.Test/TransformViewTests.cs index 409f22a..9097244 100644 --- a/test/PowerShell.Test/TransformViewTests.cs +++ b/test/PowerShell.Test/TransformViewTests.cs @@ -21,10 +21,10 @@ // SOFTWARE. using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Deployment.WindowsInstaller; using System.IO; +using Microsoft.Deployment.WindowsInstaller; using Microsoft.Deployment.WindowsInstaller.Package; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/TreeTests.cs b/test/PowerShell.Test/TreeTests.cs index d466d38..0802239 100644 --- a/test/PowerShell.Test/TreeTests.cs +++ b/test/PowerShell.Test/TreeTests.cs @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Tools.WindowsInstaller { diff --git a/test/PowerShell.Test/packages.config b/test/PowerShell.Test/packages.config index 726d4a1..1883e30 100644 --- a/test/PowerShell.Test/packages.config +++ b/test/PowerShell.Test/packages.config @@ -1,4 +1,5 @@  - \ No newline at end of file + +