Code cleanup: Add space after closing brace where needed (#8530)
* Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
This commit is contained in:
parent
40223881cb
commit
4af3068566
|
@ -29,6 +29,7 @@ namespace Application.Test
|
|||
Console.WriteLine(result.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace Application.Test
|
|||
var results = ps.AddScript("Get-Command Write-Output").Invoke();
|
||||
Console.WriteLine(results[0].ToString());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace Application.Test
|
|||
Console.WriteLine(result.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace Application.Test
|
|||
Console.WriteLine(result.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
// unblock the thread waiting for response
|
||||
(actionArgs.Action as CimSyncAction).OnComplete();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -164,6 +165,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
DebugHelper.WriteLogEx("Either disposed or all operations completed.", 2);
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.moreActionEvent.Wait();
|
||||
|
@ -177,6 +179,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ProcessActions(cmdletOperation);
|
||||
}
|
||||
|
||||
|
@ -209,6 +212,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.cimSessionProxyCache = new List<CimSessionProxy>();
|
||||
}
|
||||
|
||||
if (!this.cimSessionProxyCache.Contains(sessionproxy))
|
||||
{
|
||||
this.cimSessionProxyCache.Add(sessionproxy);
|
||||
|
@ -366,6 +370,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
arraybaseObject[i] = GetBaseObject(arrayObject[i]);
|
||||
}
|
||||
|
||||
return arraybaseObject;
|
||||
}
|
||||
}
|
||||
|
@ -390,6 +395,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
referenceType = CimType.Reference;
|
||||
return cimInstance;
|
||||
}
|
||||
|
@ -404,6 +410,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
CimInstance[] cimInstanceArray = new CimInstance[cimReferenceArray.Length];
|
||||
for (int i = 0; i < cimReferenceArray.Length; i++)
|
||||
{
|
||||
|
@ -412,6 +419,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
object baseObject = GetBaseObject(tempCimReference.Value);
|
||||
cimInstanceArray[i] = baseObject as CimInstance;
|
||||
if (cimInstanceArray[i] == null)
|
||||
|
@ -419,6 +427,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
referenceType = CimType.ReferenceArray;
|
||||
return cimInstanceArray;
|
||||
}
|
||||
|
@ -439,6 +448,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return (Interlocked.Read(ref this._disposed) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
private long _disposed;
|
||||
|
||||
/// <summary>
|
||||
|
@ -506,6 +516,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
(action as CimSyncAction).OnComplete();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.cimSessionProxyCache != null)
|
||||
{
|
||||
List<CimSessionProxy> temporaryProxy;
|
||||
|
@ -527,6 +538,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.ackedEvent.Dispose();
|
||||
}
|
||||
|
||||
DebugHelper.WriteLog("Cleanup complete.", 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,11 +50,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return this.context;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.context = value;
|
||||
}
|
||||
}
|
||||
|
||||
private XOperationContextBase context;
|
||||
}//End Class
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
invoker.AddScript(string.Format(CultureInfo.CurrentUICulture, "Set-Alias -Name {0} -Value {1} -Option {2} -ErrorAction SilentlyContinue", alias.Name, alias.Value, alias.Options));
|
||||
DebugHelper.WriteLog(@"Add commands {0} of {1} with option {2} to current runspace.", 1, alias.Name, alias.Value, alias.Options);
|
||||
}
|
||||
|
||||
System.Collections.ObjectModel.Collection<PSObject> psObjects = invoker.Invoke();
|
||||
DebugHelper.WriteLog(@"Invoke results {0}.", 1, psObjects.Count);
|
||||
}
|
||||
|
@ -77,18 +78,21 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// The string defining the name of this alias
|
||||
/// </summary>
|
||||
internal string Name { get { return this._name; } }
|
||||
|
||||
private string _name;
|
||||
|
||||
/// <summary>
|
||||
/// The string defining real cmdlet name
|
||||
/// </summary>
|
||||
internal string Value { get { return this._value; } }
|
||||
|
||||
private string _value = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The string defining real cmdlet name
|
||||
/// </summary>
|
||||
internal ScopedItemOptions Options { get { return this._options; } }
|
||||
|
||||
private ScopedItemOptions _options = ScopedItemOptions.AllScope | ScopedItemOptions.ReadOnly;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.parameterSetName;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly string parameterSetName = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -57,6 +58,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.mandatory;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly bool mandatory = false;
|
||||
}
|
||||
|
||||
|
@ -120,6 +122,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.isDefaultParameterSet;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly bool isDefaultParameterSet = false;
|
||||
|
||||
/// <summary>
|
||||
|
@ -132,6 +135,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.mandatoryParameterCount;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly UInt32 mandatoryParameterCount = 0;
|
||||
|
||||
/// <summary>
|
||||
|
@ -143,11 +147,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return this.isValueSet;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.isValueSet = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isValueSet = false;
|
||||
|
||||
/// <summary>
|
||||
|
@ -159,11 +165,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return this.isValueSetAtBeginProcess;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.isValueSetAtBeginProcess = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isValueSetAtBeginProcess = false;
|
||||
|
||||
/// <summary>
|
||||
|
@ -175,11 +183,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return this.setMandatoryParameterCount;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.setMandatoryParameterCount = value;
|
||||
}
|
||||
}
|
||||
|
||||
private UInt32 setMandatoryParameterCount = 0;
|
||||
|
||||
/// <summary>
|
||||
|
@ -191,11 +201,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return this.setMandatoryParameterCountAtBeginProcess;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.setMandatoryParameterCountAtBeginProcess = value;
|
||||
}
|
||||
}
|
||||
|
||||
private UInt32 setMandatoryParameterCountAtBeginProcess = 0;
|
||||
}
|
||||
|
||||
|
@ -334,8 +346,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
psEntry.SetMandatoryParameterCountAtBeginProcess++;
|
||||
}
|
||||
|
||||
DebugHelper.WriteLogEx("parameterset name = '{0}'; SetMandatoryParameterCount = '{1}'", 1, parameterDefinitionEntry.ParameterSetName, psEntry.SetMandatoryParameterCount);
|
||||
}
|
||||
|
||||
if (!psEntry.IsValueSet)
|
||||
{
|
||||
psEntry.IsValueSet = true;
|
||||
|
@ -344,8 +358,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
psEntry.IsValueSetAtBeginProcess = true;
|
||||
}
|
||||
}
|
||||
|
||||
nameset.Add(parameterDefinitionEntry.ParameterSetName);
|
||||
}
|
||||
|
||||
this.parametersetNamesList = nameset;
|
||||
if (isBeginProcess)
|
||||
{
|
||||
|
@ -368,6 +384,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
psEntry.SetMandatoryParameterCountAtBeginProcess++;
|
||||
}
|
||||
|
||||
DebugHelper.WriteLogEx("parameterset name = '{0}'; SetMandatoryParameterCount = '{1}'",
|
||||
1,
|
||||
entry.ParameterSetName,
|
||||
|
@ -375,6 +392,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nameset.Count == 0)
|
||||
{
|
||||
throw new PSArgumentException(Strings.UnableToResolveParameterSetName);
|
||||
|
@ -420,12 +438,15 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
defaultParameterSetName = parameterSetName;
|
||||
}
|
||||
|
||||
if (entry.IsValueSet)
|
||||
{
|
||||
noMandatoryParameterSet.Add(parameterSetName);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((entry.SetMandatoryParameterCount == entry.MandatoryParameterCount) &&
|
||||
this.parametersetNamesList.Contains(parameterSetName))
|
||||
{
|
||||
|
@ -433,6 +454,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
throw new PSArgumentException(Strings.UnableToResolveParameterSetName);
|
||||
}
|
||||
|
||||
boundParameterSetName = parameterSetName;
|
||||
}
|
||||
}
|
||||
|
@ -462,6 +484,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
throw new PSArgumentException(Strings.UnableToResolveParameterSetName);
|
||||
}
|
||||
|
||||
return boundParameterSetName;
|
||||
}
|
||||
|
||||
|
@ -516,6 +539,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
this.parameterBinder.reset();
|
||||
}
|
||||
}
|
||||
|
||||
DebugHelper.WriteLog("current parameterset is: " + this.parameterSetName, 4);
|
||||
}
|
||||
|
||||
|
@ -533,6 +557,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.parameterBinder != null)
|
||||
{
|
||||
this.parameterBinder.SetParameter(parameterName, this.AtBeginProcess);
|
||||
|
@ -684,6 +709,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return this.atBeginProcess;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.atBeginProcess = value;
|
||||
|
@ -709,6 +735,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
this.operation = value;
|
||||
}
|
||||
}
|
||||
|
||||
get
|
||||
{
|
||||
return this.operation;
|
||||
|
@ -924,8 +951,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
propList.Append(",");
|
||||
}
|
||||
|
||||
propList.Append(property);
|
||||
}
|
||||
|
||||
string message = String.Format(CultureInfo.CurrentUICulture, Strings.CouldNotFindPropertyFromGivenClass,
|
||||
className, propList);
|
||||
PSArgumentOutOfRangeException exception = new PSArgumentOutOfRangeException(
|
||||
|
@ -975,8 +1004,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
ThrowInvalidAuthenticationTypeError(operationName, parameterName, passwordAuthentication);
|
||||
return null;
|
||||
}
|
||||
|
||||
credentials = new CimCredential(impersonatedAuthentication);
|
||||
}
|
||||
|
||||
DebugHelper.WriteLogEx("return credential {0}", 1, credentials);
|
||||
return credentials;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
// try to use namespace of ciminstance, then fall back to default namespace
|
||||
nameSpace = ConstValue.GetNamespace(cmdlet.CimInstance.CimSystemProperties.Namespace);
|
||||
}
|
||||
|
||||
List<CimSessionProxy> proxys = new List<CimSessionProxy>();
|
||||
switch (cmdlet.ParameterSetName)
|
||||
{
|
||||
|
@ -53,6 +54,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
CimSessionProxy proxy = CreateSessionProxy(computerName, cmdlet.CimInstance, cmdlet);
|
||||
proxys.Add(proxy);
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.SessionSetName:
|
||||
foreach (CimSession session in cmdlet.CimSession)
|
||||
|
@ -60,10 +62,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
CimSessionProxy proxy = CreateSessionProxy(session, cmdlet);
|
||||
proxys.Add(proxy);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (CimSessionProxy proxy in proxys)
|
||||
{
|
||||
proxy.EnumerateAssociatedInstancesAsync(
|
||||
|
|
|
@ -50,8 +50,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String ClassName
|
||||
{
|
||||
get { return className; }
|
||||
|
||||
set { className = value; }
|
||||
}
|
||||
|
||||
private String className;
|
||||
|
||||
/// <summary>
|
||||
|
@ -65,6 +67,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
get { return methodName; }
|
||||
}
|
||||
|
||||
private String methodName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -78,6 +81,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
get { return propertyName; }
|
||||
}
|
||||
|
||||
private String propertyName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -91,6 +95,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
get { return qualifierName; }
|
||||
}
|
||||
|
||||
private String qualifierName;
|
||||
}
|
||||
|
||||
|
@ -140,6 +145,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
proxys.Add(proxy);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.SessionSetName:
|
||||
{
|
||||
|
@ -150,6 +156,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
proxys.Add(proxy);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
obj.TypeNames.Insert(0, PartialPSTypeName);
|
||||
return obj;
|
||||
}
|
||||
|
||||
return resultObject;
|
||||
}
|
||||
}
|
||||
|
@ -96,8 +97,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.SetPreProcess(proxy, cmdlet as GetCimInstanceCommand);
|
||||
}
|
||||
|
||||
proxys.Add(proxy);
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.ClassNameComputerSet:
|
||||
case CimBaseCommand.QueryComputerSet:
|
||||
|
@ -109,8 +112,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.SetPreProcess(proxy, cmdlet as GetCimInstanceCommand);
|
||||
}
|
||||
|
||||
proxys.Add(proxy);
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.ClassNameSessionSet:
|
||||
case CimBaseCommand.CimInstanceSessionSet:
|
||||
|
@ -123,12 +128,15 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.SetPreProcess(proxy, cmdlet as GetCimInstanceCommand);
|
||||
}
|
||||
|
||||
proxys.Add(proxy);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cmdlet.ParameterSetName)
|
||||
{
|
||||
case CimBaseCommand.ClassNameComputerSet:
|
||||
|
@ -152,6 +160,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
proxy.EnumerateInstancesAsync(nameSpace, GetClassName(cmdlet));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.CimInstanceComputerSet:
|
||||
case CimBaseCommand.CimInstanceSessionSet:
|
||||
|
@ -163,6 +172,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
proxy.GetInstanceAsync(nameSpace, instance);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.QueryComputerSet:
|
||||
case CimBaseCommand.QuerySessionSet:
|
||||
|
@ -173,6 +183,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
ConstValue.GetQueryDialectWithDefault(GetQueryDialect(cmdlet)),
|
||||
GetQuery(cmdlet));
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.ResourceUriSessionSet:
|
||||
case CimBaseCommand.ResourceUriComputerSet:
|
||||
|
@ -180,6 +191,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
proxy.EnumerateInstancesAsync(GetNamespace(cmdlet), GetClassName(cmdlet));
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -202,6 +214,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return (cmdlet as SetCimInstanceCommand).ComputerName;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -219,6 +232,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return (cmdlet as SetCimInstanceCommand).Namespace;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -236,6 +250,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return (cmdlet as SetCimInstanceCommand).CimSession;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -245,6 +260,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return (cmdlet as GetCimInstanceCommand).ClassName;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -262,6 +278,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return (cmdlet as SetCimInstanceCommand).Query;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -276,6 +293,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -298,13 +316,16 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
propertyList.Append(",");
|
||||
}
|
||||
|
||||
propertyList.Append(property);
|
||||
}
|
||||
}
|
||||
|
||||
return (cmd.Filter == null) ?
|
||||
String.Format(CultureInfo.CurrentUICulture, queryWithoutWhere, propertyList, cmd.ClassName) :
|
||||
String.Format(CultureInfo.CurrentUICulture, queryWithWhere, propertyList, cmd.ClassName, cmd.Filter);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -322,6 +343,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return (cmdlet as SetCimInstanceCommand).QueryDialect;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -339,6 +361,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return (cmdlet as SetCimInstanceCommand).CimInstance;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
@ -375,6 +398,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
proxy.ResourceUri = removeCimInstance.ResourceUri;
|
||||
}
|
||||
|
||||
CimRemoveCimInstanceContext context = new CimRemoveCimInstanceContext(
|
||||
ConstValue.GetNamespace(removeCimInstance.Namespace),
|
||||
proxy);
|
||||
|
@ -388,6 +412,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
proxy.ResourceUri = setCimInstance.ResourceUri;
|
||||
}
|
||||
|
||||
CimSetCimInstanceContext context = new CimSetCimInstanceContext(
|
||||
ConstValue.GetNamespace(setCimInstance.Namespace),
|
||||
setCimInstance.Property,
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
internal Object context;
|
||||
}
|
||||
|
||||
|
@ -51,6 +52,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return exception;
|
||||
}
|
||||
}
|
||||
|
||||
private Exception exception;
|
||||
|
||||
/// <summary>
|
||||
|
@ -263,6 +265,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return enableRaisingEvents;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
DebugHelper.WriteLogEx();
|
||||
|
@ -273,6 +276,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool enableRaisingEvents;
|
||||
|
||||
/// <summary>
|
||||
|
@ -306,6 +310,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
this.queryExpression,
|
||||
this.operationTimeout);
|
||||
}
|
||||
|
||||
status = Status.Started;
|
||||
}
|
||||
}
|
||||
|
@ -329,6 +334,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
DebugHelper.WriteLog("Dispose CimRegisterCimIndication object", 4);
|
||||
this.cimRegisterCimIndication.Dispose();
|
||||
}
|
||||
|
||||
status = Status.Stopped;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.methodName;
|
||||
}
|
||||
}
|
||||
|
||||
private string methodName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -68,6 +69,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.collection;
|
||||
}
|
||||
}
|
||||
|
||||
private CimMethodParametersCollection collection;
|
||||
}
|
||||
|
||||
|
@ -101,6 +103,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
proxys.Add(CreateSessionProxy(computerName, cmdlet.CimInstance, cmdlet));
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.ClassNameComputerSet:
|
||||
case CimBaseCommand.CimClassComputerSet:
|
||||
|
@ -110,6 +113,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
proxys.Add(CreateSessionProxy(computerName, cmdlet));
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.ClassNameSessionSet:
|
||||
case CimBaseCommand.CimClassSessionSet:
|
||||
|
@ -121,10 +125,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
CimSessionProxy proxy = CreateSessionProxy(session, cmdlet);
|
||||
proxys.Add(proxy);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
CimMethodParametersCollection paramsCollection =
|
||||
CreateParametersCollection(cmdlet.Arguments, cmdlet.CimClass, cmdlet.CimInstance, cmdlet.MethodName);
|
||||
|
||||
|
@ -145,12 +151,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
nameSpace = ConstValue.GetNamespace(cmdlet.Namespace);
|
||||
}
|
||||
|
||||
foreach (CimSessionProxy proxy in proxys)
|
||||
{
|
||||
if (!cmdlet.ShouldProcess(target, action))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
proxy.InvokeMethodAsync(
|
||||
nameSpace,
|
||||
cmdlet.ClassName,
|
||||
|
@ -158,6 +166,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
paramsCollection);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.CimClassComputerSet:
|
||||
case CimBaseCommand.CimClassSessionSet:
|
||||
|
@ -170,6 +179,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
proxy.InvokeMethodAsync(
|
||||
nameSpace,
|
||||
cmdlet.CimClass.CimSystemProperties.ClassName,
|
||||
|
@ -177,6 +187,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
paramsCollection);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.QueryComputerSet:
|
||||
case CimBaseCommand.QuerySessionSet:
|
||||
|
@ -193,6 +204,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
// firstly query instance and then invoke method upon returned instances
|
||||
proxy.QueryInstancesAsync(nameSpace, ConstValue.GetQueryDialectWithDefault(cmdlet.QueryDialect), cmdlet.Query);
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.CimInstanceComputerSet:
|
||||
case CimBaseCommand.CimInstanceSessionSet:
|
||||
|
@ -206,12 +218,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
nameSpace = ConstValue.GetNamespace(cmdlet.CimInstance.CimSystemProperties.Namespace);
|
||||
}
|
||||
|
||||
foreach (CimSessionProxy proxy in proxys)
|
||||
{
|
||||
if (!cmdlet.ShouldProcess(target, action))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
proxy.InvokeMethodAsync(
|
||||
nameSpace,
|
||||
cmdlet.CimInstance,
|
||||
|
@ -219,6 +233,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
paramsCollection);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -394,6 +409,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
throw new ArgumentException(String.Format(
|
||||
CultureInfo.CurrentUICulture, Strings.InvalidMethodParameter, parameterName, methodName, className));
|
||||
}
|
||||
|
||||
parameter = CimMethodParameter.Create(
|
||||
parameterName,
|
||||
parameterValue,
|
||||
|
@ -434,9 +450,11 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter != null)
|
||||
collection.Add(parameter);
|
||||
}
|
||||
|
||||
return collection;
|
||||
}
|
||||
#endregion
|
||||
|
|
|
@ -81,6 +81,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
cmdlet);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.ResourceUriSessionSet:
|
||||
case CimBaseCommand.ResourceUriComputerSet:
|
||||
|
@ -93,6 +94,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
cmdlet);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.CimClassComputerSet:
|
||||
case CimBaseCommand.CimClassSessionSet:
|
||||
|
@ -103,6 +105,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
cmdlet);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -148,6 +151,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
proxys.Add(CreateSessionProxy(computerName, cmdlet));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.CimClassSessionSet:
|
||||
case CimBaseCommand.ClassNameSessionSet:
|
||||
|
@ -156,6 +160,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
proxys.Add(CreateSessionProxy(session, cmdlet));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -289,6 +294,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
flag = CimFlags.Key;
|
||||
}
|
||||
|
||||
object propertyValue = GetBaseObject(enumerator.Value);
|
||||
|
||||
DebugHelper.WriteLog("Create and add new property to ciminstance: name = {0}; value = {1}; flags = {2}", 5, propertyName, propertyValue, flag);
|
||||
|
@ -309,6 +315,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
return cimInstance;
|
||||
}
|
||||
|
||||
|
@ -333,6 +340,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return cimInstance;
|
||||
}
|
||||
|
||||
List<string> notfoundProperties = new List<string>();
|
||||
foreach (string property in properties.Keys)
|
||||
{
|
||||
|
@ -342,9 +350,11 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
cmdlet.ThrowInvalidProperty(notfoundProperties, cmdlet.CimClass.CimSystemProperties.ClassName, @"Property", action, properties);
|
||||
return null;
|
||||
}
|
||||
|
||||
object propertyValue = GetBaseObject(properties[property]);
|
||||
cimInstance.CimInstanceProperties[property].Value = propertyValue;
|
||||
}
|
||||
|
||||
return cimInstance;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
// unblocking the waiting thread
|
||||
this.OnComplete();
|
||||
}
|
||||
|
||||
break;
|
||||
case CimPromptType.Normal:
|
||||
try
|
||||
|
@ -106,10 +107,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
// unblocking the waiting thread
|
||||
this.OnComplete();
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
this.OnComplete();
|
||||
}
|
||||
|
||||
|
@ -125,6 +128,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
private string message;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
protected Object context;
|
||||
}
|
||||
|
||||
|
@ -54,6 +55,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private CimSubscriptionResult result;
|
||||
|
||||
/// <summary>
|
||||
|
@ -87,6 +89,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return exception;
|
||||
}
|
||||
}
|
||||
|
||||
private Exception exception;
|
||||
|
||||
/// <summary>
|
||||
|
@ -169,6 +172,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
throw new ArgumentNullException(String.Format(CultureInfo.CurrentUICulture, Strings.NullArgument, @"cimSession"));
|
||||
}
|
||||
|
||||
this.TargetComputerName = cimSession.ComputerName;
|
||||
CimSessionProxy proxy = CreateSessionProxy(cimSession, operationTimeout);
|
||||
proxy.SubscribeAsync(nameSpace, queryDialect, queryExpression);
|
||||
|
@ -224,6 +228,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
this.ackedEvent.Set();
|
||||
return;
|
||||
}
|
||||
|
||||
EventHandler<CimSubscriptionEventArgs> temp = this.OnNewSubscriptionResult;
|
||||
if (temp != null)
|
||||
{
|
||||
|
@ -231,6 +236,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
temp(this, new CimSubscriptionExceptionEventArgs(this.exception));
|
||||
}
|
||||
|
||||
DebugHelper.WriteLog("Got an exception: {0}", 2, exception);
|
||||
}
|
||||
|
||||
|
@ -290,6 +296,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
throw this.exception;
|
||||
}
|
||||
}
|
||||
|
||||
DebugHelper.WriteLogEx("ACK happened", 0);
|
||||
}
|
||||
#endregion
|
||||
|
@ -364,6 +371,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return exception;
|
||||
}
|
||||
}
|
||||
|
||||
private Exception exception;
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -70,16 +70,19 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
proxys.Add(CreateSessionProxy(computerName, cmdlet.CimInstance, cmdlet));
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.CimInstanceSessionSet:
|
||||
foreach (CimSession session in GetCimSession(cmdlet))
|
||||
{
|
||||
proxys.Add(CreateSessionProxy(session, cmdlet));
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cmdlet.ParameterSetName)
|
||||
{
|
||||
case CimBaseCommand.CimInstanceComputerSet:
|
||||
|
@ -93,6 +96,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
nameSpace = ConstValue.GetNamespace(GetCimInstanceParameter(cmdlet).CimSystemProperties.Namespace);
|
||||
}
|
||||
|
||||
string target = cmdlet.CimInstance.ToString();
|
||||
foreach (CimSessionProxy proxy in proxys)
|
||||
{
|
||||
|
@ -100,8 +104,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
proxy.DeleteInstanceAsync(nameSpace, cmdlet.CimInstance);
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.QueryComputerSet:
|
||||
case CimBaseCommand.QuerySessionSet:
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.errorSource;
|
||||
}
|
||||
}
|
||||
|
||||
private object errorSource;
|
||||
}
|
||||
#endregion
|
||||
|
@ -334,6 +335,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.OnNextCore(value);
|
||||
}
|
||||
|
||||
|
@ -349,6 +351,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return session;
|
||||
}
|
||||
}
|
||||
|
||||
private CimSession session;
|
||||
|
||||
/// <summary>
|
||||
|
@ -466,6 +469,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
resultObject.Properties.Add(new PSNoteProperty(@"ItemValue", methodStreamedResult.ItemValue));
|
||||
}
|
||||
}
|
||||
|
||||
if (resultObject != null)
|
||||
{
|
||||
resultObject.Properties.Add(new PSNoteProperty(@"PSComputerName", this.CurrentSession.ComputerName));
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.sessionId;
|
||||
}
|
||||
}
|
||||
|
||||
private uint sessionId;
|
||||
|
||||
/// <summary>
|
||||
|
@ -43,6 +44,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.instanceId;
|
||||
}
|
||||
}
|
||||
|
||||
private Guid instanceId;
|
||||
|
||||
/// <summary>
|
||||
|
@ -55,6 +57,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
private string name;
|
||||
|
||||
/// <summary>
|
||||
|
@ -67,6 +70,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.computerName;
|
||||
}
|
||||
}
|
||||
|
||||
private string computerName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -79,6 +83,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.cimSession;
|
||||
}
|
||||
}
|
||||
|
||||
private CimSession cimSession;
|
||||
|
||||
/// <summary>
|
||||
|
@ -99,10 +104,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal ProtocolType GetProtocolType()
|
||||
{
|
||||
return protocol;
|
||||
}
|
||||
|
||||
private ProtocolType protocol;
|
||||
|
||||
/// <summary>
|
||||
|
@ -148,6 +155,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
psObject.Properties[CimSessionState.computernamePropName].Value = this.ComputerName;
|
||||
psObject.Properties[CimSessionState.protocolPropName].Value = this.Protocol;
|
||||
}
|
||||
|
||||
return psObject;
|
||||
}
|
||||
}
|
||||
|
@ -358,6 +366,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
session.Dispose();
|
||||
}
|
||||
|
||||
curCimSessionWrapper.Clear();
|
||||
curCimSessionsByName.Clear();
|
||||
curCimSessionsByComputerName.Clear();
|
||||
|
@ -397,6 +406,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
objects = new HashSet<CimSessionWrapper>();
|
||||
this.curCimSessionsByComputerName.Add(computerName, objects);
|
||||
}
|
||||
|
||||
objects.Add(wrapper);
|
||||
|
||||
if (!this.curCimSessionsByName.TryGetValue(name, out objects))
|
||||
|
@ -404,6 +414,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
objects = new HashSet<CimSessionWrapper>();
|
||||
this.curCimSessionsByName.Add(name, objects);
|
||||
}
|
||||
|
||||
objects.Add(wrapper);
|
||||
|
||||
this.curCimSessionsByInstanceId.Add(instanceId, wrapper);
|
||||
|
@ -431,20 +442,25 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
id = Convert.ToUInt32(psObject.Properties[idPropName].Value, null);
|
||||
}
|
||||
|
||||
if (psObject.Properties[instanceidPropName].Value is Guid)
|
||||
{
|
||||
instanceId = (Guid)psObject.Properties[instanceidPropName].Value;
|
||||
}
|
||||
|
||||
if (psObject.Properties[namePropName].Value is String)
|
||||
{
|
||||
name = (String)psObject.Properties[namePropName].Value;
|
||||
}
|
||||
|
||||
if (psObject.Properties[computernamePropName].Value is String)
|
||||
{
|
||||
computerName = (String)psObject.Properties[computernamePropName].Value;
|
||||
}
|
||||
|
||||
message = String.Format(CultureInfo.CurrentUICulture, SessionObjectPath, id, instanceId, name, computerName);
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
|
@ -478,6 +494,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CimSessionWrapper wrapper = this.curCimSessionWrapper[session];
|
||||
String name = wrapper.Name;
|
||||
String computerName = wrapper.ComputerName;
|
||||
|
@ -489,10 +506,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
objects.Remove(wrapper);
|
||||
}
|
||||
|
||||
if (this.curCimSessionsByName.TryGetValue(name, out objects))
|
||||
{
|
||||
objects.Remove(wrapper);
|
||||
}
|
||||
|
||||
RemoveSessionInternal(session, wrapper);
|
||||
}
|
||||
|
||||
|
@ -566,6 +585,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
AddErrorRecord(ref errRecords, idPropName, id);
|
||||
}
|
||||
}
|
||||
|
||||
return sessions;
|
||||
}
|
||||
|
||||
|
@ -597,6 +617,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
AddErrorRecord(ref errRecords, instanceidPropName, instanceid);
|
||||
}
|
||||
}
|
||||
|
||||
return sessions;
|
||||
}
|
||||
|
||||
|
@ -632,11 +653,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundSession && !WildcardPattern.ContainsWildcardCharacters(name))
|
||||
{
|
||||
AddErrorRecord(ref errRecords, namePropName, name);
|
||||
}
|
||||
}
|
||||
|
||||
return sessions;
|
||||
}
|
||||
|
||||
|
@ -669,11 +692,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundSession)
|
||||
{
|
||||
AddErrorRecord(ref errRecords, computernamePropName, computername);
|
||||
}
|
||||
}
|
||||
|
||||
return sessions;
|
||||
}
|
||||
|
||||
|
@ -705,6 +730,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
AddErrorRecord(ref errRecords, CimSessionClassName, CimSessionObject);
|
||||
}
|
||||
}
|
||||
|
||||
return sessions;
|
||||
}
|
||||
|
||||
|
@ -732,6 +758,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
CimSessionWrapper wrapper = this.curCimSessionsByInstanceId[cimSessionInstanceId];
|
||||
return wrapper.CimSession;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
@ -766,6 +793,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
Runspace.DefaultRunspace.StateChanged += DefaultRunspace_StateChanged;
|
||||
}
|
||||
|
||||
return new CimSessionState();
|
||||
});
|
||||
}
|
||||
|
@ -845,6 +873,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
DebugHelper.WriteLog(String.Format(CultureInfo.CurrentUICulture, DebugHelper.runspaceStateChanged, runspace.InstanceId, e.RunspaceStateInfo.State));
|
||||
state.Dispose();
|
||||
}
|
||||
|
||||
runspace.StateChanged -= DefaultRunspace_StateChanged;
|
||||
break;
|
||||
default:
|
||||
|
@ -900,6 +929,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.cimSessionWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
private CimSessionWrapper cimSessionWrapper;
|
||||
}
|
||||
|
||||
|
@ -937,6 +967,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
sessionOptions = CimSessionProxy.CreateCimSessionOption(computerName,
|
||||
cmdlet.OperationTimeoutSec, credential);
|
||||
}
|
||||
|
||||
proxy = new CimSessionProxyTestConnection(computerName, sessionOptions);
|
||||
string computerNameValue = (computerName == ConstValue.NullComputerName) ? ConstValue.LocalhostComputerName : computerName;
|
||||
CimSessionWrapper wrapper = new CimSessionWrapper(0, Guid.Empty, cmdlet.Name, computerNameValue, proxy.CimSession, proxy.Protocol);
|
||||
|
@ -1034,6 +1065,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return _disposed;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1122,6 +1154,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
sessionToGet = this.sessionState.QuerySessionByComputerName(cmdlet.ComputerName, out errorRecords);
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.SessionIdSet:
|
||||
sessionToGet = this.sessionState.QuerySession(cmdlet.Id, out errorRecords);
|
||||
|
@ -1135,6 +1168,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (sessionToGet != null)
|
||||
{
|
||||
foreach(PSObject psobject in sessionToGet)
|
||||
|
@ -1142,6 +1176,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
cmdlet.WriteObject(psobject);
|
||||
}
|
||||
}
|
||||
|
||||
if (errorRecords != null)
|
||||
{
|
||||
foreach (ErrorRecord errRecord in errorRecords)
|
||||
|
@ -1210,6 +1245,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (sessionToRemove != null)
|
||||
{
|
||||
foreach (PSObject psobject in sessionToRemove)
|
||||
|
@ -1220,6 +1256,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (errorRecords != null)
|
||||
{
|
||||
foreach (ErrorRecord errRecord in errorRecords)
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.nameSpace;
|
||||
}
|
||||
}
|
||||
|
||||
protected string nameSpace;
|
||||
|
||||
/// <summary>
|
||||
|
@ -53,6 +54,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.proxy;
|
||||
}
|
||||
}
|
||||
|
||||
protected CimSessionProxy proxy;
|
||||
}
|
||||
|
||||
|
@ -148,6 +150,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.Action = action;
|
||||
}
|
||||
|
||||
public readonly CimBaseAction Action;
|
||||
}
|
||||
|
||||
|
@ -169,6 +172,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
this.operation = operation;
|
||||
this.success = theSuccess;
|
||||
}
|
||||
|
||||
public readonly IDisposable operationCancellation;
|
||||
public readonly IObservable<object> operation;
|
||||
public readonly bool success;
|
||||
|
@ -412,6 +416,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
String cimsessionComputerName = cimInstance.GetCimSessionComputerName();
|
||||
CreateSetSession(cimsessionComputerName, null, null, null, false);
|
||||
this.isDefaultSession = (cimsessionComputerName == ConstValue.NullComputerName);
|
||||
|
@ -484,6 +489,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
this.CancelOperation = null;
|
||||
this.operation = null;
|
||||
}
|
||||
|
||||
InitOption(operOptions);
|
||||
this.protocol = ProtocolType.Wsman;
|
||||
this.isTemporaryCimSession = temporaryCimSession;
|
||||
|
@ -520,6 +526,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.session = CreateCimSessionByComputerName(computerName);
|
||||
}
|
||||
|
||||
this.isTemporaryCimSession = true;
|
||||
}
|
||||
|
||||
|
@ -527,6 +534,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
AddCimSessionToTemporaryCache(this.session);
|
||||
}
|
||||
|
||||
this.invocationContextObject = new InvocationContext(this);
|
||||
DebugHelper.WriteLog("Protocol {0}, Is temporary session ? {1}", 1, this.protocol, this.isTemporaryCimSession);
|
||||
}
|
||||
|
@ -546,6 +554,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
this.options.Timeout = TimeSpan.FromSeconds((double)value);
|
||||
}
|
||||
|
||||
get
|
||||
{
|
||||
return (UInt32)this.options.Timeout.TotalSeconds;
|
||||
|
@ -563,6 +572,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
this.options.ResourceUri= value;
|
||||
}
|
||||
|
||||
get
|
||||
{
|
||||
return this.options.ResourceUri;
|
||||
|
@ -579,6 +589,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return this.options.EnableMethodResultStreaming;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
DebugHelper.WriteLogEx("EnableMethodResultStreaming {0}", 0, value);
|
||||
|
@ -663,6 +674,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.options = new CimOperationOptions();
|
||||
}
|
||||
|
||||
this.EnableMethodResultStreaming = true;
|
||||
this.EnablePSSemantics();
|
||||
}
|
||||
|
@ -722,6 +734,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.operation = null;
|
||||
}
|
||||
|
||||
if (this.session != null && this.ContextObject == null)
|
||||
{
|
||||
DebugHelper.WriteLog("Dispose this proxy object @ RemoveOperation");
|
||||
|
@ -755,6 +768,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
DebugHelper.WriteLog("Ignore action since OnNewCmdletAction is null.", 5);
|
||||
}
|
||||
|
||||
this.PostNewActionEvent(actionArgs);
|
||||
}
|
||||
|
||||
|
@ -778,6 +792,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
temp(this.session, args);
|
||||
}
|
||||
|
||||
this.PostOperationCreateEvent(args);
|
||||
}
|
||||
|
||||
|
@ -801,6 +816,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
temp(this.session, args);
|
||||
}
|
||||
|
||||
this.PostOperationDeleteEvent(args);
|
||||
this.RemoveOperation(operation);
|
||||
this.operationName = null;
|
||||
|
@ -850,9 +866,11 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
parameters.Append(",");
|
||||
}
|
||||
|
||||
parameters.Append(string.Format(CultureInfo.CurrentUICulture, @"'{0}' = {1}", key, parameterList[key]));
|
||||
}
|
||||
}
|
||||
|
||||
string operationStartMessage = string.Format(CultureInfo.CurrentUICulture,
|
||||
Strings.CimOperationStart,
|
||||
operation,
|
||||
|
@ -980,6 +998,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
AsyncResultCompleteEventArgs args = resultArgs as AsyncResultCompleteEventArgs;
|
||||
this.FireOperationDeletedEvent(args.observable, true);
|
||||
}
|
||||
|
||||
break;
|
||||
case AsyncResultType.Exception:
|
||||
{
|
||||
|
@ -990,8 +1009,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.FireNewActionEvent(action);
|
||||
}
|
||||
|
||||
this.FireOperationDeletedEvent(args.observable, false);
|
||||
}
|
||||
|
||||
break;
|
||||
case AsyncResultType.Result:
|
||||
{
|
||||
|
@ -1002,6 +1023,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
AddShowComputerNameMarker(resultObject);
|
||||
}
|
||||
|
||||
if (this.ObjectPreProcess != null)
|
||||
{
|
||||
resultObject = this.ObjectPreProcess.Process(resultObject);
|
||||
|
@ -1012,6 +1034,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
CimWriteResultObject action = new CimWriteResultObject(resultObject, this.ContextObject);
|
||||
this.FireNewActionEvent(action);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1047,6 +1070,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CDXML_CLIXML_TEST"));
|
||||
}
|
||||
|
||||
private object PostProcessCimInstance(object resultObject)
|
||||
{
|
||||
DebugHelper.WriteLogEx();
|
||||
|
@ -1058,6 +1082,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
DebugHelper.WriteLogEx("Deserialized Object is {0}, type {1}", 1, returnObject, returnObject.GetType());
|
||||
return returnObject;
|
||||
}
|
||||
|
||||
return resultObject;
|
||||
}
|
||||
#endif
|
||||
|
@ -1468,6 +1493,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.session;
|
||||
}
|
||||
}
|
||||
|
||||
private CimSession session;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1481,6 +1507,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.targetCimInstance;
|
||||
}
|
||||
}
|
||||
|
||||
private CimInstance targetCimInstance = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1510,6 +1537,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.options;
|
||||
}
|
||||
}
|
||||
|
||||
private CimOperationOptions options;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1579,6 +1607,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
this._cancelOperation = value;
|
||||
Interlocked.Exchange(ref this._cancelOperationDisposed, 0);
|
||||
}
|
||||
|
||||
get
|
||||
{
|
||||
return this._cancelOperation;
|
||||
|
@ -1596,6 +1625,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return protocol;
|
||||
}
|
||||
}
|
||||
|
||||
private ProtocolType protocol;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1607,11 +1637,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.contextObject = value;
|
||||
}
|
||||
|
||||
get
|
||||
{
|
||||
return this.contextObject;
|
||||
}
|
||||
}
|
||||
|
||||
private XOperationContextBase contextObject;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1629,11 +1661,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.objectPreprocess = value;
|
||||
}
|
||||
|
||||
get
|
||||
{
|
||||
return this.objectPreprocess;
|
||||
}
|
||||
}
|
||||
|
||||
private IObjectPreProcess objectPreprocess;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1689,6 +1723,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
this.options.Dispose();
|
||||
this.options = null;
|
||||
}
|
||||
|
||||
DisposeTemporaryCimSession();
|
||||
}
|
||||
}
|
||||
|
@ -1870,6 +1905,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
throw new InvalidOperationException(Strings.OperationInProgress);
|
||||
}
|
||||
}
|
||||
|
||||
DebugHelper.WriteLog("KeyOnly {0},", 1, this.options.KeysOnly);
|
||||
}
|
||||
|
||||
|
@ -1937,14 +1973,17 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
DebugHelper.WriteLog("<<<<<<<<<< Use protocol WSMAN {0}", 1, computerName);
|
||||
option = new WSManSessionOptions();
|
||||
}
|
||||
|
||||
if (timeout != 0)
|
||||
{
|
||||
option.Timeout = TimeSpan.FromSeconds((double)timeout);
|
||||
}
|
||||
|
||||
if (credential != null)
|
||||
{
|
||||
option.AddDestinationCredentials(credential);
|
||||
}
|
||||
|
||||
DebugHelper.WriteLogEx("returned option :{0}.", 1, option);
|
||||
return option;
|
||||
}
|
||||
|
@ -2072,6 +2111,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (context.PropertyName != null)
|
||||
{
|
||||
pattern = new WildcardPattern(context.PropertyName, WildcardOptions.IgnoreCase);
|
||||
|
@ -2095,6 +2135,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return match;
|
||||
}
|
||||
}
|
||||
|
||||
if (context.MethodName != null)
|
||||
{
|
||||
pattern = new WildcardPattern(context.MethodName, WildcardOptions.IgnoreCase);
|
||||
|
@ -2118,6 +2159,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return match;
|
||||
}
|
||||
}
|
||||
|
||||
if (context.QualifierName != null)
|
||||
{
|
||||
pattern = new WildcardPattern(context.QualifierName, WildcardOptions.IgnoreCase);
|
||||
|
@ -2141,6 +2183,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return match;
|
||||
}
|
||||
}
|
||||
|
||||
DebugHelper.WriteLog("CimClass '{0}' is qualified.", 1, cimClass.CimSystemProperties.ClassName);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.property;
|
||||
}
|
||||
}
|
||||
|
||||
private IDictionary property;
|
||||
|
||||
/// <summary>
|
||||
|
@ -62,6 +63,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.parameterSetName;
|
||||
}
|
||||
}
|
||||
|
||||
private string parameterSetName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -74,6 +76,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return this.passThru;
|
||||
}
|
||||
}
|
||||
|
||||
private bool passThru;
|
||||
}
|
||||
|
||||
|
@ -113,6 +116,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
// create CimSessionProxySetCimInstance object internally
|
||||
proxys.Add(CreateSessionProxy(computerName, cmdlet.CimInstance, cmdlet, cmdlet.PassThru));
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.CimInstanceSessionSet:
|
||||
foreach (CimSession session in GetCimSession(cmdlet))
|
||||
|
@ -120,10 +124,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
// create CimSessionProxySetCimInstance object internally
|
||||
proxys.Add(CreateSessionProxy(session, cmdlet, cmdlet.PassThru));
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cmdlet.ParameterSetName)
|
||||
{
|
||||
case CimBaseCommand.CimInstanceComputerSet:
|
||||
|
@ -148,8 +154,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
proxy.ModifyInstanceAsync(nameSpace, instance);
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.QueryComputerSet:
|
||||
case CimBaseCommand.QuerySessionSet:
|
||||
|
@ -181,6 +189,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
cmdlet.ThrowTerminatingError(exception, action);
|
||||
return;
|
||||
}
|
||||
|
||||
CimSessionProxy proxy = CreateCimSessionProxy(context.Proxy, context.PassThru);
|
||||
proxy.ModifyInstanceAsync(cimInstance.CimSystemProperties.Namespace, cimInstance);
|
||||
}
|
||||
|
@ -205,6 +214,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
// simply ignore if empty properties was provided
|
||||
return true;
|
||||
}
|
||||
|
||||
IDictionaryEnumerator enumerator = properties.GetEnumerator();
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
|
@ -261,6 +271,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
CimFlags.Property);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
cimInstance.CimInstanceProperties.Add(newProperty);
|
||||
|
@ -279,8 +290,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
exception = e;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DebugHelper.WriteLog("Add non-key property name '{0}' with value '{1}'.", 3, key, value);
|
||||
}
|
||||
}
|
||||
|
@ -291,6 +304,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
errorRecord.CategoryInfo.TargetName = cimException.ErrorSource;
|
||||
}
|
||||
|
||||
return errorRecord;
|
||||
}
|
||||
|
||||
|
@ -153,6 +154,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
theTargetObject = cimResultContext.ErrorSource;
|
||||
}
|
||||
|
||||
if (theTargetObject == null)
|
||||
{
|
||||
if (context != null)
|
||||
|
@ -163,6 +165,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ErrorRecord coreErrorRecord = new ErrorRecord(
|
||||
exception: exception,
|
||||
errorId: errorId,
|
||||
|
@ -394,6 +397,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return exception;
|
||||
}
|
||||
}
|
||||
|
||||
private Exception exception;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.statusDescription = theStatusDescription;
|
||||
}
|
||||
|
||||
this.percentageCompleted = thePercentageCompleted;
|
||||
this.secondsRemaining = theSecondsRemaining;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private object result;
|
||||
#endregion
|
||||
}//End Class
|
||||
|
|
|
@ -40,58 +40,72 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return cmdlet.ShouldContinue(query, caption);
|
||||
}
|
||||
|
||||
public virtual bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll)
|
||||
{
|
||||
return cmdlet.ShouldContinue(query, caption, ref yesToAll, ref noToAll);
|
||||
}
|
||||
|
||||
public virtual bool ShouldProcess(string target)
|
||||
{
|
||||
return cmdlet.ShouldProcess(target);
|
||||
}
|
||||
|
||||
public virtual bool ShouldProcess(string target, string action)
|
||||
{
|
||||
return cmdlet.ShouldProcess(target, action);
|
||||
}
|
||||
|
||||
public virtual bool ShouldProcess(string verboseDescription, string verboseWarning, string caption)
|
||||
{
|
||||
return cmdlet.ShouldProcess(verboseDescription, verboseWarning, caption);
|
||||
}
|
||||
|
||||
public virtual bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason)
|
||||
{
|
||||
return cmdlet.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason);
|
||||
}
|
||||
|
||||
public virtual void ThrowTerminatingError(ErrorRecord errorRecord)
|
||||
{
|
||||
cmdlet.ThrowTerminatingError(errorRecord);
|
||||
}
|
||||
|
||||
public virtual void WriteCommandDetail(string text)
|
||||
{
|
||||
cmdlet.WriteCommandDetail(text);
|
||||
}
|
||||
|
||||
public virtual void WriteDebug(string text)
|
||||
{
|
||||
cmdlet.WriteDebug(text);
|
||||
}
|
||||
|
||||
public virtual void WriteError(ErrorRecord errorRecord)
|
||||
{
|
||||
cmdlet.WriteError(errorRecord);
|
||||
}
|
||||
|
||||
public virtual void WriteObject(object sendToPipeline, XOperationContextBase context)
|
||||
{
|
||||
cmdlet.WriteObject(sendToPipeline);
|
||||
}
|
||||
|
||||
public virtual void WriteObject(object sendToPipeline, bool enumerateCollection, XOperationContextBase context)
|
||||
{
|
||||
cmdlet.WriteObject(sendToPipeline, enumerateCollection);
|
||||
}
|
||||
|
||||
public virtual void WriteProgress(ProgressRecord progressRecord)
|
||||
{
|
||||
cmdlet.WriteProgress(progressRecord);
|
||||
}
|
||||
|
||||
public virtual void WriteVerbose(string text)
|
||||
{
|
||||
cmdlet.WriteVerbose(text);
|
||||
}
|
||||
|
||||
public virtual void WriteWarning(string text)
|
||||
{
|
||||
cmdlet.WriteWarning(text);
|
||||
|
@ -236,6 +250,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
DebugHelper.WriteLog("Assert. CimSetCimInstance::SetCimInstance has NULL CimSetCimInstanceContext", 4);
|
||||
}
|
||||
}
|
||||
|
||||
base.WriteObject(sendToPipeline, context);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Association
|
||||
{
|
||||
get { return association; }
|
||||
|
||||
set { association = value; }
|
||||
}
|
||||
|
||||
private String association;
|
||||
|
||||
/// <summary>
|
||||
|
@ -68,8 +70,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String ResultClassName
|
||||
{
|
||||
get { return resultClassName; }
|
||||
|
||||
set { resultClassName = value; }
|
||||
}
|
||||
|
||||
private String resultClassName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -86,6 +90,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimInstance InputObject
|
||||
{
|
||||
get { return cimInstance; }
|
||||
|
||||
set
|
||||
{
|
||||
cimInstance = value;
|
||||
|
@ -100,6 +105,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
get { return cimInstance; }
|
||||
}
|
||||
|
||||
private CimInstance cimInstance;
|
||||
|
||||
/// <summary>
|
||||
|
@ -111,8 +117,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Namespace
|
||||
{
|
||||
get { return nameSpace; }
|
||||
|
||||
set { nameSpace = value; }
|
||||
}
|
||||
|
||||
private String nameSpace;
|
||||
|
||||
/// <summary>
|
||||
|
@ -127,8 +135,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32 OperationTimeoutSec
|
||||
{
|
||||
get { return operationTimeout; }
|
||||
|
||||
set { operationTimeout = value; }
|
||||
}
|
||||
|
||||
private UInt32 operationTimeout;
|
||||
|
||||
/// <summary>
|
||||
|
@ -141,12 +151,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public Uri ResourceUri
|
||||
{
|
||||
get { return resourceUri; }
|
||||
|
||||
set
|
||||
{
|
||||
this.resourceUri = value;
|
||||
base.SetParameter(value, nameResourceUri);
|
||||
}
|
||||
}
|
||||
|
||||
private Uri resourceUri;
|
||||
|
||||
/// <summary>
|
||||
|
@ -167,12 +179,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] ComputerName
|
||||
{
|
||||
get { return computerName; }
|
||||
|
||||
set
|
||||
{
|
||||
computerName = value;
|
||||
base.SetParameter(value, nameComputerName);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] computerName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -187,12 +201,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public Microsoft.Management.Infrastructure.CimSession[] CimSession
|
||||
{
|
||||
get { return cimSession; }
|
||||
|
||||
set
|
||||
{
|
||||
cimSession = value;
|
||||
base.SetParameter(value, nameCimSession);
|
||||
}
|
||||
}
|
||||
|
||||
private Microsoft.Management.Infrastructure.CimSession[] cimSession;
|
||||
|
||||
/// <summary>
|
||||
|
@ -206,8 +222,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter KeyOnly
|
||||
{
|
||||
get { return keyOnly; }
|
||||
|
||||
set { keyOnly = value; }
|
||||
}
|
||||
|
||||
private SwitchParameter keyOnly;
|
||||
|
||||
#endregion
|
||||
|
@ -234,6 +252,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
operation = this.CreateOperationAgent();
|
||||
}
|
||||
|
||||
operation.GetCimAssociatedInstance(this);
|
||||
operation.ProcessActions(this.CmdletOperation);
|
||||
}//End ProcessRecord()
|
||||
|
|
|
@ -56,8 +56,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String ClassName
|
||||
{
|
||||
get { return className; }
|
||||
|
||||
set { className = value; }
|
||||
}
|
||||
|
||||
private String className;
|
||||
|
||||
/// <summary>
|
||||
|
@ -77,8 +79,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Namespace
|
||||
{
|
||||
get { return nameSpace; }
|
||||
|
||||
set { nameSpace = value; }
|
||||
}
|
||||
|
||||
private String nameSpace;
|
||||
|
||||
/// <summary>
|
||||
|
@ -91,8 +95,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32 OperationTimeoutSec
|
||||
{
|
||||
get { return operationTimeout;}
|
||||
|
||||
set { operationTimeout = value; }
|
||||
}
|
||||
|
||||
private UInt32 operationTimeout;
|
||||
|
||||
/// <summary>
|
||||
|
@ -107,12 +113,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimSession[] CimSession
|
||||
{
|
||||
get { return cimSession;}
|
||||
|
||||
set
|
||||
{
|
||||
cimSession = value;
|
||||
base.SetParameter(value, nameCimSession);
|
||||
}
|
||||
}
|
||||
|
||||
private CimSession[] cimSession;
|
||||
|
||||
/// <summary>
|
||||
|
@ -131,12 +139,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] ComputerName
|
||||
{
|
||||
get { return computerName; }
|
||||
|
||||
set
|
||||
{
|
||||
computerName = value;
|
||||
base.SetParameter(value, nameComputerName);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] computerName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -150,8 +160,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String MethodName
|
||||
{
|
||||
get { return methodName; }
|
||||
|
||||
set { methodName = value; }
|
||||
}
|
||||
|
||||
private String methodName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -165,8 +177,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String PropertyName
|
||||
{
|
||||
get { return propertyName; }
|
||||
|
||||
set { propertyName = value; }
|
||||
}
|
||||
|
||||
private String propertyName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -180,8 +194,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String QualifierName
|
||||
{
|
||||
get { return qualifierName; }
|
||||
|
||||
set { qualifierName = value; }
|
||||
}
|
||||
|
||||
private String qualifierName;
|
||||
|
||||
#endregion
|
||||
|
@ -208,6 +224,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
cimGetCimClass = CreateOperationAgent();
|
||||
}
|
||||
|
||||
cimGetCimClass.GetCimClass(this);
|
||||
cimGetCimClass.ProcessActions(this.CmdletOperation);
|
||||
}//End ProcessRecord()
|
||||
|
|
|
@ -63,12 +63,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimSession[] CimSession
|
||||
{
|
||||
get { return cimSession; }
|
||||
|
||||
set
|
||||
{
|
||||
cimSession = value;
|
||||
base.SetParameter(value, nameCimSession);
|
||||
}
|
||||
}
|
||||
|
||||
private CimSession[] cimSession;
|
||||
|
||||
/// <summary>
|
||||
|
@ -88,12 +90,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String ClassName
|
||||
{
|
||||
get { return className; }
|
||||
|
||||
set
|
||||
{
|
||||
this.className = value;
|
||||
base.SetParameter(value, nameClassName);
|
||||
}
|
||||
}
|
||||
|
||||
private String className;
|
||||
|
||||
/// <summary>
|
||||
|
@ -121,12 +125,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public Uri ResourceUri
|
||||
{
|
||||
get { return resourceUri; }
|
||||
|
||||
set
|
||||
{
|
||||
this.resourceUri = value;
|
||||
base.SetParameter(value, nameResourceUri);
|
||||
}
|
||||
}
|
||||
|
||||
private Uri resourceUri;
|
||||
|
||||
/// <summary>
|
||||
|
@ -155,12 +161,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] ComputerName
|
||||
{
|
||||
get { return computerName; }
|
||||
|
||||
set
|
||||
{
|
||||
computerName = value;
|
||||
base.SetParameter(value, nameComputerName);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] computerName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -177,12 +185,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter KeyOnly
|
||||
{
|
||||
get { return keyOnly; }
|
||||
|
||||
set
|
||||
{
|
||||
keyOnly = value;
|
||||
base.SetParameter(value, nameKeyOnly);
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter keyOnly;
|
||||
|
||||
/// <summary>
|
||||
|
@ -210,12 +220,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Namespace
|
||||
{
|
||||
get { return nameSpace; }
|
||||
|
||||
set
|
||||
{
|
||||
nameSpace = value;
|
||||
base.SetParameter(value, nameNamespace);
|
||||
}
|
||||
}
|
||||
|
||||
private String nameSpace;
|
||||
|
||||
/// <summary>
|
||||
|
@ -232,8 +244,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32 OperationTimeoutSec
|
||||
{
|
||||
get { return operationTimeout; }
|
||||
|
||||
set { operationTimeout = value; }
|
||||
}
|
||||
|
||||
private UInt32 operationTimeout;
|
||||
|
||||
/// <summary>
|
||||
|
@ -263,6 +277,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimInstance InputObject
|
||||
{
|
||||
get { return cimInstance; }
|
||||
|
||||
set
|
||||
{
|
||||
cimInstance = value;
|
||||
|
@ -277,6 +292,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
get { return cimInstance; }
|
||||
}
|
||||
|
||||
private CimInstance cimInstance;
|
||||
|
||||
/// <summary>
|
||||
|
@ -293,12 +309,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Query
|
||||
{
|
||||
get { return query; }
|
||||
|
||||
set
|
||||
{
|
||||
query = value;
|
||||
base.SetParameter(value, nameQuery);
|
||||
}
|
||||
}
|
||||
|
||||
private String query;
|
||||
|
||||
/// <summary>
|
||||
|
@ -320,12 +338,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String QueryDialect
|
||||
{
|
||||
get { return queryDialect; }
|
||||
|
||||
set
|
||||
{
|
||||
queryDialect = value;
|
||||
base.SetParameter(value, nameQueryDialect);
|
||||
}
|
||||
}
|
||||
|
||||
private String queryDialect;
|
||||
|
||||
/// <summary>
|
||||
|
@ -346,12 +366,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter Shallow
|
||||
{
|
||||
get { return shallow; }
|
||||
|
||||
set
|
||||
{
|
||||
shallow = value;
|
||||
base.SetParameter(value, nameShallow);
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter shallow;
|
||||
|
||||
/// <summary>
|
||||
|
@ -371,12 +393,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Filter
|
||||
{
|
||||
get { return filter; }
|
||||
|
||||
set
|
||||
{
|
||||
filter = value;
|
||||
base.SetParameter(value, nameFilter);
|
||||
}
|
||||
}
|
||||
|
||||
private String filter;
|
||||
|
||||
/// <summary>
|
||||
|
@ -398,6 +422,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] Property
|
||||
{
|
||||
get { return property; }
|
||||
|
||||
set
|
||||
{
|
||||
property = value;
|
||||
|
@ -411,6 +436,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
get { return property; }
|
||||
}
|
||||
|
||||
private String[] property;
|
||||
|
||||
#endregion
|
||||
|
@ -438,6 +464,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
cimGetInstance = CreateOperationAgent();
|
||||
}
|
||||
|
||||
cimGetInstance.GetCimInstance(this);
|
||||
cimGetInstance.ProcessActions(this.CmdletOperation);
|
||||
}//End ProcessRecord()
|
||||
|
|
|
@ -59,12 +59,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] ComputerName
|
||||
{
|
||||
get { return computername;}
|
||||
|
||||
set
|
||||
{
|
||||
computername = value;
|
||||
base.SetParameter(value, nameComputerName);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] computername;
|
||||
|
||||
/// <summary>
|
||||
|
@ -79,12 +81,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32[] Id
|
||||
{
|
||||
get { return id;}
|
||||
|
||||
set
|
||||
{
|
||||
id = value;
|
||||
base.SetParameter(value, nameId);
|
||||
}
|
||||
}
|
||||
|
||||
private UInt32[] id;
|
||||
|
||||
/// <summary>
|
||||
|
@ -98,12 +102,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public Guid[] InstanceId
|
||||
{
|
||||
get { return instanceid;}
|
||||
|
||||
set
|
||||
{
|
||||
instanceid = value;
|
||||
base.SetParameter(value, nameInstanceId);
|
||||
}
|
||||
}
|
||||
|
||||
private Guid[] instanceid;
|
||||
|
||||
/// <summary>
|
||||
|
@ -118,12 +124,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] Name
|
||||
{
|
||||
get { return name;}
|
||||
|
||||
set
|
||||
{
|
||||
name = value;
|
||||
base.SetParameter(value, nameName);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] name;
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -55,12 +55,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String ClassName
|
||||
{
|
||||
get { return className; }
|
||||
|
||||
set
|
||||
{
|
||||
className = value;
|
||||
base.SetParameter(value, nameClassName);
|
||||
}
|
||||
}
|
||||
|
||||
private String className;
|
||||
|
||||
/// <summary>
|
||||
|
@ -82,12 +84,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public Uri ResourceUri
|
||||
{
|
||||
get { return resourceUri; }
|
||||
|
||||
set
|
||||
{
|
||||
this.resourceUri = value;
|
||||
base.SetParameter(value, nameResourceUri);
|
||||
}
|
||||
}
|
||||
|
||||
private Uri resourceUri;
|
||||
|
||||
/// <summary>
|
||||
|
@ -105,12 +109,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimClass CimClass
|
||||
{
|
||||
get { return cimClass; }
|
||||
|
||||
set
|
||||
{
|
||||
cimClass = value;
|
||||
base.SetParameter(value, nameCimClass);
|
||||
}
|
||||
}
|
||||
|
||||
private CimClass cimClass;
|
||||
|
||||
/// <summary>
|
||||
|
@ -126,12 +132,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public string Query
|
||||
{
|
||||
get { return query; }
|
||||
|
||||
set
|
||||
{
|
||||
query = value;
|
||||
base.SetParameter(value, nameQuery);
|
||||
}
|
||||
}
|
||||
|
||||
private string query;
|
||||
|
||||
/// <summary>
|
||||
|
@ -148,12 +156,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String QueryDialect
|
||||
{
|
||||
get { return queryDialect; }
|
||||
|
||||
set
|
||||
{
|
||||
queryDialect = value;
|
||||
base.SetParameter(value, nameQueryDialect);
|
||||
}
|
||||
}
|
||||
|
||||
private String queryDialect;
|
||||
|
||||
/// <summary>
|
||||
|
@ -173,6 +183,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimInstance InputObject
|
||||
{
|
||||
get { return cimInstance; }
|
||||
|
||||
set
|
||||
{
|
||||
cimInstance = value;
|
||||
|
@ -187,6 +198,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
get { return cimInstance; }
|
||||
}
|
||||
|
||||
private CimInstance cimInstance;
|
||||
|
||||
/// <summary>
|
||||
|
@ -218,6 +230,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] ComputerName
|
||||
{
|
||||
get { return computerName; }
|
||||
|
||||
set
|
||||
{
|
||||
DebugHelper.WriteLogEx();
|
||||
|
@ -225,6 +238,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameComputerName);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] computerName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -256,12 +270,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimSession[] CimSession
|
||||
{
|
||||
get { return cimSession; }
|
||||
|
||||
set
|
||||
{
|
||||
cimSession = value;
|
||||
base.SetParameter(value, nameCimSession);
|
||||
}
|
||||
}
|
||||
|
||||
private CimSession[] cimSession;
|
||||
|
||||
/// <summary>
|
||||
|
@ -274,8 +290,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public IDictionary Arguments
|
||||
{
|
||||
get { return arguments; }
|
||||
|
||||
set { arguments = value; }
|
||||
}
|
||||
|
||||
private IDictionary arguments;
|
||||
|
||||
/// <summary>
|
||||
|
@ -289,12 +307,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String MethodName
|
||||
{
|
||||
get { return methodName; }
|
||||
|
||||
set
|
||||
{
|
||||
methodName = value;
|
||||
base.SetParameter(value, nameMethodName);
|
||||
}
|
||||
}
|
||||
|
||||
private String methodName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -318,12 +338,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Namespace
|
||||
{
|
||||
get { return nameSpace; }
|
||||
|
||||
set
|
||||
{
|
||||
nameSpace = value;
|
||||
base.SetParameter(value, nameNamespace);
|
||||
}
|
||||
}
|
||||
|
||||
private String nameSpace;
|
||||
|
||||
/// <summary>
|
||||
|
@ -336,8 +358,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32 OperationTimeoutSec
|
||||
{
|
||||
get { return operationTimeout; }
|
||||
|
||||
set { operationTimeout = value; }
|
||||
}
|
||||
|
||||
private UInt32 operationTimeout;
|
||||
|
||||
#endregion
|
||||
|
@ -354,6 +378,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
cimInvokeMethod = CreateOperationAgent();
|
||||
}
|
||||
|
||||
this.CmdletOperation = new CmdletOperationInvokeCimMethod(this, cimInvokeMethod);
|
||||
this.AtBeginProcess = false;
|
||||
}//End BeginProcessing()
|
||||
|
|
|
@ -57,12 +57,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String ClassName
|
||||
{
|
||||
get { return className; }
|
||||
|
||||
set
|
||||
{
|
||||
className = value;
|
||||
base.SetParameter(value, nameClassName);
|
||||
}
|
||||
}
|
||||
|
||||
private String className;
|
||||
|
||||
/// <summary>
|
||||
|
@ -80,12 +82,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public Uri ResourceUri
|
||||
{
|
||||
get { return resourceUri; }
|
||||
|
||||
set
|
||||
{
|
||||
this.resourceUri = value;
|
||||
base.SetParameter(value, nameResourceUri);
|
||||
}
|
||||
}
|
||||
|
||||
private Uri resourceUri;
|
||||
|
||||
/// <summary>
|
||||
|
@ -113,12 +117,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] Key
|
||||
{
|
||||
get { return key; }
|
||||
|
||||
set
|
||||
{
|
||||
key = value;
|
||||
base.SetParameter(value, nameKey);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] key;
|
||||
|
||||
/// <summary>
|
||||
|
@ -138,12 +144,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimClass CimClass
|
||||
{
|
||||
get { return cimClass; }
|
||||
|
||||
set
|
||||
{
|
||||
cimClass = value;
|
||||
base.SetParameter(value, nameCimClass);
|
||||
}
|
||||
}
|
||||
|
||||
private CimClass cimClass;
|
||||
|
||||
/// <summary>
|
||||
|
@ -163,8 +171,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public IDictionary Property
|
||||
{
|
||||
get { return property; }
|
||||
|
||||
set { property = value; }
|
||||
}
|
||||
|
||||
private IDictionary property;
|
||||
|
||||
/// <summary>
|
||||
|
@ -187,12 +197,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Namespace
|
||||
{
|
||||
get { return nameSpace; }
|
||||
|
||||
set
|
||||
{
|
||||
nameSpace = value;
|
||||
base.SetParameter(value, nameNamespace);
|
||||
}
|
||||
}
|
||||
|
||||
private String nameSpace;
|
||||
|
||||
/// <summary>
|
||||
|
@ -205,8 +217,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32 OperationTimeoutSec
|
||||
{
|
||||
get { return operationTimeout; }
|
||||
|
||||
set { operationTimeout = value; }
|
||||
}
|
||||
|
||||
private UInt32 operationTimeout;
|
||||
|
||||
/// <summary>
|
||||
|
@ -231,12 +245,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimSession[] CimSession
|
||||
{
|
||||
get { return cimSession; }
|
||||
|
||||
set
|
||||
{
|
||||
cimSession = value;
|
||||
base.SetParameter(value, nameCimSession);
|
||||
}
|
||||
}
|
||||
|
||||
private CimSession[] cimSession;
|
||||
|
||||
/// <summary>
|
||||
|
@ -261,12 +277,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] ComputerName
|
||||
{
|
||||
get { return computerName; }
|
||||
|
||||
set
|
||||
{
|
||||
computerName = value;
|
||||
base.SetParameter(value, nameComputerName);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] computerName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -287,11 +305,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter ClientOnly
|
||||
{
|
||||
get { return clientOnly; }
|
||||
|
||||
set {
|
||||
clientOnly = value;
|
||||
base.SetParameter(value, nameClientOnly);
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter clientOnly;
|
||||
|
||||
#endregion
|
||||
|
@ -325,6 +345,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
conflictParameterName = @"CimSession";
|
||||
}
|
||||
|
||||
if (conflictParameterName != null)
|
||||
{
|
||||
ThrowConflictParameterWasSet(@"New-CimInstance", conflictParameterName, @"ClientOnly");
|
||||
|
@ -337,6 +358,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
cimNewCimInstance = CreateOperationAgent();
|
||||
}
|
||||
|
||||
cimNewCimInstance.NewCimInstance(this);
|
||||
cimNewCimInstance.ProcessActions(this.CmdletOperation);
|
||||
}//End ProcessRecord()
|
||||
|
|
|
@ -33,12 +33,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public PasswordAuthenticationMechanism Authentication
|
||||
{
|
||||
get { return authentication;}
|
||||
|
||||
set
|
||||
{
|
||||
authentication = value;
|
||||
authenticationSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
private PasswordAuthenticationMechanism authentication;
|
||||
private bool authenticationSet = false;
|
||||
|
||||
|
@ -52,8 +54,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public PSCredential Credential
|
||||
{
|
||||
get { return credential; }
|
||||
|
||||
set { credential = value; }
|
||||
}
|
||||
|
||||
private PSCredential credential;
|
||||
|
||||
/// <summary>
|
||||
|
@ -65,8 +69,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String CertificateThumbprint
|
||||
{
|
||||
get { return certificatethumbprint; }
|
||||
|
||||
set { certificatethumbprint = value; }
|
||||
}
|
||||
|
||||
private String certificatethumbprint;
|
||||
|
||||
/// <summary>
|
||||
|
@ -83,8 +89,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] ComputerName
|
||||
{
|
||||
get { return computername;}
|
||||
|
||||
set { computername = value; }
|
||||
}
|
||||
|
||||
private String[] computername;
|
||||
|
||||
/// <summary>
|
||||
|
@ -102,8 +110,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Name
|
||||
{
|
||||
get { return name;}
|
||||
|
||||
set { name = value; }
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
/// <summary>
|
||||
|
@ -121,12 +131,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32 OperationTimeoutSec
|
||||
{
|
||||
get { return operationTimeout; }
|
||||
|
||||
set
|
||||
{
|
||||
operationTimeout = value;
|
||||
operationTimeoutSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
private UInt32 operationTimeout;
|
||||
internal bool operationTimeoutSet = false;
|
||||
|
||||
|
@ -140,11 +152,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter SkipTestConnection
|
||||
{
|
||||
get { return skipTestConnection; }
|
||||
|
||||
set
|
||||
{
|
||||
skipTestConnection = value;
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter skipTestConnection;
|
||||
|
||||
/// <summary>
|
||||
|
@ -156,12 +170,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32 Port
|
||||
{
|
||||
get { return port; }
|
||||
|
||||
set
|
||||
{
|
||||
port = value;
|
||||
portSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
private UInt32 port;
|
||||
private bool portSet = false;
|
||||
|
||||
|
@ -182,8 +198,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public Microsoft.Management.Infrastructure.Options.CimSessionOptions SessionOption
|
||||
{
|
||||
get { return sessionOption; }
|
||||
|
||||
set { sessionOption = value; }
|
||||
}
|
||||
|
||||
private Microsoft.Management.Infrastructure.Options.CimSessionOptions sessionOption;
|
||||
|
||||
#endregion
|
||||
|
@ -244,6 +262,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
options = new DComSessionOptions(this.sessionOption as DComSessionOptions);
|
||||
}
|
||||
}
|
||||
|
||||
outputOptions = null;
|
||||
outputCredential = null;
|
||||
if (options != null)
|
||||
|
@ -258,11 +277,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
conflict = true;
|
||||
parameterName = @"CertificateThumbprint";
|
||||
}
|
||||
|
||||
if (portSet)
|
||||
{
|
||||
conflict = true;
|
||||
parameterName = @"Port";
|
||||
}
|
||||
|
||||
if (conflict)
|
||||
{
|
||||
ThrowConflictParameterWasSet(@"New-CimSession", parameterName, @"DComSessionOptions");
|
||||
|
@ -270,6 +291,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (portSet || (this.CertificateThumbprint != null))
|
||||
{
|
||||
WSManSessionOptions wsmanOptions = (options == null) ? new WSManSessionOptions() : options as WSManSessionOptions;
|
||||
|
@ -278,13 +300,16 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
wsmanOptions.DestinationPort = this.Port;
|
||||
portSet = false;
|
||||
}
|
||||
|
||||
if (this.CertificateThumbprint != null)
|
||||
{
|
||||
CimCredential credentials = new CimCredential(CertificateAuthenticationMechanism.Default, this.CertificateThumbprint);
|
||||
wsmanOptions.AddDestinationCredentials(credentials);
|
||||
}
|
||||
|
||||
options = wsmanOptions;
|
||||
}
|
||||
|
||||
if (this.operationTimeoutSet)
|
||||
{
|
||||
if (options != null)
|
||||
|
@ -292,6 +317,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
options.Timeout = TimeSpan.FromSeconds((double)this.OperationTimeoutSec);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.authenticationSet || (this.credential != null))
|
||||
{
|
||||
PasswordAuthenticationMechanism authentication = this.authenticationSet ? this.Authentication : PasswordAuthenticationMechanism.Default;
|
||||
|
@ -299,6 +325,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.authenticationSet = false;
|
||||
}
|
||||
|
||||
CimCredential credentials = CreateCimCredentials(this.Credential, authentication, @"New-CimSession", @"Authentication");
|
||||
if (credentials == null)
|
||||
{
|
||||
|
@ -313,6 +340,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
options.AddDestinationCredentials(credentials);
|
||||
}
|
||||
}
|
||||
|
||||
DebugHelper.WriteLogEx("Set outputOptions: {0}", 1, outputOptions);
|
||||
outputOptions = options;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter NoEncryption
|
||||
{
|
||||
get { return noEncryption; }
|
||||
|
||||
set
|
||||
{
|
||||
noEncryption = value;
|
||||
|
@ -69,6 +70,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameNoEncryption);
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter noEncryption;
|
||||
private bool noEncryptionSet = false;
|
||||
|
||||
|
@ -81,6 +83,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter SkipCACheck
|
||||
{
|
||||
get { return skipCACheck; }
|
||||
|
||||
set
|
||||
{
|
||||
skipCACheck = value;
|
||||
|
@ -88,6 +91,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameSkipCACheck);
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter skipCACheck;
|
||||
private bool skipCACheckSet = false;
|
||||
|
||||
|
@ -100,6 +104,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter SkipCNCheck
|
||||
{
|
||||
get { return skipCNCheck; }
|
||||
|
||||
set
|
||||
{
|
||||
skipCNCheck = value;
|
||||
|
@ -107,6 +112,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameSkipCNCheck);
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter skipCNCheck;
|
||||
private bool skipCNCheckSet = false;
|
||||
|
||||
|
@ -119,6 +125,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter SkipRevocationCheck
|
||||
{
|
||||
get { return skipRevocationCheck; }
|
||||
|
||||
set
|
||||
{
|
||||
skipRevocationCheck = value;
|
||||
|
@ -126,6 +133,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameSkipRevocationCheck);
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter skipRevocationCheck;
|
||||
private bool skipRevocationCheckSet = false;
|
||||
|
||||
|
@ -138,6 +146,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter EncodePortInServicePrincipalName
|
||||
{
|
||||
get { return encodeportinserviceprincipalname; }
|
||||
|
||||
set
|
||||
{
|
||||
encodeportinserviceprincipalname = value;
|
||||
|
@ -145,6 +154,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameEncodePortInServicePrincipalName);
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter encodeportinserviceprincipalname;
|
||||
private bool encodeportinserviceprincipalnameSet = false;
|
||||
|
||||
|
@ -159,6 +169,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public PacketEncoding Encoding
|
||||
{
|
||||
get { return encoding; }
|
||||
|
||||
set
|
||||
{
|
||||
encoding = value;
|
||||
|
@ -166,6 +177,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameEncoding);
|
||||
}
|
||||
}
|
||||
|
||||
private PacketEncoding encoding;
|
||||
private bool encodingSet = false;
|
||||
|
||||
|
@ -179,12 +191,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public Uri HttpPrefix
|
||||
{
|
||||
get { return httpprefix; }
|
||||
|
||||
set
|
||||
{
|
||||
httpprefix = value;
|
||||
base.SetParameter(value, nameHttpPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
private Uri httpprefix;
|
||||
|
||||
/// <summary>
|
||||
|
@ -196,6 +210,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32 MaxEnvelopeSizeKB
|
||||
{
|
||||
get { return maxenvelopesizekb; }
|
||||
|
||||
set
|
||||
{
|
||||
maxenvelopesizekb = value;
|
||||
|
@ -203,6 +218,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameMaxEnvelopeSizeKB);
|
||||
}
|
||||
}
|
||||
|
||||
private UInt32 maxenvelopesizekb;
|
||||
private bool maxenvelopesizekbSet = false;
|
||||
|
||||
|
@ -215,6 +231,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public PasswordAuthenticationMechanism ProxyAuthentication
|
||||
{
|
||||
get { return proxyAuthentication; }
|
||||
|
||||
set
|
||||
{
|
||||
proxyAuthentication = value;
|
||||
|
@ -222,6 +239,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameProxyAuthentication);
|
||||
}
|
||||
}
|
||||
|
||||
private PasswordAuthenticationMechanism proxyAuthentication;
|
||||
private bool proxyauthenticationSet = false;
|
||||
|
||||
|
@ -233,12 +251,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String ProxyCertificateThumbprint
|
||||
{
|
||||
get { return proxycertificatethumbprint; }
|
||||
|
||||
set
|
||||
{
|
||||
proxycertificatethumbprint = value;
|
||||
base.SetParameter(value, nameProxyCertificateThumbprint);
|
||||
}
|
||||
}
|
||||
|
||||
private String proxycertificatethumbprint;
|
||||
|
||||
/// <summary>
|
||||
|
@ -250,12 +270,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public PSCredential ProxyCredential
|
||||
{
|
||||
get { return proxycredential; }
|
||||
|
||||
set
|
||||
{
|
||||
proxycredential = value;
|
||||
base.SetParameter(value, nameProxyCredential);
|
||||
}
|
||||
}
|
||||
|
||||
private PSCredential proxycredential;
|
||||
|
||||
/// <summary>
|
||||
|
@ -268,6 +290,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public ProxyType ProxyType
|
||||
{
|
||||
get { return proxytype; }
|
||||
|
||||
set
|
||||
{
|
||||
proxytype = value;
|
||||
|
@ -275,6 +298,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameProxyType);
|
||||
}
|
||||
}
|
||||
|
||||
private ProxyType proxytype;
|
||||
private bool proxytypeSet = false;
|
||||
|
||||
|
@ -287,6 +311,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter UseSsl
|
||||
{
|
||||
get { return usessl; }
|
||||
|
||||
set
|
||||
{
|
||||
usessl = value;
|
||||
|
@ -294,6 +319,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameUseSsl);
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter usessl;
|
||||
private bool usesslSet = false;
|
||||
|
||||
|
@ -306,6 +332,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public ImpersonationType Impersonation
|
||||
{
|
||||
get { return impersonation; }
|
||||
|
||||
set
|
||||
{
|
||||
impersonation = value;
|
||||
|
@ -313,6 +340,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, nameImpersonation);
|
||||
}
|
||||
}
|
||||
|
||||
private ImpersonationType impersonation;
|
||||
private bool impersonationSet = false;
|
||||
|
||||
|
@ -325,6 +353,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter PacketIntegrity
|
||||
{
|
||||
get { return packetintegrity; }
|
||||
|
||||
set
|
||||
{
|
||||
packetintegrity = value;
|
||||
|
@ -332,6 +361,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, namePacketIntegrity);
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter packetintegrity;
|
||||
private bool packetintegritySet = false;
|
||||
|
||||
|
@ -344,6 +374,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public SwitchParameter PacketPrivacy
|
||||
{
|
||||
get { return packetprivacy; }
|
||||
|
||||
set
|
||||
{
|
||||
packetprivacy = value;
|
||||
|
@ -351,6 +382,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
base.SetParameter(value, namePacketPrivacy);
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter packetprivacy;
|
||||
private bool packetprivacySet = false;
|
||||
|
||||
|
@ -366,12 +398,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public ProtocolType Protocol
|
||||
{
|
||||
get { return protocol; }
|
||||
|
||||
set
|
||||
{
|
||||
protocol = value;
|
||||
base.SetParameter(value, nameProtocol);
|
||||
}
|
||||
}
|
||||
|
||||
private ProtocolType protocol;
|
||||
|
||||
/// <summary>
|
||||
|
@ -382,8 +416,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CultureInfo UICulture
|
||||
{
|
||||
get { return uiculture; }
|
||||
|
||||
set { uiculture = value; }
|
||||
}
|
||||
|
||||
private CultureInfo uiculture;
|
||||
|
||||
/// <summary>
|
||||
|
@ -394,8 +430,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CultureInfo Culture
|
||||
{
|
||||
get { return culture; }
|
||||
|
||||
set { culture = value; }
|
||||
}
|
||||
|
||||
private CultureInfo culture;
|
||||
|
||||
#endregion
|
||||
|
@ -424,11 +462,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
options = CreateWSMANSessionOptions();
|
||||
}
|
||||
|
||||
break;
|
||||
case DcomParameterSet:
|
||||
{
|
||||
options = CreateDComSessionOptions();
|
||||
}
|
||||
|
||||
break;
|
||||
case ProtocolNameParameterSet:
|
||||
switch (Protocol)
|
||||
|
@ -441,20 +481,24 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
options = CreateWSMANSessionOptions();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (options != null)
|
||||
{
|
||||
if (this.Culture != null)
|
||||
{
|
||||
options.Culture = this.Culture;
|
||||
}
|
||||
|
||||
if (this.UICulture != null)
|
||||
{
|
||||
options.UICulture = this.UICulture;
|
||||
}
|
||||
|
||||
this.WriteObject(options);
|
||||
}
|
||||
}//End ProcessRecord()
|
||||
|
@ -485,6 +529,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
dcomoptions.Impersonation = ImpersonationType.Impersonate;
|
||||
}
|
||||
|
||||
if (this.packetintegritySet)
|
||||
{
|
||||
dcomoptions.PacketIntegrity = this.packetintegrity;
|
||||
|
@ -494,6 +539,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
dcomoptions.PacketIntegrity = true;
|
||||
}
|
||||
|
||||
if (this.packetprivacySet)
|
||||
{
|
||||
dcomoptions.PacketPrivacy = this.PacketPrivacy;
|
||||
|
@ -503,6 +549,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
dcomoptions.PacketPrivacy = true;
|
||||
}
|
||||
|
||||
return dcomoptions;
|
||||
}
|
||||
|
||||
|
@ -522,6 +569,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
wsmanoptions.NoEncryption = false;
|
||||
}
|
||||
|
||||
if (this.skipCACheckSet)
|
||||
{
|
||||
wsmanoptions.CertCACheck = false;
|
||||
|
@ -531,6 +579,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
wsmanoptions.CertCACheck = true;
|
||||
}
|
||||
|
||||
if (this.skipCNCheckSet)
|
||||
{
|
||||
wsmanoptions.CertCNCheck = false;
|
||||
|
@ -540,6 +589,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
wsmanoptions.CertCNCheck = true;
|
||||
}
|
||||
|
||||
if (this.skipRevocationCheckSet)
|
||||
{
|
||||
wsmanoptions.CertRevocationCheck = false;
|
||||
|
@ -549,6 +599,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
wsmanoptions.CertRevocationCheck = true;
|
||||
}
|
||||
|
||||
if (this.encodeportinserviceprincipalnameSet)
|
||||
{
|
||||
wsmanoptions.EncodePortInServicePrincipalName = this.EncodePortInServicePrincipalName;
|
||||
|
@ -558,6 +609,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
wsmanoptions.EncodePortInServicePrincipalName = false;
|
||||
}
|
||||
|
||||
if (this.encodingSet)
|
||||
{
|
||||
wsmanoptions.PacketEncoding = this.Encoding;
|
||||
|
@ -566,10 +618,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
wsmanoptions.PacketEncoding = PacketEncoding.Utf8;
|
||||
}
|
||||
|
||||
if (this.HttpPrefix != null)
|
||||
{
|
||||
wsmanoptions.HttpUrlPrefix = this.HttpPrefix;
|
||||
}
|
||||
|
||||
if (this.maxenvelopesizekbSet)
|
||||
{
|
||||
wsmanoptions.MaxEnvelopeSize = this.MaxEnvelopeSizeKB;
|
||||
|
@ -578,11 +632,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
wsmanoptions.MaxEnvelopeSize = 0;
|
||||
}
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(this.ProxyCertificateThumbprint))
|
||||
{
|
||||
CimCredential credentials = new CimCredential(CertificateAuthenticationMechanism.Default, this.ProxyCertificateThumbprint);
|
||||
wsmanoptions.AddProxyCredentials(credentials);
|
||||
}
|
||||
|
||||
if (this.proxyauthenticationSet)
|
||||
{
|
||||
this.proxyauthenticationSet = false;
|
||||
|
@ -602,6 +658,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.proxytypeSet)
|
||||
{
|
||||
wsmanoptions.ProxyType = this.ProxyType;
|
||||
|
@ -611,6 +668,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
wsmanoptions.ProxyType = Options.ProxyType.WinHttp;
|
||||
}
|
||||
|
||||
if (this.usesslSet)
|
||||
{
|
||||
wsmanoptions.UseSsl = this.UseSsl;
|
||||
|
@ -620,6 +678,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
wsmanoptions.UseSsl = false;
|
||||
}
|
||||
|
||||
wsmanoptions.DestinationPort = 0;
|
||||
return wsmanoptions;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Namespace
|
||||
{
|
||||
get { return nameSpace; }
|
||||
|
||||
set { nameSpace = value; }
|
||||
}
|
||||
|
||||
private String nameSpace;
|
||||
|
||||
/// <summary>
|
||||
|
@ -55,12 +57,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String ClassName
|
||||
{
|
||||
get { return className; }
|
||||
|
||||
set
|
||||
{
|
||||
className = value;
|
||||
this.SetParameter(value, nameClassName);
|
||||
}
|
||||
}
|
||||
|
||||
private String className;
|
||||
|
||||
/// <summary>
|
||||
|
@ -78,12 +82,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Query
|
||||
{
|
||||
get { return query; }
|
||||
|
||||
set
|
||||
{
|
||||
query = value;
|
||||
this.SetParameter(value, nameQuery);
|
||||
}
|
||||
}
|
||||
|
||||
private String query;
|
||||
|
||||
/// <summary>
|
||||
|
@ -98,12 +104,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String QueryDialect
|
||||
{
|
||||
get { return queryDialect; }
|
||||
|
||||
set
|
||||
{
|
||||
queryDialect = value;
|
||||
this.SetParameter(value, nameQueryDialect);
|
||||
}
|
||||
}
|
||||
|
||||
private String queryDialect;
|
||||
|
||||
/// <summary>
|
||||
|
@ -116,8 +124,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32 OperationTimeoutSec
|
||||
{
|
||||
get { return operationTimeout; }
|
||||
|
||||
set { operationTimeout = value; }
|
||||
}
|
||||
|
||||
private UInt32 operationTimeout;
|
||||
|
||||
/// <summary>
|
||||
|
@ -133,12 +143,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimSession CimSession
|
||||
{
|
||||
get { return cimSession; }
|
||||
|
||||
set
|
||||
{
|
||||
cimSession = value;
|
||||
this.SetParameter(value, nameCimSession);
|
||||
}
|
||||
}
|
||||
|
||||
private CimSession cimSession;
|
||||
|
||||
/// <summary>
|
||||
|
@ -152,12 +164,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String ComputerName
|
||||
{
|
||||
get { return computername; }
|
||||
|
||||
set
|
||||
{
|
||||
computername = value;
|
||||
this.SetParameter(value, nameComputerName);
|
||||
}
|
||||
}
|
||||
|
||||
private String computername;
|
||||
|
||||
#endregion
|
||||
|
@ -177,6 +191,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.parameterBinder.reset();
|
||||
}
|
||||
|
||||
string tempQueryExpression = string.Empty;
|
||||
switch (parameterSetName)
|
||||
{
|
||||
|
@ -191,6 +206,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
tempQueryExpression = String.Format(CultureInfo.CurrentCulture, "Select * from {0}", this.ClassName);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (parameterSetName)
|
||||
{
|
||||
case CimBaseCommand.QueryExpressionSessionSet:
|
||||
|
@ -198,18 +214,22 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
watcher = new CimIndicationWatcher(this.CimSession, this.Namespace, this.QueryDialect, tempQueryExpression, this.OperationTimeoutSec);
|
||||
}
|
||||
|
||||
break;
|
||||
case CimBaseCommand.QueryExpressionComputerSet:
|
||||
case CimBaseCommand.ClassNameComputerSet:
|
||||
{
|
||||
watcher = new CimIndicationWatcher(this.ComputerName, this.Namespace, this.QueryDialect, tempQueryExpression, this.OperationTimeoutSec);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (watcher != null)
|
||||
{
|
||||
watcher.SetCmdlet(this);
|
||||
}
|
||||
|
||||
return watcher;
|
||||
}
|
||||
|
||||
|
@ -284,6 +304,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.parameterBinder.SetParameter(parameterName, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,12 +53,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimSession[] CimSession
|
||||
{
|
||||
get { return cimSession; }
|
||||
|
||||
set
|
||||
{
|
||||
cimSession = value;
|
||||
base.SetParameter(value, nameCimSession);
|
||||
}
|
||||
}
|
||||
|
||||
private CimSession[] cimSession;
|
||||
|
||||
/// <summary>
|
||||
|
@ -74,12 +76,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public Uri ResourceUri
|
||||
{
|
||||
get { return resourceUri; }
|
||||
|
||||
set
|
||||
{
|
||||
this.resourceUri = value;
|
||||
base.SetParameter(value, nameResourceUri);
|
||||
}
|
||||
}
|
||||
|
||||
private Uri resourceUri;
|
||||
|
||||
/// <summary>
|
||||
|
@ -95,12 +99,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] ComputerName
|
||||
{
|
||||
get { return computername; }
|
||||
|
||||
set
|
||||
{
|
||||
computername = value;
|
||||
base.SetParameter(value, nameComputerName);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] computername;
|
||||
|
||||
/// <summary>
|
||||
|
@ -118,12 +124,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Namespace
|
||||
{
|
||||
get { return nameSpace; }
|
||||
|
||||
set
|
||||
{
|
||||
nameSpace = value;
|
||||
base.SetParameter(value, nameNamespace);
|
||||
}
|
||||
}
|
||||
|
||||
private String nameSpace;
|
||||
|
||||
/// <summary>
|
||||
|
@ -136,8 +144,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32 OperationTimeoutSec
|
||||
{
|
||||
get { return operationTimeout;}
|
||||
|
||||
set { operationTimeout = value; }
|
||||
}
|
||||
|
||||
private UInt32 operationTimeout;
|
||||
|
||||
/// <summary>
|
||||
|
@ -158,6 +168,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimInstance InputObject
|
||||
{
|
||||
get { return cimInstance; }
|
||||
|
||||
set
|
||||
{
|
||||
cimInstance = value;
|
||||
|
@ -172,6 +183,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
get { return cimInstance; }
|
||||
}
|
||||
|
||||
private CimInstance cimInstance;
|
||||
|
||||
/// <summary>
|
||||
|
@ -190,12 +202,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Query
|
||||
{
|
||||
get { return query;}
|
||||
|
||||
set
|
||||
{
|
||||
query = value;
|
||||
base.SetParameter(value, nameQuery);
|
||||
}
|
||||
}
|
||||
|
||||
private String query;
|
||||
|
||||
/// <summary>
|
||||
|
@ -210,12 +224,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String QueryDialect
|
||||
{
|
||||
get { return querydialect;}
|
||||
|
||||
set
|
||||
{
|
||||
querydialect = value;
|
||||
base.SetParameter(value, nameQueryDialect);
|
||||
}
|
||||
}
|
||||
|
||||
private String querydialect;
|
||||
|
||||
#endregion
|
||||
|
@ -232,6 +248,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
cimRemoveInstance = CreateOperationAgent();
|
||||
}
|
||||
|
||||
this.CmdletOperation = new CmdletOperationRemoveCimInstance(this, cimRemoveInstance);
|
||||
this.AtBeginProcess = false;
|
||||
}//End BeginProcessing()
|
||||
|
|
|
@ -55,12 +55,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimSession[] CimSession
|
||||
{
|
||||
get { return cimsession;}
|
||||
|
||||
set
|
||||
{
|
||||
cimsession = value;
|
||||
base.SetParameter(value, nameCimSession);
|
||||
}
|
||||
}
|
||||
|
||||
private CimSession[] cimsession;
|
||||
|
||||
/// <summary>
|
||||
|
@ -80,12 +82,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] ComputerName
|
||||
{
|
||||
get { return computername; }
|
||||
|
||||
set
|
||||
{
|
||||
computername = value;
|
||||
base.SetParameter(value, nameComputerName);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] computername;
|
||||
|
||||
/// <summary>
|
||||
|
@ -101,12 +105,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32[] Id
|
||||
{
|
||||
get { return id;}
|
||||
|
||||
set
|
||||
{
|
||||
id = value;
|
||||
base.SetParameter(value, nameId);
|
||||
}
|
||||
}
|
||||
|
||||
private UInt32[] id;
|
||||
|
||||
/// <summary>
|
||||
|
@ -122,12 +128,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public Guid[] InstanceId
|
||||
{
|
||||
get { return instanceid;}
|
||||
|
||||
set
|
||||
{
|
||||
instanceid = value;
|
||||
base.SetParameter(value, nameInstanceId);
|
||||
}
|
||||
}
|
||||
|
||||
private Guid[] instanceid;
|
||||
|
||||
/// <summary>
|
||||
|
@ -143,12 +151,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] Name
|
||||
{
|
||||
get { return name;}
|
||||
|
||||
set
|
||||
{
|
||||
name = value;
|
||||
base.SetParameter(value, nameName);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] name;
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -54,12 +54,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimSession[] CimSession
|
||||
{
|
||||
get { return cimSession; }
|
||||
|
||||
set
|
||||
{
|
||||
cimSession = value;
|
||||
base.SetParameter(value, nameCimSession);
|
||||
}
|
||||
}
|
||||
|
||||
private CimSession[] cimSession;
|
||||
|
||||
/// <summary>
|
||||
|
@ -75,12 +77,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String[] ComputerName
|
||||
{
|
||||
get { return computername; }
|
||||
|
||||
set
|
||||
{
|
||||
computername = value;
|
||||
base.SetParameter(value, nameComputerName);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] computername;
|
||||
|
||||
/// <summary>
|
||||
|
@ -96,12 +100,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public Uri ResourceUri
|
||||
{
|
||||
get { return resourceUri; }
|
||||
|
||||
set
|
||||
{
|
||||
this.resourceUri = value;
|
||||
base.SetParameter(value, nameResourceUri);
|
||||
}
|
||||
}
|
||||
|
||||
private Uri resourceUri;
|
||||
|
||||
/// <summary>
|
||||
|
@ -115,12 +121,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Namespace
|
||||
{
|
||||
get { return nameSpace; }
|
||||
|
||||
set
|
||||
{
|
||||
nameSpace = value;
|
||||
base.SetParameter(value, nameNamespace);
|
||||
}
|
||||
}
|
||||
|
||||
private String nameSpace;
|
||||
|
||||
/// <summary>
|
||||
|
@ -133,8 +141,10 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public UInt32 OperationTimeoutSec
|
||||
{
|
||||
get { return operationTimeout; }
|
||||
|
||||
set { operationTimeout = value; }
|
||||
}
|
||||
|
||||
private UInt32 operationTimeout;
|
||||
|
||||
/// <summary>
|
||||
|
@ -155,6 +165,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public CimInstance InputObject
|
||||
{
|
||||
get { return cimInstance; }
|
||||
|
||||
set
|
||||
{
|
||||
cimInstance = value;
|
||||
|
@ -169,6 +180,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
get { return cimInstance; }
|
||||
}
|
||||
|
||||
private CimInstance cimInstance;
|
||||
|
||||
/// <summary>
|
||||
|
@ -187,12 +199,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String Query
|
||||
{
|
||||
get { return query; }
|
||||
|
||||
set
|
||||
{
|
||||
query = value;
|
||||
base.SetParameter(value, nameQuery);
|
||||
}
|
||||
}
|
||||
|
||||
private String query;
|
||||
|
||||
/// <summary>
|
||||
|
@ -207,12 +221,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public String QueryDialect
|
||||
{
|
||||
get { return querydialect; }
|
||||
|
||||
set
|
||||
{
|
||||
querydialect = value;
|
||||
base.SetParameter(value, nameQueryDialect);
|
||||
}
|
||||
}
|
||||
|
||||
private String querydialect;
|
||||
|
||||
/// <summary>
|
||||
|
@ -240,12 +256,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public IDictionary Property
|
||||
{
|
||||
get { return property; }
|
||||
|
||||
set
|
||||
{
|
||||
property = value;
|
||||
base.SetParameter(value, nameProperty);
|
||||
}
|
||||
}
|
||||
|
||||
private IDictionary property;
|
||||
|
||||
/// <summary>
|
||||
|
@ -264,11 +282,13 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
this.passThru = value;
|
||||
}
|
||||
|
||||
get
|
||||
{
|
||||
return this.passThru;
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter passThru;
|
||||
|
||||
#endregion
|
||||
|
@ -285,6 +305,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
cimSetCimInstance = CreateOperationAgent();
|
||||
}
|
||||
|
||||
this.CmdletOperation = new CmdletOperationSetCimInstance(this, cimSetCimInstance);
|
||||
this.AtBeginProcess = false;
|
||||
}//End BeginProcessing()
|
||||
|
|
|
@ -144,6 +144,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
internal static bool GenerateLog
|
||||
{
|
||||
get { return generateLog; }
|
||||
|
||||
set { generateLog = value; }
|
||||
}
|
||||
|
||||
|
@ -159,6 +160,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
internal static bool GenerateVerboseMessage
|
||||
{
|
||||
get { return generateVerboseMessage; }
|
||||
|
||||
set { generateVerboseMessage = value; }
|
||||
}
|
||||
|
||||
|
@ -222,6 +224,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
//{
|
||||
// return string.Format(CultureInfo.CurrentUICulture, "{0}:", frame.GetMethod());
|
||||
//}
|
||||
|
||||
return string.Format(CultureInfo.CurrentUICulture, "{0}::{1} ",
|
||||
frame.GetMethod().DeclaringType.Name,
|
||||
frame.GetMethod().Name);
|
||||
|
@ -340,10 +343,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
indent = 0;
|
||||
}
|
||||
|
||||
if (indent > 5)
|
||||
{
|
||||
indent = 5;
|
||||
}
|
||||
|
||||
string sourceInformation = string.Empty;
|
||||
if (depth != -1)
|
||||
{
|
||||
|
@ -356,6 +361,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
DateTime.Now.Second,
|
||||
GetSourceCodeInformation(true, depth));
|
||||
}
|
||||
|
||||
lock (logLock)
|
||||
{
|
||||
using (FileStream fs = new FileStream(logFile,FileMode.OpenOrCreate))
|
||||
|
@ -425,6 +431,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
return trimed;
|
||||
}
|
||||
}
|
||||
|
||||
DebugHelper.WriteLogEx("An invalid name: {0}={1}", 0, parameterName, value);
|
||||
throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, Strings.InvalidParameterValue, value, parameterName));
|
||||
}
|
||||
|
@ -448,9 +455,11 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ValidationHelper.ValidateArgumentIsValidName(parameterName, propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,6 +132,7 @@ namespace Microsoft.PowerShell.Commands.Diagnostics.Common
|
|||
{
|
||||
FreeLibrary(moduleHandle);
|
||||
}
|
||||
|
||||
return formatError;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
return _oldestRecord;
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime _oldestRecord = DateTime.MinValue;
|
||||
|
||||
public DateTime NewestRecord
|
||||
|
@ -39,6 +40,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
return _newestRecord;
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime _newestRecord = DateTime.MaxValue;
|
||||
|
||||
public UInt32 SampleCount
|
||||
|
@ -48,6 +50,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
return _sampleCount;
|
||||
}
|
||||
}
|
||||
|
||||
private UInt32 _sampleCount = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,85 +49,109 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
public string Path
|
||||
{
|
||||
get { return _path; }
|
||||
|
||||
set { _path = value; }
|
||||
}
|
||||
|
||||
private string _path = string.Empty;
|
||||
|
||||
public string InstanceName
|
||||
{
|
||||
get { return _instanceName; }
|
||||
|
||||
set { _instanceName = value; }
|
||||
}
|
||||
|
||||
private string _instanceName = string.Empty;
|
||||
|
||||
public double CookedValue
|
||||
{
|
||||
get { return _cookedValue; }
|
||||
|
||||
set { _cookedValue = value; }
|
||||
}
|
||||
|
||||
private double _cookedValue = 0;
|
||||
|
||||
public UInt64 RawValue
|
||||
{
|
||||
get { return _rawValue; }
|
||||
|
||||
set { _rawValue = value; }
|
||||
}
|
||||
|
||||
private UInt64 _rawValue = 0;
|
||||
|
||||
public UInt64 SecondValue
|
||||
{
|
||||
get { return _secondValue; }
|
||||
|
||||
set { _secondValue = value; }
|
||||
}
|
||||
|
||||
private UInt64 _secondValue = 0;
|
||||
|
||||
public uint MultipleCount
|
||||
{
|
||||
get { return _multiCount; }
|
||||
|
||||
set { _multiCount = value; }
|
||||
}
|
||||
|
||||
private uint _multiCount = 0;
|
||||
|
||||
public PerformanceCounterType CounterType
|
||||
{
|
||||
get { return _counterType; }
|
||||
|
||||
set { _counterType = value; }
|
||||
}
|
||||
|
||||
private PerformanceCounterType _counterType = 0;
|
||||
|
||||
public DateTime Timestamp
|
||||
{
|
||||
get { return _timeStamp; }
|
||||
|
||||
set { _timeStamp = value; }
|
||||
}
|
||||
|
||||
private DateTime _timeStamp = DateTime.MinValue;
|
||||
|
||||
public UInt64 Timestamp100NSec
|
||||
{
|
||||
get { return _timeStamp100nSec; }
|
||||
|
||||
set { _timeStamp100nSec = value; }
|
||||
}
|
||||
|
||||
private UInt64 _timeStamp100nSec = 0;
|
||||
|
||||
public UInt32 Status
|
||||
{
|
||||
get { return _status; }
|
||||
|
||||
set { _status = value; }
|
||||
}
|
||||
|
||||
private UInt32 _status = 0;
|
||||
|
||||
public UInt32 DefaultScale
|
||||
{
|
||||
get { return _defaultScale; }
|
||||
|
||||
set { _defaultScale = value; }
|
||||
}
|
||||
|
||||
private UInt32 _defaultScale = 0;
|
||||
|
||||
public UInt64 TimeBase
|
||||
{
|
||||
get { return _timeBase; }
|
||||
|
||||
set { _timeBase = value; }
|
||||
}
|
||||
|
||||
private UInt64 _timeBase = 0;
|
||||
}
|
||||
|
||||
|
@ -149,8 +173,10 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
public DateTime Timestamp
|
||||
{
|
||||
get { return _timeStamp; }
|
||||
|
||||
set { _timeStamp = value; }
|
||||
}
|
||||
|
||||
private DateTime _timeStamp = DateTime.MinValue;
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays",
|
||||
|
@ -160,8 +186,10 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
public PerformanceCounterSample[] CounterSamples
|
||||
{
|
||||
get { return _counterSamples; }
|
||||
|
||||
set { _counterSamples = value; }
|
||||
}
|
||||
|
||||
private PerformanceCounterSample[] _counterSamples = null;
|
||||
|
||||
private ResourceManager _resourceMgr = null;
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
_machineName = @"\\" + _machineName;
|
||||
}
|
||||
}
|
||||
|
||||
_counterSetType = categoryType;
|
||||
_description = setHelp;
|
||||
_counterInstanceMapping = counterInstanceMapping;
|
||||
|
@ -43,6 +44,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
return _counterSetName;
|
||||
}
|
||||
}
|
||||
|
||||
private string _counterSetName = string.Empty;
|
||||
|
||||
public string MachineName
|
||||
|
@ -52,6 +54,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
return _machineName;
|
||||
}
|
||||
}
|
||||
|
||||
private string _machineName = ".";
|
||||
|
||||
public PerformanceCounterCategoryType CounterSetType
|
||||
|
@ -61,6 +64,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
return _counterSetType;
|
||||
}
|
||||
}
|
||||
|
||||
private PerformanceCounterCategoryType _counterSetType;
|
||||
|
||||
public string Description
|
||||
|
@ -70,6 +74,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
return _description;
|
||||
}
|
||||
}
|
||||
|
||||
private string _description = string.Empty;
|
||||
|
||||
internal Dictionary<string, string[]> CounterInstanceMapping
|
||||
|
@ -79,6 +84,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
return _counterInstanceMapping;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, string[]> _counterInstanceMapping;
|
||||
|
||||
public StringCollection Paths
|
||||
|
@ -101,6 +107,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
("\\" + _counterSetName + "\\" + counterName) :
|
||||
(_machineName + "\\" + _counterSetName + "\\" + counterName);
|
||||
}
|
||||
|
||||
retColl.Add(path);
|
||||
}
|
||||
|
||||
|
@ -123,6 +130,7 @@ namespace Microsoft.PowerShell.Commands.GetCounter
|
|||
retColl.Add(path);
|
||||
}
|
||||
}
|
||||
|
||||
return retColl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,8 +46,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string Path
|
||||
{
|
||||
get { return _path; }
|
||||
|
||||
set { _path = value; }
|
||||
}
|
||||
|
||||
private string _path;
|
||||
private string _resolvedPath;
|
||||
|
||||
|
@ -65,8 +67,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string FileFormat
|
||||
{
|
||||
get { return _format; }
|
||||
|
||||
set { _format = value; }
|
||||
}
|
||||
|
||||
private string _format = "blg";
|
||||
|
||||
//
|
||||
|
@ -78,8 +82,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public UInt32 MaxSize
|
||||
{
|
||||
get { return _maxSize; }
|
||||
|
||||
set { _maxSize = value; }
|
||||
}
|
||||
|
||||
private UInt32 _maxSize = 0;
|
||||
|
||||
//
|
||||
|
@ -98,8 +104,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public PerformanceCounterSampleSet[] InputObject
|
||||
{
|
||||
get { return _counterSampleSets; }
|
||||
|
||||
set { _counterSampleSets = value; }
|
||||
}
|
||||
|
||||
private PerformanceCounterSampleSet[] _counterSampleSets = new PerformanceCounterSampleSet[0];
|
||||
|
||||
//
|
||||
|
@ -110,8 +118,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter Force
|
||||
{
|
||||
get { return _force; }
|
||||
|
||||
set { _force = value; }
|
||||
}
|
||||
|
||||
private SwitchParameter _force;
|
||||
|
||||
//
|
||||
|
@ -122,8 +132,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter Circular
|
||||
{
|
||||
get { return _circular; }
|
||||
|
||||
set { _circular = value; }
|
||||
}
|
||||
|
||||
private SwitchParameter _circular;
|
||||
|
||||
private ResourceManager _resourceMgr = null;
|
||||
|
@ -236,6 +248,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
res = _pdhHelper.AddRelogCountersPreservingPaths(_counterSampleSets[0]);
|
||||
}
|
||||
|
||||
if (res != 0)
|
||||
{
|
||||
ReportPdhError(res, true);
|
||||
|
@ -287,6 +300,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ReportPdhError(res, true);
|
||||
}
|
||||
}
|
||||
|
||||
res = _pdhHelper.WriteRelogSample(set.Timestamp);
|
||||
if (res != 0)
|
||||
{
|
||||
|
@ -353,6 +367,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("CounterApiError"), res);
|
||||
}
|
||||
|
||||
Exception exc = new Exception(msg);
|
||||
if (bTerminate)
|
||||
{
|
||||
|
|
|
@ -52,8 +52,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] ListSet
|
||||
{
|
||||
get { return _listSet; }
|
||||
|
||||
set { _listSet = value; }
|
||||
}
|
||||
|
||||
private string[] _listSet = { "*" };
|
||||
|
||||
//
|
||||
|
@ -73,12 +75,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Counter
|
||||
{
|
||||
get { return _counter; }
|
||||
|
||||
set
|
||||
{
|
||||
_counter = value;
|
||||
_defaultCounters = false;
|
||||
}
|
||||
}
|
||||
|
||||
private string[] _counter = {@"\network interface(*)\bytes total/sec",
|
||||
@"\processor(_total)\% processor time",
|
||||
@"\memory\% committed bytes in use",
|
||||
|
@ -102,8 +106,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public int SampleInterval
|
||||
{
|
||||
get { return _sampleInterval; }
|
||||
|
||||
set { _sampleInterval = value; }
|
||||
}
|
||||
|
||||
private int _sampleInterval = 1;
|
||||
|
||||
//
|
||||
|
@ -119,12 +125,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public Int64 MaxSamples
|
||||
{
|
||||
get { return _maxSamples; }
|
||||
|
||||
set
|
||||
{
|
||||
_maxSamples = value;
|
||||
_maxSamplesSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private Int64 _maxSamples = 1;
|
||||
private bool _maxSamplesSpecified = false;
|
||||
|
||||
|
@ -135,8 +143,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter Continuous
|
||||
{
|
||||
get { return _continuous; }
|
||||
|
||||
set { _continuous = value; }
|
||||
}
|
||||
|
||||
private bool _continuous = false;
|
||||
|
||||
//
|
||||
|
@ -157,8 +167,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] ComputerName
|
||||
{
|
||||
get { return _computerName; }
|
||||
|
||||
set { _computerName = value; }
|
||||
}
|
||||
|
||||
private string[] _computerName = new string[0];
|
||||
|
||||
private ResourceManager _resourceMgr = null;
|
||||
|
@ -482,9 +494,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
continue;
|
||||
}
|
||||
|
||||
allExpandedPaths.Add(expandedPath);
|
||||
}
|
||||
}
|
||||
|
||||
if (allExpandedPaths.Count == 0)
|
||||
{
|
||||
return;
|
||||
|
@ -495,6 +509,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
ReportPdhError(res, false);
|
||||
}
|
||||
|
||||
res = _pdhHelper.AddCounters(ref allExpandedPaths, true);
|
||||
if (res != 0)
|
||||
{
|
||||
|
@ -575,6 +590,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("CounterApiError"), res);
|
||||
}
|
||||
|
||||
Exception exc = new Exception(msg);
|
||||
if (bTerminate)
|
||||
{
|
||||
|
@ -643,6 +659,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
WriteObject(set);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] ListLog
|
||||
{
|
||||
get { return _listLog; }
|
||||
|
||||
set { _listLog = value; }
|
||||
}
|
||||
|
||||
private string[] _listLog = { "*" };
|
||||
|
||||
/// <summary>
|
||||
|
@ -68,8 +70,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] LogName
|
||||
{
|
||||
get { return _logName; }
|
||||
|
||||
set { _logName = value; }
|
||||
}
|
||||
|
||||
private string[] _logName = { "*" };
|
||||
|
||||
/// <summary>
|
||||
|
@ -93,8 +97,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] ListProvider
|
||||
{
|
||||
get { return _listProvider; }
|
||||
|
||||
set { _listProvider = value; }
|
||||
}
|
||||
|
||||
private string[] _listProvider = { "*" };
|
||||
|
||||
/// <summary>
|
||||
|
@ -116,8 +122,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] ProviderName
|
||||
{
|
||||
get { return _providerName; }
|
||||
|
||||
set { _providerName = value; }
|
||||
}
|
||||
|
||||
private string[] _providerName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -139,8 +147,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Path
|
||||
{
|
||||
get { return _path; }
|
||||
|
||||
set { _path = value; }
|
||||
}
|
||||
|
||||
private string[] _path;
|
||||
|
||||
/// <summary>
|
||||
|
@ -180,8 +190,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public Int64 MaxEvents
|
||||
{
|
||||
get { return _maxEvents; }
|
||||
|
||||
set { _maxEvents = value; }
|
||||
}
|
||||
|
||||
private Int64 _maxEvents = -1;
|
||||
|
||||
/// <summary>
|
||||
|
@ -217,8 +229,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string ComputerName
|
||||
{
|
||||
get { return _computerName; }
|
||||
|
||||
set { _computerName = value; }
|
||||
}
|
||||
|
||||
private string _computerName = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
|
@ -235,8 +249,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public PSCredential Credential
|
||||
{
|
||||
get { return _credential; }
|
||||
|
||||
set { _credential = value; }
|
||||
}
|
||||
|
||||
private PSCredential _credential = PSCredential.Empty;
|
||||
|
||||
/// <summary>
|
||||
|
@ -261,8 +277,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string FilterXPath
|
||||
{
|
||||
get { return _filter; }
|
||||
|
||||
set { _filter = value; }
|
||||
}
|
||||
|
||||
private string _filter = "*";
|
||||
|
||||
/// <summary>
|
||||
|
@ -284,8 +302,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public XmlDocument FilterXml
|
||||
{
|
||||
get { return _xmlQuery; }
|
||||
|
||||
set { _xmlQuery = value; }
|
||||
}
|
||||
|
||||
private XmlDocument _xmlQuery = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -307,8 +327,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public Hashtable[] FilterHashtable
|
||||
{
|
||||
get { return _selector; }
|
||||
|
||||
set { _selector = value; }
|
||||
}
|
||||
|
||||
private Hashtable[] _selector;
|
||||
|
||||
/// <summary>
|
||||
|
@ -322,8 +344,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter Force
|
||||
{
|
||||
get { return _force; }
|
||||
|
||||
set { _force = value; }
|
||||
}
|
||||
|
||||
private SwitchParameter _force;
|
||||
|
||||
/// <summary>
|
||||
|
@ -338,8 +362,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter Oldest
|
||||
{
|
||||
get { return _oldest; }
|
||||
|
||||
set { _oldest = value; }
|
||||
}
|
||||
|
||||
private bool _oldest = false;
|
||||
|
||||
//
|
||||
|
@ -521,6 +547,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
logQuery = new EventLogQuery(_logNamesMatchingWildcard[0], PathType.LogName, _filter);
|
||||
}
|
||||
|
||||
logQuery.Session = eventLogSession;
|
||||
logQuery.ReverseDirection = !_oldest;
|
||||
|
||||
|
@ -563,6 +590,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteVerbose(string.Format(CultureInfo.InvariantCulture, "Log {0} will be queried", log));
|
||||
}
|
||||
}
|
||||
|
||||
logQuery.Session = eventLogSession;
|
||||
logQuery.ReverseDirection = !_oldest; ;
|
||||
|
||||
|
@ -630,6 +658,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bMatchFound)
|
||||
{
|
||||
string msg = _resourceMgr.GetString("NoMatchingLogsFound");
|
||||
|
@ -767,6 +796,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
logQuery = new EventLogQuery(_resolvedPaths[0], PathType.FilePath, _filter);
|
||||
}
|
||||
|
||||
logQuery.Session = eventLogSession;
|
||||
logQuery.ReverseDirection = !_oldest;
|
||||
|
||||
|
@ -862,10 +892,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteError(new ErrorRecord(exc, exc.Message, ErrorCategory.NotSpecified, null));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (evtObj == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (_maxEvents != -1 && numEvents >= _maxEvents)
|
||||
{
|
||||
break;
|
||||
|
@ -882,6 +914,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
WriteError(new ErrorRecord(exc, exc.Message, ErrorCategory.NotSpecified, null));
|
||||
}
|
||||
|
||||
outputObj.Properties.Add(new PSNoteProperty("Message", evtMessage));
|
||||
|
||||
//
|
||||
|
@ -925,8 +958,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
string providerFilter = AddProviderPredicatesToFilter(_providersByLogMap[log]);
|
||||
result.AppendFormat(CultureInfo.InvariantCulture, queryTemplate, new object[] { queryId++, log, providerFilter });
|
||||
}
|
||||
|
||||
result.Append(queryListClose);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "GetLogSet":
|
||||
|
@ -937,8 +972,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
result.AppendFormat(CultureInfo.InvariantCulture, queryTemplate, new object[] { queryId++, log, _filter });
|
||||
}
|
||||
|
||||
result.Append(queryListClose);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "FileSet":
|
||||
|
@ -950,8 +987,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
string properFilePath = filePrefix + filePath;
|
||||
result.AppendFormat(CultureInfo.InvariantCulture, queryTemplate, new object[] { queryId++, properFilePath, _filter });
|
||||
}
|
||||
|
||||
result.Append(queryListClose);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "HashQuerySet":
|
||||
|
@ -1039,6 +1078,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
added = HandleNamedDataHashValue(key, hash[key]);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1048,6 +1088,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
xpathString.Append(" and ");
|
||||
}
|
||||
|
||||
xpathString.Append(added);
|
||||
}
|
||||
|
||||
|
@ -1118,6 +1159,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
string.Format(CultureInfo.InvariantCulture, suppressOpener, queryId++, logName));
|
||||
}
|
||||
}
|
||||
|
||||
if (hash.ContainsKey(hashkey_path_lc))
|
||||
{
|
||||
if (hash[hashkey_path_lc] is Array)
|
||||
|
@ -1146,6 +1188,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hash.ContainsKey(hashkey_providername_lc))
|
||||
{
|
||||
List<string> provPatterns = new List<string>();
|
||||
|
@ -1273,6 +1316,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
result.Append(" and ").Append(xpathString);
|
||||
}
|
||||
|
||||
result.Append(propClose);
|
||||
}
|
||||
|
||||
|
@ -1315,6 +1359,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ret.Append(" or ");
|
||||
}
|
||||
}
|
||||
|
||||
ret.Append(")");
|
||||
}
|
||||
else
|
||||
|
@ -1344,6 +1389,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ret.Append(" or ");
|
||||
}
|
||||
}
|
||||
|
||||
ret.Append(")");
|
||||
}
|
||||
else
|
||||
|
@ -1380,6 +1426,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
keywordsMask |= keywordLong;
|
||||
}
|
||||
|
||||
|
@ -1530,6 +1577,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ret.Append(" or ");
|
||||
}
|
||||
}
|
||||
|
||||
ret.Append(")");
|
||||
}
|
||||
else
|
||||
|
@ -1562,6 +1610,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ret.Append(" or ");
|
||||
}
|
||||
}
|
||||
|
||||
ret.Append(")");
|
||||
}
|
||||
else
|
||||
|
@ -1636,6 +1685,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteError(new ErrorRecord(outerExc, "LogInfoUnavailable", ErrorCategory.NotSpecified, null));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Oldest.IsPresent)
|
||||
{
|
||||
if (logObj.LogType == EventLogType.Debug || logObj.LogType == EventLogType.Analytical)
|
||||
|
@ -1645,6 +1695,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ThrowTerminatingError(new ErrorRecord(exc, "SpecifyOldestForLog", ErrorCategory.InvalidArgument, logName));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1761,6 +1812,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
Exception exc = new Exception(string.Format(CultureInfo.InvariantCulture, msg, pi.ProviderPath));
|
||||
WriteError(new ErrorRecord(exc, "NotALogFile", ErrorCategory.InvalidArgument, path));
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1871,6 +1923,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
predicate.Append(" or ");
|
||||
}
|
||||
}
|
||||
|
||||
predicate.Append("]");
|
||||
|
||||
return predicate.ToString();
|
||||
|
@ -2051,9 +2104,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
_logNamesMatchingWildcard.Add(actualLogName.ToLowerInvariant());
|
||||
}
|
||||
|
||||
bMatched = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bMatched)
|
||||
{
|
||||
string msg = _resourceMgr.GetString("NoMatchingLogsFound");
|
||||
|
@ -2090,6 +2145,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
bMatched = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bMatched)
|
||||
{
|
||||
string msg = _resourceMgr.GetString("NoMatchingProvidersFound");
|
||||
|
|
|
@ -90,6 +90,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
return _types;
|
||||
}
|
||||
}
|
||||
|
||||
private string[] _types = new string[] { "getevent.types.ps1xml" };
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -51,8 +51,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Path
|
||||
{
|
||||
get { return _path; }
|
||||
|
||||
set { _path = value; }
|
||||
}
|
||||
|
||||
private string[] _path;
|
||||
|
||||
private StringCollection _resolvedPaths = new StringCollection();
|
||||
|
@ -76,8 +78,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] ListSet
|
||||
{
|
||||
get { return _listSet; }
|
||||
|
||||
set { _listSet = value; }
|
||||
}
|
||||
|
||||
private string[] _listSet = new string[0];
|
||||
|
||||
//
|
||||
|
@ -91,8 +95,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public DateTime StartTime
|
||||
{
|
||||
get { return _startTime; }
|
||||
|
||||
set { _startTime = value; }
|
||||
}
|
||||
|
||||
private DateTime _startTime = DateTime.MinValue;
|
||||
|
||||
//
|
||||
|
@ -106,8 +112,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public DateTime EndTime
|
||||
{
|
||||
get { return _endTime; }
|
||||
|
||||
set { _endTime = value; }
|
||||
}
|
||||
|
||||
private DateTime _endTime = DateTime.MaxValue;
|
||||
|
||||
//
|
||||
|
@ -126,8 +134,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Counter
|
||||
{
|
||||
get { return _counter; }
|
||||
|
||||
set { _counter = value; }
|
||||
}
|
||||
|
||||
private string[] _counter = new string[0];
|
||||
|
||||
//
|
||||
|
@ -137,8 +147,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter Summary
|
||||
{
|
||||
get { return _summary; }
|
||||
|
||||
set { _summary = value; }
|
||||
}
|
||||
|
||||
private SwitchParameter _summary;
|
||||
|
||||
//
|
||||
|
@ -154,8 +166,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public Int64 MaxSamples
|
||||
{
|
||||
get { return _maxSamples; }
|
||||
|
||||
set { _maxSamples = value; }
|
||||
}
|
||||
|
||||
private Int64 _maxSamples = KEEP_ON_SAMPLING;
|
||||
|
||||
private ResourceManager _resourceMgr = null;
|
||||
|
@ -207,6 +221,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ValidateFilePaths();
|
||||
|
||||
switch (ParameterSetName)
|
||||
|
@ -358,6 +373,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteObject(setObj);
|
||||
bMatched = true;
|
||||
}
|
||||
|
||||
if (!bMatched)
|
||||
{
|
||||
string msg = _resourceMgr.GetString("NoMatchingCounterSetsInFile");
|
||||
|
@ -419,9 +435,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
continue;
|
||||
}
|
||||
|
||||
validPaths.Add(expandedPath);
|
||||
}
|
||||
}
|
||||
|
||||
if (validPaths.Count == 0)
|
||||
{
|
||||
return;
|
||||
|
@ -475,6 +493,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (res != 0 && res != PdhResults.PDH_INVALID_DATA)
|
||||
{
|
||||
ReportPdhError(res, false);
|
||||
|
@ -620,6 +639,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("CounterApiError"), res);
|
||||
}
|
||||
|
||||
Exception exc = new Exception(msg);
|
||||
if (bTerminate)
|
||||
{
|
||||
|
|
|
@ -42,11 +42,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _providerName;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_providerName = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string _providerName;
|
||||
|
||||
/// <summary>
|
||||
|
@ -62,12 +64,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_id = value;
|
||||
_idSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private int _id;
|
||||
private bool _idSpecified = false;
|
||||
|
||||
|
@ -83,12 +87,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _version;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_version = value;
|
||||
_versionSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private byte _version;
|
||||
private bool _versionSpecified = false;
|
||||
|
||||
|
@ -109,11 +115,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _payload;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_payload = value;
|
||||
}
|
||||
}
|
||||
|
||||
private object[] _payload;
|
||||
|
||||
/// <summary>
|
||||
|
@ -149,6 +157,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("ProviderMetadataUnavailable"), providerName, exc.Message);
|
||||
throw new Exception(msg, exc);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -200,6 +209,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (matchedEvent == null)
|
||||
{
|
||||
string msg = string.Format(CultureInfo.InvariantCulture,
|
||||
|
@ -268,6 +278,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -315,6 +326,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_payload[i] = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
provider.WriteEvent(ref ed, _payload);
|
||||
}
|
||||
else
|
||||
|
@ -322,6 +334,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
provider.WriteEvent(ref ed);
|
||||
}
|
||||
}
|
||||
|
||||
base.ProcessRecord();
|
||||
}
|
||||
|
||||
|
|
|
@ -570,6 +570,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
{
|
||||
//Console.WriteLine("error in PdhBindInputDataSource: " + res);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -599,6 +600,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
{
|
||||
//Console.WriteLine("error in PdhOpenQueryH: " + res);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -632,12 +634,14 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
{
|
||||
startTime = new DateTime(startTime.Ticks, DateTimeKind.Utc);
|
||||
}
|
||||
|
||||
pTimeInfo.StartTime = (startTime == DateTime.MinValue) ? 0 : startTime.ToFileTimeUtc();
|
||||
|
||||
if (endTime != DateTime.MaxValue && endTime.Kind == DateTimeKind.Local)
|
||||
{
|
||||
endTime = new DateTime(endTime.Ticks, DateTimeKind.Utc);
|
||||
}
|
||||
|
||||
pTimeInfo.EndTime = (endTime == DateTime.MaxValue) ? Int64.MaxValue : endTime.ToFileTimeUtc();
|
||||
|
||||
pTimeInfo.SampleCount = 0;
|
||||
|
@ -771,6 +775,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
{
|
||||
Marshal.FreeHGlobal(strCountersList);
|
||||
}
|
||||
|
||||
if (strInstancesList != IntPtr.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(strInstancesList);
|
||||
|
@ -820,6 +825,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1032,6 +1038,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
return (uint)PdhResults.PDH_INVALID_PATH;
|
||||
}
|
||||
}
|
||||
|
||||
if (counterIndex != -1 && objIndex != -1)
|
||||
{
|
||||
break;
|
||||
|
@ -1050,6 +1057,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
pathElts.ObjectName = objNameLocalized;
|
||||
|
||||
string ctrNameLocalized;
|
||||
|
@ -1058,6 +1066,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
pathElts.CounterName = ctrNameLocalized;
|
||||
|
||||
// Assemble the path back by using the translated object and counter names:
|
||||
|
@ -1088,6 +1097,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
localizedPathPtr = Marshal.AllocHGlobal(strSize * sizeof(char));
|
||||
res = PdhLookupPerfNameByIndex(machineName, index, localizedPathPtr, ref strSize);
|
||||
}
|
||||
|
||||
if (res == 0)
|
||||
{
|
||||
locName = Marshal.PtrToStringUni(localizedPathPtr);
|
||||
|
@ -1140,6 +1150,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1357,6 +1368,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
IntPtr retString = PdhGetExplainText(szMachineName, szObjectName, null);
|
||||
return Marshal.PtrToStringUni(retString);
|
||||
}
|
||||
|
@ -1371,6 +1383,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
if (res != 0 && res != PdhResults.PDH_NO_DATA)
|
||||
{
|
||||
return res;
|
||||
|
@ -1524,6 +1537,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
|
|||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
if (res != 0 && res != PdhResults.PDH_NO_DATA)
|
||||
{
|
||||
return res;
|
||||
|
|
|
@ -60,6 +60,7 @@ namespace Microsoft.PowerShell.Cmdletization
|
|||
_parentJob = null;
|
||||
}
|
||||
}
|
||||
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +76,7 @@ namespace Microsoft.PowerShell.Cmdletization
|
|||
protected TSession[] Session
|
||||
{
|
||||
get { return _session ?? (_session = new TSession[] { this.DefaultSession }); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
|
@ -86,6 +88,7 @@ namespace Microsoft.PowerShell.Cmdletization
|
|||
_sessionWasSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private TSession[] _session;
|
||||
private bool _sessionWasSpecified;
|
||||
|
||||
|
@ -96,8 +99,10 @@ namespace Microsoft.PowerShell.Cmdletization
|
|||
public SwitchParameter AsJob
|
||||
{
|
||||
get { return _asJob; }
|
||||
|
||||
set { _asJob = value; }
|
||||
}
|
||||
|
||||
private bool _asJob;
|
||||
|
||||
/// <summary>
|
||||
|
@ -319,6 +324,7 @@ namespace Microsoft.PowerShell.Cmdletization
|
|||
NonPipelineResults = Output | Error | Warning | Verbose | Debug | Progress,
|
||||
PipelineResults = Results,
|
||||
}
|
||||
|
||||
private static void DiscardJobOutputs(Job job, JobOutputs jobOutputsToDiscard)
|
||||
{
|
||||
if (JobOutputs.Output == (jobOutputsToDiscard & JobOutputs.Output))
|
||||
|
@ -523,6 +529,7 @@ namespace Microsoft.PowerShell.Cmdletization
|
|||
associatedSessions.Add(associatedSession);
|
||||
}
|
||||
}
|
||||
|
||||
if (associatedSessions.Count == 1)
|
||||
{
|
||||
return associatedSessions;
|
||||
|
@ -636,6 +643,7 @@ namespace Microsoft.PowerShell.Cmdletization
|
|||
{
|
||||
conflictingParameter = "Confirm";
|
||||
}
|
||||
|
||||
if (conflictingParameter != null)
|
||||
{
|
||||
string errorMessage = string.Format(
|
||||
|
|
|
@ -125,6 +125,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
errorId: "CimJob_" + inner.GetType().Name,
|
||||
errorCategory: ErrorCategory.NotSpecified);
|
||||
}
|
||||
|
||||
return cimJobException;
|
||||
}
|
||||
|
||||
|
@ -352,6 +353,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
get { return _errorRecord; }
|
||||
}
|
||||
|
||||
private ErrorRecord _errorRecord;
|
||||
|
||||
internal bool IsTerminatingError
|
||||
|
|
|
@ -89,6 +89,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
PSObject pso = PSObject.AsPSObject(outputObject);
|
||||
AddShowComputerNameMarker(pso);
|
||||
}
|
||||
|
||||
base.WriteObject(outputObject);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
var tmp = new PSNoteProperty(element.Key, element.Value.Value);
|
||||
propertyBag.Properties.Add(tmp);
|
||||
}
|
||||
|
||||
this.WriteObject(propertyBag);
|
||||
}
|
||||
}
|
||||
|
@ -179,6 +180,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
pso.TypeNames.Insert(0, methodParameter.ParameterTypeName);
|
||||
}
|
||||
}
|
||||
|
||||
this.WriteObject(cmdletOutput);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
IsValuePresent = inputParameter.IsValuePresent
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
PSObject pso = PSObject.AsPSObject(_resultFromModifyInstance);
|
||||
AddShowComputerNameMarker(pso);
|
||||
}
|
||||
|
||||
_resultFromModifyInstanceHasBeenPassedThru = true;
|
||||
return _resultFromModifyInstance;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.WriteObject(item);
|
||||
});
|
||||
}
|
||||
|
@ -52,6 +53,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
errorId = errorId + "_" + notFoundError.PropertyName;
|
||||
}
|
||||
|
||||
CimJobException cimJobException = CimJobException.CreateWithFullControl(
|
||||
this.JobContext,
|
||||
notFoundError.ErrorMessageGenerator(this.Description, this.JobContext.ClassName),
|
||||
|
@ -61,6 +63,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
cimJobException.ErrorRecord.SetTargetObject(notFoundError.PropertyValue);
|
||||
}
|
||||
|
||||
this.WriteError(cimJobException.ErrorRecord);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
// - this translates into potentially unlimited number of CimSession we will work with
|
||||
return int.MaxValue;
|
||||
}
|
||||
|
||||
int maxNumberOfSessionsIndicatedByCimInstanceArguments = 1;
|
||||
foreach (object cmdletArgument in invocationInfo.BoundParameters.Values)
|
||||
{
|
||||
|
@ -62,6 +63,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
numberOfSessionsAssociatedWithArgument);
|
||||
}
|
||||
}
|
||||
|
||||
return maxNumberOfSessionsIndicatedByCimInstanceArguments;
|
||||
}
|
||||
|
||||
|
@ -110,6 +112,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return alreadyPassedConnectivityTest;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
return _jobContext;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly CimJobContext _jobContext;
|
||||
|
||||
internal CimChildJobBase(CimJobContext jobContext)
|
||||
|
@ -101,6 +102,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (errorCodeProperty.CimType != CimType.UInt32)
|
||||
{
|
||||
return false;
|
||||
|
@ -172,15 +174,18 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
_sleepAndRetryTimer.Dispose();
|
||||
_sleepAndRetryTimer = null;
|
||||
}
|
||||
|
||||
if (_jobWasStopped)
|
||||
{
|
||||
this.SetCompletedJobState(JobState.Stopped, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.StartJob();
|
||||
});
|
||||
}
|
||||
|
||||
private void SleepAndRetry()
|
||||
{
|
||||
int tmpRandomDelay = _random.Next(0, _sleepAndRetryDelayRangeMs);
|
||||
|
@ -325,6 +330,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
}
|
||||
|
||||
internal abstract string Description { get; }
|
||||
|
||||
internal abstract string FailSafeDescription { get; }
|
||||
|
||||
internal void ExceptionSafeWrapper(Action action)
|
||||
|
@ -358,10 +364,12 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
everythingIsOk = true;
|
||||
}
|
||||
|
||||
if (_alreadyReachedCompletedState && _jobHadErrors)
|
||||
{
|
||||
everythingIsOk = true;
|
||||
}
|
||||
|
||||
if (!everythingIsOk)
|
||||
{
|
||||
Dbg.Assert(false, "PSInvalidOperationException should only happen in certain job states");
|
||||
|
@ -492,6 +500,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
this.JobContext.CmdletizationModuleVersion,
|
||||
CimSensitiveValueConverter);
|
||||
}
|
||||
|
||||
CimOperationOptionsHelper.SetCustomOption(
|
||||
operationOptions,
|
||||
"MI_OPERATIONOPTIONS_POWERSHELL_CMDLETNAME",
|
||||
|
@ -539,6 +548,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_jobWasStopped = true;
|
||||
|
||||
if (!_jobWasStarted)
|
||||
|
@ -556,6 +566,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
this.SetJobState(JobState.Stopping);
|
||||
}
|
||||
}
|
||||
|
||||
_cancellationTokenSource.Cancel();
|
||||
}
|
||||
|
||||
|
@ -593,6 +604,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
out sessionWasAlreadyTerminated);
|
||||
}
|
||||
}
|
||||
|
||||
if (brokenSessionException != null)
|
||||
{
|
||||
string brokenSessionMessage = string.Format(
|
||||
|
@ -749,6 +761,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
activity = this.GetDescription();
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(statusDescription))
|
||||
{
|
||||
statusDescription = this.StatusMessage;
|
||||
|
@ -979,6 +992,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
_userRespondedYesToAtLeastOneShouldProcess = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -992,6 +1006,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true.Equals(psShowComputerNameProperty.Value);
|
||||
}
|
||||
|
||||
|
@ -1022,17 +1037,20 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
cimInstance = outputObject as CimInstance;
|
||||
}
|
||||
|
||||
if (cimInstance != null)
|
||||
{
|
||||
CimCmdletAdapter.AssociateSessionOfOriginWithInstance(cimInstance, this.JobContext.Session);
|
||||
CimCustomOptionsDictionary.AssociateCimInstanceWithCustomOptions(cimInstance, this.GetJobSpecificCustomOptions());
|
||||
}
|
||||
|
||||
if (this.JobContext.ShowComputerName)
|
||||
{
|
||||
if (pso == null)
|
||||
{
|
||||
pso = PSObject.AsPSObject(outputObject);
|
||||
}
|
||||
|
||||
AddShowComputerNameMarker(pso);
|
||||
if (cimInstance == null)
|
||||
{
|
||||
|
@ -1052,11 +1070,13 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
isCompleted = _alreadyReachedCompletedState;
|
||||
}
|
||||
|
||||
if (!isCompleted)
|
||||
{
|
||||
this.StopJob();
|
||||
this.Finished.WaitOne();
|
||||
}
|
||||
|
||||
_cimSensitiveValueConverter.Dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,13 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
}
|
||||
|
||||
public string CmdletizationClassName { get; private set; }
|
||||
|
||||
public string CmdletizationClassVersion { get; private set; }
|
||||
|
||||
public Version CmdletizationModuleVersion { get; private set; }
|
||||
|
||||
public bool SupportsShouldProcess { get; private set; }
|
||||
|
||||
private readonly IDictionary<string, string> _privateData;
|
||||
|
||||
private const string QueryLanguageKey = "QueryDialect";
|
||||
|
@ -47,8 +51,10 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
newValue = true;
|
||||
}
|
||||
|
||||
_useEnumerateInstancesInsteadOfWql = newValue;
|
||||
}
|
||||
|
||||
return _useEnumerateInstancesInsteadOfWql.Value;
|
||||
}
|
||||
}
|
||||
|
@ -122,6 +128,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
|
||||
_resourceUriHasBeenCalculated = true;
|
||||
}
|
||||
|
||||
return _resourceUri;
|
||||
}
|
||||
}
|
||||
|
@ -164,6 +171,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
|
||||
_schemaConformanceLevel = newSchemaConformanceLevel;
|
||||
}
|
||||
|
||||
return _schemaConformanceLevel.Value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,11 +82,17 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
public CimCmdletDefinitionContext CmdletDefinitionContext { get; private set; }
|
||||
|
||||
public InvocationInfo CmdletInvocationInfo { get; private set; }
|
||||
|
||||
public MshCommandRuntime.ShouldProcessPossibleOptimization ShouldProcessOptimization { get; private set; }
|
||||
|
||||
public ActionPreference ErrorActionPreference { get; private set; }
|
||||
|
||||
public ActionPreference WarningActionPreference { get; private set; }
|
||||
|
||||
public ActionPreference VerboseActionPreference { get; private set; }
|
||||
|
||||
public ActionPreference DebugActionPreference { get; private set; }
|
||||
|
||||
public string NamespaceOverride { get; private set; }
|
||||
|
||||
public bool IsRunningInBackground
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace Microsoft.PowerShell.Cim
|
|||
{
|
||||
throw new ArgumentOutOfRangeException("offset");
|
||||
}
|
||||
|
||||
if (offset + charsToCopy > _string.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charsToCopy");
|
||||
|
@ -148,6 +149,7 @@ namespace Microsoft.PowerShell.Cim
|
|||
{
|
||||
d.Dispose();
|
||||
}
|
||||
|
||||
_trackedDisposables.Clear();
|
||||
}
|
||||
}
|
||||
|
@ -173,6 +175,7 @@ namespace Microsoft.PowerShell.Cim
|
|||
|
||||
var sensitiveString = new SensitiveString(escapedUsername.Length + PSCredentialDelimiter.Length + credential.Password.Length);
|
||||
lock (_trackedDisposables) { _trackedDisposables.Add(sensitiveString); }
|
||||
|
||||
sensitiveString.Copy(escapedUsername, 0);
|
||||
sensitiveString.Copy(PSCredentialDelimiter, escapedUsername.Length);
|
||||
sensitiveString.Copy(credential.Password, escapedUsername.Length + PSCredentialDelimiter.Length);
|
||||
|
@ -184,6 +187,7 @@ namespace Microsoft.PowerShell.Cim
|
|||
SecureString secureString = (SecureString)psObject.BaseObject;
|
||||
var sensitiveString = new SensitiveString(secureString.Length);
|
||||
lock (_trackedDisposables) { _trackedDisposables.Add(sensitiveString); }
|
||||
|
||||
sensitiveString.Copy(secureString, 0);
|
||||
return sensitiveString.Value;
|
||||
}
|
||||
|
@ -201,6 +205,7 @@ namespace Microsoft.PowerShell.Cim
|
|||
object cimElement = ConvertFromDotNetToCim(dotNetArray.GetValue(i));
|
||||
cimArray.SetValue(cimElement, i);
|
||||
}
|
||||
|
||||
return cimArray;
|
||||
}
|
||||
}
|
||||
|
@ -244,10 +249,12 @@ namespace Microsoft.PowerShell.Cim
|
|||
{
|
||||
return psObject.BaseObject;
|
||||
}
|
||||
|
||||
if (typeof(CimInstance).IsAssignableFrom(dotNetType))
|
||||
{
|
||||
return psObject.BaseObject;
|
||||
}
|
||||
|
||||
if (typeof(PSReference).IsAssignableFrom(dotNetType))
|
||||
{
|
||||
PSReference psReference = (PSReference)psObject.BaseObject;
|
||||
|
@ -275,6 +282,7 @@ namespace Microsoft.PowerShell.Cim
|
|||
object cimElement = ConvertFromDotNetToCim(dotNetArray.GetValue(i));
|
||||
cimArray.SetValue(cimElement, i);
|
||||
}
|
||||
|
||||
return cimArray;
|
||||
}
|
||||
}
|
||||
|
@ -358,6 +366,7 @@ namespace Microsoft.PowerShell.Cim
|
|||
{
|
||||
return LanguagePrimitives.ConvertTo(cimObject, expectedDotNetType, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
if (expectedDotNetType == typeof(CimInstance))
|
||||
{
|
||||
return LanguagePrimitives.ConvertTo(cimObject, expectedDotNetType, CultureInfo.InvariantCulture);
|
||||
|
@ -375,6 +384,7 @@ namespace Microsoft.PowerShell.Cim
|
|||
object dotNetElement = ConvertFromCimToDotNet(cimArray.GetValue(i), dotNetElementType);
|
||||
dotNetArray.SetValue(dotNetElement, i);
|
||||
}
|
||||
|
||||
return dotNetArray;
|
||||
}
|
||||
}
|
||||
|
@ -484,6 +494,7 @@ namespace Microsoft.PowerShell.Cim
|
|||
{
|
||||
return CimType.Reference;
|
||||
}
|
||||
|
||||
if (typeof(PSReference[]).IsAssignableFrom(dotNetType))
|
||||
{
|
||||
return CimType.ReferenceArray;
|
||||
|
@ -510,10 +521,12 @@ namespace Microsoft.PowerShell.Cim
|
|||
{
|
||||
return dotNetType;
|
||||
}
|
||||
|
||||
if (dotNetType == typeof(CimInstance))
|
||||
{
|
||||
return dotNetType;
|
||||
}
|
||||
|
||||
if (dotNetType == typeof(PSReference))
|
||||
{
|
||||
return dotNetType;
|
||||
|
@ -615,6 +628,7 @@ namespace Microsoft.PowerShell.Cim
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Type elementType = arrayType.GetElementType();
|
||||
if (elementType.IsArray)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
public CimCmdletInvocationContext CmdletInvocationContext { get; private set; }
|
||||
|
||||
public CimSession Session { get; private set; }
|
||||
|
||||
public object TargetObject { get; private set; }
|
||||
|
||||
public string ClassName
|
||||
|
@ -42,6 +43,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.ClassName;
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +56,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return this.CmdletInvocationContext.NamespaceOverride;
|
||||
}
|
||||
|
||||
return GetCimNamespace(this.CmdletInvocationContext.CmdletDefinitionContext.CmdletizationClassName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
result = MergeOptions(result, instanceRelatedToThisOperation);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return "TRUE"; // based on http://msdn.microsoft.com/library/aa394054(VS.85).aspx
|
||||
}
|
||||
|
||||
return "FALSE"; // based on http://msdn.microsoft.com/library/aa394054(VS.85).aspx
|
||||
}
|
||||
|
||||
|
@ -317,6 +318,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
throw new ArgumentNullException("optionName");
|
||||
}
|
||||
|
||||
if (optionValue == null)
|
||||
{
|
||||
throw new ArgumentNullException("optionValue");
|
||||
|
@ -360,6 +362,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return CimCmdletAdapter.GetSessionOfOriginFromCimInstance(_associatedObject);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return base.Session;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
base.Session = value;
|
||||
|
@ -64,12 +65,14 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
|
||||
return this.CmdletDefinitionContext.DefaultThrottleLimit;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
base.ThrottleLimit = value;
|
||||
_throttleLimitIsSetExplicitly = true;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _throttleLimitIsSetExplicitly;
|
||||
|
||||
#endregion
|
||||
|
@ -96,6 +99,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
this.GetDynamicNamespace()));
|
||||
}
|
||||
}
|
||||
|
||||
private CimCmdletInvocationContext _cmdletInvocationContext;
|
||||
|
||||
internal CimCmdletDefinitionContext CmdletDefinitionContext
|
||||
|
@ -111,9 +115,11 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
this.Cmdlet.CommandInfo.CommandMetadata.SupportsShouldProcess,
|
||||
this.PrivateData);
|
||||
}
|
||||
|
||||
return _cmdletDefinitionContext;
|
||||
}
|
||||
}
|
||||
|
||||
private CimCmdletDefinitionContext _cmdletDefinitionContext;
|
||||
|
||||
internal InvocationInfo CmdletInvocationInfo
|
||||
|
@ -175,6 +181,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsSupportedSession(session, tracker))
|
||||
{
|
||||
return null;
|
||||
|
@ -201,6 +208,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsSupportedSession(session, tracker))
|
||||
{
|
||||
return null;
|
||||
|
@ -301,6 +309,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsSupportedSession(session, tracker))
|
||||
{
|
||||
return null;
|
||||
|
@ -344,6 +353,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
s_cimInstanceToSessionOfOrigin.TryGetValue(instance, out result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,9 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
}
|
||||
|
||||
public string PropertyName { get; private set; }
|
||||
|
||||
public object PropertyValue { get; private set; }
|
||||
|
||||
public Func<string, string, string> ErrorMessageGenerator { get; private set; }
|
||||
|
||||
private static string GetErrorMessageForNotFound(string queryDescription, string className)
|
||||
|
@ -151,6 +153,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
private readonly List<PropertyValueFilter> _propertyValueFilters = new List<PropertyValueFilter>();
|
||||
protected IEnumerable<PropertyValueFilter> PropertyValueFilters { get { return _propertyValueFilters; } }
|
||||
|
||||
protected void AddPropertyValueFilter(PropertyValueFilter propertyValueFilter)
|
||||
{
|
||||
_propertyValueFilters.Add(propertyValueFilter);
|
||||
|
@ -170,6 +173,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isMatch;
|
||||
}
|
||||
}
|
||||
|
@ -345,9 +349,11 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
_behaviorOnNoMatch = this.GetDefaultBehaviorWhenNoMatchesFound(this.CimTypedExpectedPropertyValue);
|
||||
}
|
||||
|
||||
return _behaviorOnNoMatch;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract BehaviorOnNoMatch GetDefaultBehaviorWhenNoMatchesFound(object cimTypedExpectedPropertyValue);
|
||||
private BehaviorOnNoMatch _behaviorOnNoMatch;
|
||||
|
||||
|
@ -371,6 +377,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
object actualPropertyValue = propertyInfo.Value;
|
||||
|
||||
if (CimTypedExpectedPropertyValue == null)
|
||||
|
@ -422,6 +429,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (expectedPropertyValue == null)
|
||||
{
|
||||
return true;
|
||||
|
@ -491,6 +499,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
expectedPropertyValue = expectedPropertyValue.ToString();
|
||||
actualPropertyValue = actualPropertyValue.ToString();
|
||||
}
|
||||
|
||||
var expectedPropertyValueAsString = expectedPropertyValue as string;
|
||||
if (expectedPropertyValueAsString != null)
|
||||
{
|
||||
|
@ -510,10 +519,12 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!LanguagePrimitives.TryConvertTo(expectedPropertyValue, out expectedPropertyValueAsString))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return WildcardPattern.Get(expectedPropertyValueAsString, WildcardOptions.IgnoreCase).IsMatch(actualPropertyValueAsString);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
propertyCollection,
|
||||
context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Property.ClearPropertyDynamicParameters(
|
||||
".",
|
||||
propertyCollection,
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] DriveLetter
|
||||
{
|
||||
get { return _drivesList; }
|
||||
|
||||
set { _drivesList = value; }
|
||||
}
|
||||
|
||||
|
@ -46,6 +47,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _force;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_force = value;
|
||||
|
@ -134,6 +136,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// The drive path exists, and the drive is 'fixed'.
|
||||
return true;
|
||||
}
|
||||
|
||||
WriteError(new ErrorRecord(
|
||||
new ArgumentException(
|
||||
String.Format(CultureInfo.InvariantCulture, ClearRecycleBinResources.InvalidDriveType, drivePath, "Get-Volume")),
|
||||
|
@ -141,6 +144,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.InvalidArgument,
|
||||
drivePath));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -175,6 +179,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
drivePath = driveName + ":\\";
|
||||
}
|
||||
|
||||
return drivePath;
|
||||
}
|
||||
|
||||
|
@ -251,6 +256,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
SHERB_NOPROGRESSUI = 0x00000002,
|
||||
SHERB_NOSOUND = 0x00000004
|
||||
}
|
||||
|
||||
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]
|
||||
internal static extern uint SHEmptyRecycleBin(IntPtr hwnd, string pszRootPath, RecycleFlags dwFlags);
|
||||
}
|
||||
|
|
|
@ -239,12 +239,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public int Timeout
|
||||
{
|
||||
get { return _timeout; }
|
||||
|
||||
set
|
||||
{
|
||||
_timeout = value;
|
||||
_timeoutSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private int _timeout = -1;
|
||||
private bool _timeoutSpecified = false;
|
||||
|
||||
|
@ -256,12 +258,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public WaitForServiceTypes For
|
||||
{
|
||||
get { return _waitFor; }
|
||||
|
||||
set
|
||||
{
|
||||
_waitFor = value;
|
||||
_waitForSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private WaitForServiceTypes _waitFor = WaitForServiceTypes.PowerShell;
|
||||
private bool _waitForSpecified = false;
|
||||
|
||||
|
@ -274,12 +278,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public Int16 Delay
|
||||
{
|
||||
get { return (Int16)_delay; }
|
||||
|
||||
set
|
||||
{
|
||||
_delay = value;
|
||||
_delaySpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private int _delay = 5;
|
||||
private bool _delaySpecified = false;
|
||||
|
||||
|
@ -295,13 +301,16 @@ foreach ($computerName in $array[1])
|
|||
$arguments = @{
|
||||
ComputerName = $computerName
|
||||
ScriptBlock = { $true }
|
||||
|
||||
SessionOption = NewPSSessionOption -NoMachineProfile
|
||||
ErrorAction = 'SilentlyContinue'
|
||||
}
|
||||
|
||||
if ( $null -ne $array[0] )
|
||||
{
|
||||
$arguments['Credential'] = $array[0]
|
||||
}
|
||||
|
||||
$result[$computerName] = (Invoke-Command @arguments) -as [bool]
|
||||
}
|
||||
$result
|
||||
|
@ -418,6 +427,7 @@ $result
|
|||
{
|
||||
WriteError(error);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -527,6 +537,7 @@ $result
|
|||
try
|
||||
{
|
||||
if (token.IsCancellationRequested) { break; }
|
||||
|
||||
using (CimSession cimSession = RemoteDiscoveryHelper.CreateCimSession(computer, Credential, WsmanAuthentication, token, this))
|
||||
{
|
||||
bool itemRetrieved = false;
|
||||
|
@ -668,6 +679,7 @@ $result
|
|||
try
|
||||
{
|
||||
if (token.IsCancellationRequested) { break; }
|
||||
|
||||
using (CimSession cimSession = RemoteDiscoveryHelper.CreateCimSession(computer, credential, wsmanAuthentication, token, cmdlet))
|
||||
{
|
||||
bool itemRetrieved = false;
|
||||
|
@ -924,6 +936,7 @@ $result
|
|||
// We check if the target machine has already rebooted by querying the LastBootUpTime from the Win32_OperatingSystem object.
|
||||
// So after this step, we are sure that both the Network and the WMI or WinRM service have already come up.
|
||||
if (_exit) { break; }
|
||||
|
||||
if (restartStageTestList.Count > 0)
|
||||
{
|
||||
if (_waitOnComputers.Count == 1)
|
||||
|
@ -932,12 +945,14 @@ $result
|
|||
_percent = CalculateProgressPercentage(StageVerification);
|
||||
WriteProgress(_indicator[(indicatorIndex++) % 4] + _activity, _status, _percent, ProgressRecordType.Processing);
|
||||
}
|
||||
|
||||
List<string> nextTestList = (isForWmi || isForPowershell) ? wmiTestList : winrmTestList;
|
||||
restartStageTestList = TestRestartStageUsingWsman(restartStageTestList, nextTestList, _cancel.Token);
|
||||
}
|
||||
|
||||
// Test WMI service
|
||||
if (_exit) { break; }
|
||||
|
||||
if (wmiTestList.Count > 0)
|
||||
{
|
||||
// This statement block executes for both CLRs.
|
||||
|
@ -949,13 +964,16 @@ $result
|
|||
_percent = CalculateProgressPercentage(WmiConnectionTest);
|
||||
WriteProgress(_indicator[(indicatorIndex++) % 4] + _activity, _status, _percent, ProgressRecordType.Processing);
|
||||
}
|
||||
|
||||
wmiTestList = TestWmiConnectionUsingWsman(wmiTestList, winrmTestList, _cancel.Token, Credential, WsmanAuthentication, this);
|
||||
}
|
||||
}
|
||||
|
||||
if (isForWmi) { break; }
|
||||
|
||||
// Test WinRM service
|
||||
if (_exit) { break; }
|
||||
|
||||
if (winrmTestList.Count > 0)
|
||||
{
|
||||
// This statement block executes for both CLRs.
|
||||
|
@ -984,10 +1002,12 @@ $result
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isForWinRm) { break; }
|
||||
|
||||
// Test PowerShell
|
||||
if (_exit) { break; }
|
||||
|
||||
if (psTestList.Count > 0)
|
||||
{
|
||||
if (_waitOnComputers.Count == 1)
|
||||
|
@ -996,6 +1016,7 @@ $result
|
|||
_percent = CalculateProgressPercentage(PowerShellConnectionTest);
|
||||
WriteProgress(_indicator[(indicatorIndex++) % 4] + _activity, _status, _percent, ProgressRecordType.Processing);
|
||||
}
|
||||
|
||||
psTestList = TestPowerShell(psTestList, allDoneList, _powershell, this.Credential);
|
||||
}
|
||||
} while (false);
|
||||
|
@ -1029,6 +1050,7 @@ $result
|
|||
WriteProgress(_indicator[indicatorIndex % 4] + _activity, _status, 100, ProgressRecordType.Completed);
|
||||
_timer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1045,12 +1067,14 @@ $result
|
|||
do
|
||||
{
|
||||
if (restartStageTestList.Count > 0) { WriteOutTimeoutError(restartStageTestList); }
|
||||
|
||||
if (wmiTestList.Count > 0) { WriteOutTimeoutError(wmiTestList); }
|
||||
// Wait for WMI. All computers that finished restarting are put in "winrmTestList"
|
||||
if (isForWmi) { break; }
|
||||
|
||||
// Wait for WinRM. All computers that finished restarting are put in "psTestList"
|
||||
if (winrmTestList.Count > 0) { WriteOutTimeoutError(winrmTestList); }
|
||||
|
||||
if (isForWinRm) { break; }
|
||||
|
||||
if (psTestList.Count > 0) { WriteOutTimeoutError(psTestList); }
|
||||
|
@ -1312,8 +1336,10 @@ $result
|
|||
public SwitchParameter Force
|
||||
{
|
||||
get { return _force; }
|
||||
|
||||
set { _force = value; }
|
||||
}
|
||||
|
||||
private bool _force;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1323,8 +1349,10 @@ $result
|
|||
public SwitchParameter Restart
|
||||
{
|
||||
get { return _restart; }
|
||||
|
||||
set { _restart = value; }
|
||||
}
|
||||
|
||||
private bool _restart;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1359,6 +1387,7 @@ $result
|
|||
{
|
||||
WriteError(targetError);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1833,6 +1862,7 @@ $result
|
|||
{
|
||||
returnValue.Append(computer);
|
||||
}
|
||||
|
||||
returnValue.Append(namespaceParameter);
|
||||
return returnValue.ToString();
|
||||
}
|
||||
|
@ -1853,6 +1883,7 @@ $result
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1876,6 +1907,7 @@ $result
|
|||
if (driveApp.Equals(sysdrive, StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1937,6 +1969,7 @@ $result
|
|||
{
|
||||
computerchangeinfo.HasSucceeded = true;
|
||||
}
|
||||
|
||||
return computerchangeinfo;
|
||||
}
|
||||
|
||||
|
@ -1953,6 +1986,7 @@ $result
|
|||
{
|
||||
renamecomputerchangeinfo.HasSucceeded = true;
|
||||
}
|
||||
|
||||
return renamecomputerchangeinfo;
|
||||
}
|
||||
|
||||
|
@ -1964,6 +1998,7 @@ $result
|
|||
{
|
||||
additionalmessage = StringUtil.Format(ComputerResources.NetworkPathNotFound, computername);
|
||||
}
|
||||
|
||||
string message = StringUtil.Format(ComputerResources.OperationFailed, ex.Message, computername, additionalmessage);
|
||||
ErrorRecord er = new ErrorRecord(new InvalidOperationException(message), "InvalidOperationException", ErrorCategory.InvalidOperation, computername);
|
||||
cmdlet.WriteError(er);
|
||||
|
@ -2022,6 +2057,7 @@ $result
|
|||
cmdlet.WriteError(er);
|
||||
retValue = true;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
|
@ -2211,6 +2247,7 @@ $result
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
validatedComputerName = nameToCheck;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] LiteralPath
|
||||
{
|
||||
get { return Path; }
|
||||
|
||||
set
|
||||
{
|
||||
base.SuppressWildcardExpansion = true;
|
||||
|
@ -48,6 +49,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public override string Filter
|
||||
{
|
||||
get { return base.Filter; }
|
||||
|
||||
set { base.Filter = value; }
|
||||
}
|
||||
|
||||
|
@ -58,6 +60,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public override string[] Include
|
||||
{
|
||||
get { return base.Include; }
|
||||
|
||||
set { base.Include = value; }
|
||||
}
|
||||
|
||||
|
@ -68,6 +71,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public override string[] Exclude
|
||||
{
|
||||
get { return base.Exclude; }
|
||||
|
||||
set { base.Exclude = value; }
|
||||
}
|
||||
|
||||
|
@ -87,6 +91,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public override SwitchParameter Force
|
||||
{
|
||||
get { return base.Force; }
|
||||
|
||||
set { base.Force = value; }
|
||||
}
|
||||
|
||||
|
@ -181,6 +186,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
parentPath = SessionState.Path.ParseParent(pathInfo.Path, String.Empty, context);
|
||||
}
|
||||
|
||||
note = new PSNoteProperty("PSParentPath", parentPath);
|
||||
result.Properties.Add(note, true);
|
||||
tracer.WriteLine("Attaching {0} = {1}", "PSParentPath", parentPath);
|
||||
|
|
|
@ -140,6 +140,7 @@ $result
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (match)
|
||||
continue;
|
||||
}
|
||||
|
@ -148,9 +149,11 @@ $result
|
|||
_allControlPanelItems.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return _allControlPanelItems;
|
||||
}
|
||||
}
|
||||
|
||||
private List<ShellFolderItem> _allControlPanelItems;
|
||||
|
||||
#region Cmdlet Overrides
|
||||
|
@ -199,6 +202,7 @@ $result
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -433,6 +437,7 @@ $result
|
|||
ErrorCategory.InvalidArgument, CanonicalNames);
|
||||
WriteError(error);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -559,12 +564,14 @@ $result
|
|||
public string[] Name
|
||||
{
|
||||
get { return RegularNames; }
|
||||
|
||||
set
|
||||
{
|
||||
RegularNames = value;
|
||||
_nameSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _nameSpecified = false;
|
||||
|
||||
/// <summary>
|
||||
|
@ -576,12 +583,14 @@ $result
|
|||
public string[] CanonicalName
|
||||
{
|
||||
get { return CanonicalNames; }
|
||||
|
||||
set
|
||||
{
|
||||
CanonicalNames = value;
|
||||
_canonicalNameSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _canonicalNameSpecified = false;
|
||||
|
||||
/// <summary>
|
||||
|
@ -593,12 +602,14 @@ $result
|
|||
public string[] Category
|
||||
{
|
||||
get { return CategoryNames; }
|
||||
|
||||
set
|
||||
{
|
||||
CategoryNames = value;
|
||||
_categorySpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _categorySpecified = false;
|
||||
|
||||
#endregion "Parameters"
|
||||
|
@ -690,6 +701,7 @@ $result
|
|||
public string[] Name
|
||||
{
|
||||
get { return RegularNames; }
|
||||
|
||||
set { RegularNames = value; }
|
||||
}
|
||||
|
||||
|
@ -702,6 +714,7 @@ $result
|
|||
public string[] CanonicalName
|
||||
{
|
||||
get { return CanonicalNames; }
|
||||
|
||||
set { CanonicalNames = value; }
|
||||
}
|
||||
|
||||
|
@ -714,6 +727,7 @@ $result
|
|||
public ControlPanelItem[] InputObject
|
||||
{
|
||||
get { return ControlPanelItems; }
|
||||
|
||||
set { ControlPanelItems = value; }
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Path
|
||||
{
|
||||
get { return paths; }
|
||||
|
||||
set { paths = value; }
|
||||
}
|
||||
|
||||
|
@ -35,6 +36,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] LiteralPath
|
||||
{
|
||||
get { return paths; }
|
||||
|
||||
set
|
||||
{
|
||||
base.SuppressWildcardExpansion = true;
|
||||
|
@ -78,6 +80,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
Name,
|
||||
context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Property.CopyPropertyDynamicParameters(
|
||||
".",
|
||||
Name,
|
||||
|
|
|
@ -69,6 +69,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public DateTime After
|
||||
{
|
||||
get { return _after; }
|
||||
|
||||
set
|
||||
{
|
||||
_after = value;
|
||||
|
@ -76,6 +77,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_isFilterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime _after;
|
||||
|
||||
/// <summary>
|
||||
|
@ -86,6 +88,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public DateTime Before
|
||||
{
|
||||
get { return _before; }
|
||||
|
||||
set
|
||||
{
|
||||
_before = value;
|
||||
|
@ -93,6 +96,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_isFilterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime _before;
|
||||
|
||||
/// <summary>
|
||||
|
@ -104,12 +108,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public String[] UserName
|
||||
{
|
||||
get { return _username; }
|
||||
|
||||
set
|
||||
{
|
||||
_username = value;
|
||||
_isFilterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private String[] _username;
|
||||
|
||||
/// <summary>
|
||||
|
@ -123,12 +129,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public long[] InstanceId
|
||||
{
|
||||
get { return _instanceIds; }
|
||||
|
||||
set
|
||||
{
|
||||
_instanceIds = value;
|
||||
_isFilterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private long[] _instanceIds = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -142,12 +150,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public int[] Index
|
||||
{
|
||||
get { return _indexes; }
|
||||
|
||||
set
|
||||
{
|
||||
_indexes = value;
|
||||
_isFilterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private int[] _indexes = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -162,12 +172,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] EntryType
|
||||
{
|
||||
get { return _entryTypes; }
|
||||
|
||||
set
|
||||
{
|
||||
_entryTypes = value;
|
||||
_isFilterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private string[] _entryTypes = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -181,12 +193,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
get
|
||||
{ return _sources; }
|
||||
|
||||
set
|
||||
{
|
||||
_sources = value;
|
||||
_isFilterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private string[] _sources;
|
||||
|
||||
/// <summary>
|
||||
|
@ -201,12 +215,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _message;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_message = value;
|
||||
_isFilterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private string _message;
|
||||
|
||||
/// <summary>
|
||||
|
@ -231,11 +247,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _asString;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_asString = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _asString /* = false */;
|
||||
#endregion Parameters
|
||||
|
||||
|
@ -403,6 +421,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
+ ": " + e.Message);
|
||||
throw;
|
||||
}
|
||||
|
||||
if ((entry != null) &&
|
||||
((lastindex == Int32.MinValue
|
||||
|| lastindex - entry.Index == 1)))
|
||||
|
@ -413,6 +432,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (!FiltersMatch(entry))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!AsBaseObject)
|
||||
{
|
||||
//wrapping in PSobject to insert into PStypesnames
|
||||
|
@ -428,9 +448,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteObject(entry);
|
||||
matchesfound = true;
|
||||
}
|
||||
|
||||
processed++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matchesfound && _isThrowError)
|
||||
{
|
||||
Exception Ex = new ArgumentException(StringUtil.Format(EventlogResources.NoEntriesFound, log.Log, string.Empty));
|
||||
|
@ -447,6 +469,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_instanceIds != null)
|
||||
{
|
||||
if (!((IList)_instanceIds).Contains(entry.InstanceId))
|
||||
|
@ -454,6 +477,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_entryTypes != null)
|
||||
{
|
||||
bool entrymatch = false;
|
||||
|
@ -465,8 +489,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!entrymatch) return entrymatch;
|
||||
}
|
||||
|
||||
if (_sources != null)
|
||||
{
|
||||
bool sourcematch = false;
|
||||
|
@ -476,6 +502,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
_isThrowError = false;
|
||||
}
|
||||
|
||||
WildcardPattern wildcardpattern = WildcardPattern.Get(source, WildcardOptions.IgnoreCase);
|
||||
if (wildcardpattern.IsMatch(entry.Source))
|
||||
{
|
||||
|
@ -483,20 +510,24 @@ namespace Microsoft.PowerShell.Commands
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sourcematch) return sourcematch;
|
||||
}
|
||||
|
||||
if (_message != null)
|
||||
{
|
||||
if (WildcardPattern.ContainsWildcardCharacters(_message))
|
||||
{
|
||||
_isThrowError = false;
|
||||
}
|
||||
|
||||
WildcardPattern wildcardpattern = WildcardPattern.Get(_message, WildcardOptions.IgnoreCase);
|
||||
if (!wildcardpattern.IsMatch(entry.Message))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_username != null)
|
||||
{
|
||||
bool usernamematch = false;
|
||||
|
@ -513,8 +544,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!usernamematch) return usernamematch;
|
||||
}
|
||||
|
||||
if (_isDateSpecified)
|
||||
{
|
||||
_isThrowError = false;
|
||||
|
@ -548,10 +581,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!datematch) return datematch;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private List<EventLog> GetMatchingLogs(string pattern)
|
||||
{
|
||||
WildcardPattern wildcardPattern = WildcardPattern.Get(pattern, WildcardOptions.IgnoreCase);
|
||||
|
@ -637,6 +673,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
computer = compName;
|
||||
}
|
||||
|
||||
foreach (string eventString in LogName)
|
||||
{
|
||||
try
|
||||
|
@ -647,10 +684,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteError(er);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ShouldProcess(StringUtil.Format(EventlogResources.ClearEventLogWarning, eventString, computer)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
EventLog Log = new EventLog(eventString, compName);
|
||||
Log.Clear();
|
||||
}
|
||||
|
@ -785,6 +824,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
_computerName = ComputerName;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (!(EventLog.SourceExists(Source, ComputerName)))
|
||||
|
@ -866,12 +906,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public Int32 RetentionDays
|
||||
{
|
||||
get { return _retention; }
|
||||
|
||||
set
|
||||
{
|
||||
_retention = value;
|
||||
_retentionSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private Int32 _retention;
|
||||
private bool _retentionSpecified = false;
|
||||
/// <summary>
|
||||
|
@ -885,12 +927,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public System.Diagnostics.OverflowAction OverflowAction
|
||||
{
|
||||
get { return _overflowaction; }
|
||||
|
||||
set
|
||||
{
|
||||
_overflowaction = value;
|
||||
_overflowSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private System.Diagnostics.OverflowAction _overflowaction;
|
||||
private bool _overflowSpecified = false;
|
||||
/// <summary>
|
||||
|
@ -901,12 +945,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public Int64 MaximumSize
|
||||
{
|
||||
get { return _maximumKilobytes; }
|
||||
|
||||
set
|
||||
{
|
||||
_maximumKilobytes = value;
|
||||
_maxkbSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private Int64 _maximumKilobytes;
|
||||
private bool _maxkbSpecified = false;
|
||||
#endregion Parameters
|
||||
|
@ -941,6 +987,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
computer = compname;
|
||||
}
|
||||
|
||||
foreach (string logname in LogName)
|
||||
{
|
||||
try
|
||||
|
@ -992,6 +1039,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
newLog.ModifyOverflowPolicy(_overflowaction, _minRetention);
|
||||
}
|
||||
|
||||
if (_maxkbSpecified)
|
||||
{
|
||||
int kiloByte = 1024;
|
||||
|
@ -1021,6 +1069,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
WriteNonTerminatingError(ex, EventlogResources.ValueOutofRange, "ValueOutofRange", ErrorCategory.InvalidData, null, null);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1210,6 +1259,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
computer = compname;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
foreach (string _sourceName in Source)
|
||||
|
@ -1326,6 +1376,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
computer = compName;
|
||||
}
|
||||
|
||||
if (ParameterSetName.Equals("Default"))
|
||||
{
|
||||
foreach (string log in LogName)
|
||||
|
@ -1338,6 +1389,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
EventLog.Delete(log, compName);
|
||||
}
|
||||
else
|
||||
|
@ -1367,6 +1419,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
EventLog.DeleteEventSource(src, compName);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _paths;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_paths = value;
|
||||
|
@ -76,6 +77,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return base.Filter;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
base.Filter = value;
|
||||
|
@ -127,6 +129,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _recurse;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_recurse = value;
|
||||
|
@ -146,6 +149,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _depth;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_depth = value;
|
||||
|
@ -172,6 +176,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return base.Force;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
base.Force = value;
|
||||
|
@ -188,6 +193,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _childNames;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_childNames = value;
|
||||
|
@ -232,12 +238,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
result = InvokeProvider.ChildItem.GetChildItemsDynamicParameters(path, Recurse, context);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
result = InvokeProvider.ChildItem.GetChildItemsDynamicParameters(path, Recurse, context);
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,12 +58,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public TextDataFormat TextFormatType
|
||||
{
|
||||
get { return _textFormat; }
|
||||
|
||||
set
|
||||
{
|
||||
_isTextFormatTypeSet = true;
|
||||
_textFormat = value;
|
||||
}
|
||||
}
|
||||
|
||||
private TextDataFormat _textFormat = TextDataFormat.UnicodeText;
|
||||
private bool _isTextFormatTypeSet = false;
|
||||
|
||||
|
@ -74,12 +76,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter Raw
|
||||
{
|
||||
get { return _raw; }
|
||||
|
||||
set
|
||||
{
|
||||
_isRawSet = true;
|
||||
_raw = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _raw;
|
||||
private bool _isRawSet = false;
|
||||
|
||||
|
@ -140,6 +144,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<string> result = new List<string>();
|
||||
|
||||
// TextFormat default value is Text, by default it is same as Clipboard.GetText()
|
||||
|
@ -153,6 +158,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
string[] splitSymbol = { Environment.NewLine };
|
||||
result.AddRange(textContent.Split(splitSymbol, StringSplitOptions.None));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -166,12 +172,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<PSObject> result = new List<PSObject>();
|
||||
foreach (string filePath in Clipboard.GetFileDropList())
|
||||
{
|
||||
FileInfo file = new FileInfo(filePath);
|
||||
result.Add(WrapOutputInPSObject(file, filePath));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -199,6 +207,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
string childName = item.Name;
|
||||
result.AddOrSetProperty("PSChildName", childName);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -411,6 +411,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// consider there to be no license.
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -442,6 +443,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
status = (DeviceGuardSmartStatus)smartStatus;
|
||||
}
|
||||
|
||||
guard = wmiGuard.AsOutputType;
|
||||
}
|
||||
}
|
||||
|
@ -1538,6 +1540,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (temp != null)
|
||||
listHardware.Add(temp.Value);
|
||||
}
|
||||
|
||||
guard.RequiredSecurityProperties = listHardware.ToArray();
|
||||
|
||||
listHardware.Clear();
|
||||
|
@ -1548,6 +1551,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (temp != null)
|
||||
listHardware.Add(temp.Value);
|
||||
}
|
||||
|
||||
guard.AvailableSecurityProperties = listHardware.ToArray();
|
||||
|
||||
var listSoftware = new List<DeviceGuardSoftwareSecure>();
|
||||
|
@ -1558,6 +1562,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (temp != null)
|
||||
listSoftware.Add(temp.Value);
|
||||
}
|
||||
|
||||
guard.SecurityServicesConfigured = listSoftware.ToArray();
|
||||
|
||||
listSoftware.Clear();
|
||||
|
@ -1568,6 +1573,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (temp != null)
|
||||
listSoftware.Add(temp.Value);
|
||||
}
|
||||
|
||||
guard.SecurityServicesRunning = listSoftware.ToArray();
|
||||
}
|
||||
|
||||
|
@ -2481,6 +2487,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// System hardware security settings for administrator password status
|
||||
/// </summary>
|
||||
//public AdminPasswordStatus? CsAdminPasswordStatus { get; internal set; }
|
||||
|
||||
public HardwareSecurity? CsAdminPasswordStatus { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -2534,6 +2541,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Boot up state of the chassis
|
||||
/// </summary>
|
||||
//public ChassisBootupState? CsChassisBootupState { get; internal set; }
|
||||
|
||||
public SystemElementState? CsChassisBootupState { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -2590,6 +2598,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Hardware security setting for the reset button on a computer
|
||||
/// </summary>
|
||||
//public FrontPanelResetStatus? CsFrontPanelResetStatus { get; internal set; }
|
||||
|
||||
public HardwareSecurity? CsFrontPanelResetStatus { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -2616,6 +2625,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// System hardware security setting for Keyboard Password Status
|
||||
/// </summary>
|
||||
//public KeyboardPasswordStatus? CsKeyboardPasswordStatus { get; internal set; }
|
||||
|
||||
public HardwareSecurity? CsKeyboardPasswordStatus { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -2727,6 +2737,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// System hardware security setting for Power-On Password Status
|
||||
/// </summary>
|
||||
//public PowerOnPasswordStatus? CsPowerOnPasswordStatus { get; internal set; }
|
||||
|
||||
public HardwareSecurity? CsPowerOnPasswordStatus { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -2738,6 +2749,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// State of the power supply or supplies when last booted
|
||||
/// </summary>
|
||||
//public PowerSupplyState? CsPowerSupplyState { get; internal set; }
|
||||
|
||||
public SystemElementState? CsPowerSupplyState { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -2808,6 +2820,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Thermal state of the system when last booted
|
||||
/// </summary>
|
||||
//public ThermalState? CsThermalState { get; internal set; }
|
||||
|
||||
public SystemElementState? CsThermalState { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -48,6 +48,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_totalCountSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _totalCountSpecified = false;
|
||||
|
||||
/// <summary>
|
||||
|
@ -62,8 +63,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
_backCount = value;
|
||||
_tailSpecified = true;
|
||||
}
|
||||
|
||||
get { return _backCount; }
|
||||
}
|
||||
|
||||
private int _backCount = -1;
|
||||
private bool _tailSpecified = false;
|
||||
|
||||
|
@ -85,6 +88,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Content.GetContentReaderDynamicParameters(Path[0], context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Content.GetContentReaderDynamicParameters(".", context);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
Path[0],
|
||||
SessionStateUtilities.ConvertArrayToCollection<string>(_property), context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Property.GetPropertyDynamicParameters(
|
||||
".",
|
||||
SessionStateUtilities.ConvertArrayToCollection<string>(_property), context);
|
||||
|
@ -248,6 +249,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
Path[0],
|
||||
SessionStateUtilities.ConvertArrayToCollection<string>(_property), context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Property.GetPropertyDynamicParameters(
|
||||
".",
|
||||
SessionStateUtilities.ConvertArrayToCollection<string>(_property), context);
|
||||
|
@ -275,6 +277,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
paths = new string[] { "." };
|
||||
}
|
||||
|
||||
foreach (string path in Path)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Property
|
||||
{
|
||||
get { return (string[])_property.Clone(); }
|
||||
|
||||
set { _property = value; }
|
||||
}
|
||||
|
||||
|
@ -101,6 +102,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
returnValue.Append(" where ");
|
||||
returnValue.Append(Filter);
|
||||
}
|
||||
|
||||
return returnValue.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -124,6 +126,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
filterClass = filterClass.Replace('?', '_');
|
||||
return filterClass;
|
||||
}
|
||||
|
||||
internal bool IsLocalizedNamespace(string sNamespace)
|
||||
{
|
||||
bool toReturn = false;
|
||||
|
@ -131,8 +134,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
toReturn = true;
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
internal bool ValidateClassFormat()
|
||||
{
|
||||
string filterClass = this.Class;
|
||||
|
@ -156,8 +161,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
newClassName.Append(']');
|
||||
continue;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
this.Class = newClassName.ToString();
|
||||
return true;
|
||||
}
|
||||
|
@ -181,6 +188,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
queryStringBuilder.Append(filterClass);
|
||||
queryStringBuilder.Append("'");
|
||||
}
|
||||
|
||||
ObjectQuery classQuery = new ObjectQuery(queryStringBuilder.ToString());
|
||||
|
||||
EnumerationOptions enumOptions = new EnumerationOptions();
|
||||
|
@ -219,6 +227,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteError(errorRecord);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (string name in ComputerName)
|
||||
{
|
||||
if (this.Recurse.IsPresent)
|
||||
|
@ -325,6 +334,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteError(errorRecord);
|
||||
continue;
|
||||
}
|
||||
|
||||
ManagementObjectSearcher searcher = this.GetObjectList(scope);
|
||||
if (searcher == null)
|
||||
continue;
|
||||
|
@ -334,6 +344,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (i < Id.Length - 1)
|
||||
QueryString.Append(" Or ");
|
||||
}
|
||||
|
||||
QueryString.Append(")");
|
||||
}
|
||||
else
|
||||
|
@ -110,6 +111,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
QueryString.Append("Select * from Win32_QuickFixEngineering");
|
||||
foundRecord = true;
|
||||
}
|
||||
|
||||
_searchProcess = new ManagementObjectSearcher(scope, new ObjectQuery(QueryString.ToString()));
|
||||
foreach (ManagementObject obj in _searchProcess.Get())
|
||||
{
|
||||
|
@ -153,11 +155,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteObject(obj);
|
||||
foundRecord = true;
|
||||
}
|
||||
|
||||
if (!foundRecord && !_inputContainsWildcard)
|
||||
{
|
||||
Exception Ex = new ArgumentException(StringUtil.Format(HotFixResources.NoEntriesFound, computer));
|
||||
WriteError(new ErrorRecord(Ex, "GetHotFixNoEntriesFound", ErrorCategory.ObjectNotFound, null));
|
||||
}
|
||||
|
||||
if (_searchProcess != null)
|
||||
{
|
||||
this.Dispose();
|
||||
|
@ -190,6 +194,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (WildcardPattern.ContainsWildcardCharacters(desc))
|
||||
{
|
||||
_inputContainsWildcard = true;
|
||||
|
@ -200,6 +205,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public ManagementObject InputObject
|
||||
{
|
||||
get { return _inputObject; }
|
||||
|
||||
set { _inputObject = value; }
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -39,6 +40,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string Path
|
||||
{
|
||||
get { return _path; }
|
||||
|
||||
set { _path = value; }
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -48,6 +50,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string Class
|
||||
{
|
||||
get { return _className; }
|
||||
|
||||
set { _className = value; }
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -57,6 +60,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string Name
|
||||
{
|
||||
get { return _methodName; }
|
||||
|
||||
set { _methodName = value; }
|
||||
}
|
||||
|
||||
|
@ -70,6 +74,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public object[] ArgumentList
|
||||
{
|
||||
get { return _argumentList; }
|
||||
|
||||
set { _argumentList = value; }
|
||||
}
|
||||
|
||||
|
@ -94,6 +99,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
RunAsJob("Invoke-WMIMethod");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_inputObject != null)
|
||||
{
|
||||
object result = null;
|
||||
|
@ -112,6 +118,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
inParamCount--;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ShouldProcess(
|
||||
StringUtil.Format(WmiResources.WmiMethodNameForConfirmation,
|
||||
_inputObject["__CLASS"].ToString(),
|
||||
|
@ -120,6 +127,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
result = _inputObject.InvokeMethod(_methodName, inputParameters, null);
|
||||
}
|
||||
catch (ManagementException e)
|
||||
|
@ -132,10 +140,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorRecord errorRecord = new ErrorRecord(e, "InvokeWMICOMException", ErrorCategory.InvalidOperation, null);
|
||||
WriteError(errorRecord);
|
||||
}
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
WriteObject(result);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -177,6 +187,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ComputerName = serverName;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string name in ComputerName)
|
||||
{
|
||||
result = null;
|
||||
|
@ -195,6 +206,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ManagementObject mInstance = new ManagementObject(mPath);
|
||||
mObject = mInstance;
|
||||
}
|
||||
|
||||
ManagementScope mScope = new ManagementScope(mPath, options);
|
||||
mObject.Scope = mScope;
|
||||
}
|
||||
|
@ -205,6 +217,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
mObject = mClass;
|
||||
mObject.Scope = scope;
|
||||
}
|
||||
|
||||
ManagementBaseObject inputParameters = mObject.GetMethodParameters(_methodName);
|
||||
if (_argumentList != null)
|
||||
{
|
||||
|
@ -222,9 +235,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
property.Value = argument;
|
||||
}
|
||||
|
||||
inParamCount--;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ShouldProcess(
|
||||
StringUtil.Format(WmiResources.WmiMethodNameForConfirmation,
|
||||
mObject["__CLASS"].ToString(),
|
||||
|
@ -233,6 +248,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
result = mObject.InvokeMethod(_methodName, inputParameters, null);
|
||||
}
|
||||
catch (ManagementException e)
|
||||
|
@ -245,6 +261,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorRecord errorRecord = new ErrorRecord(e, "InvokeWMICOMException", ErrorCategory.InvalidOperation, null);
|
||||
WriteError(errorRecord);
|
||||
}
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
WriteObject(result);
|
||||
|
@ -278,6 +295,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (needCopy)
|
||||
{
|
||||
var copiedArgument = new object[listArgument.Count];
|
||||
|
@ -286,6 +304,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
copiedArgument[index++] = argElement != null ? PSObject.Base(argElement) : null;
|
||||
}
|
||||
|
||||
return copiedArgument;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Path
|
||||
{
|
||||
get { return paths; }
|
||||
|
||||
set { paths = value; }
|
||||
}
|
||||
|
||||
|
@ -36,6 +37,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] LiteralPath
|
||||
{
|
||||
get { return paths; }
|
||||
|
||||
set
|
||||
{
|
||||
base.SuppressWildcardExpansion = true;
|
||||
|
@ -51,12 +53,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Name
|
||||
{
|
||||
get { return _property; }
|
||||
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = Utils.EmptyArray<string>();
|
||||
}
|
||||
|
||||
_property = value;
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +95,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Property.MovePropertyDynamicParameters(Path[0], propertyName, Destination, propertyName, context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Property.MovePropertyDynamicParameters(
|
||||
".",
|
||||
propertyName,
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
get => _suppressWildcardExpansion;
|
||||
set => _suppressWildcardExpansion = value;
|
||||
}
|
||||
|
||||
private bool _suppressWildcardExpansion;
|
||||
|
||||
/// <summary>
|
||||
|
@ -130,6 +131,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -373,6 +375,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
get => _stackSwitch;
|
||||
set => _stackSwitch = value;
|
||||
}
|
||||
|
||||
private bool _stackSwitch;
|
||||
|
||||
/// <summary>
|
||||
|
@ -573,6 +576,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// Get the current working directory using the core command API.
|
||||
WriteObject(SessionState.Path.CurrentLocation);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case StackParameterSet:
|
||||
|
@ -609,6 +613,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
argException));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -759,6 +764,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
argException.ErrorRecord,
|
||||
argException));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case StackParameterSet:
|
||||
|
@ -1135,6 +1141,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
get => _persist;
|
||||
set => _persist = value;
|
||||
}
|
||||
|
||||
private bool _persist = false;
|
||||
#endif
|
||||
/// <summary>
|
||||
|
@ -1457,6 +1464,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
results.Sort();
|
||||
return results;
|
||||
}
|
||||
|
@ -1610,6 +1618,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
invalidOperation));
|
||||
continue;
|
||||
}
|
||||
|
||||
SessionState.Drive.Remove(drive.Name, Force, Scope, CmdletProviderContext);
|
||||
}
|
||||
}
|
||||
|
@ -1930,6 +1939,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Item.GetItemDynamicParameters(Path[0], context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Item.GetItemDynamicParameters(".", context);
|
||||
}
|
||||
|
||||
|
@ -2074,6 +2084,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
else
|
||||
return InvokeProvider.Item.NewItemDynamicParameters(Path[0], ItemType, Value, context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Item.NewItemDynamicParameters(".", ItemType, Value, context);
|
||||
}
|
||||
|
||||
|
@ -2266,6 +2277,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Item.SetItemDynamicParameters(Path[0], Value, context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Item.SetItemDynamicParameters(".", Value, context);
|
||||
}
|
||||
|
||||
|
@ -2460,6 +2472,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Item.RemoveItemDynamicParameters(Path[0], Recurse, context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Item.RemoveItemDynamicParameters(".", Recurse, context);
|
||||
}
|
||||
|
||||
|
@ -2517,6 +2530,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
new Collection<string>(),
|
||||
null);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
resolvedPSPaths = SessionState.Path.GetResolvedPSPathFromPSPath(path, currentContext);
|
||||
|
@ -2710,6 +2724,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
shouldRecurse = true;
|
||||
}
|
||||
|
||||
|
@ -2893,6 +2908,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Item.MoveItemDynamicParameters(Path[0], Destination, context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Item.MoveItemDynamicParameters(".", Destination, context);
|
||||
}
|
||||
|
||||
|
@ -3295,6 +3311,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
pathNotFound.ErrorRecord,
|
||||
pathNotFound));
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
@ -3308,11 +3325,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
RenameItem(Path, literalPath: true);
|
||||
return;
|
||||
}
|
||||
|
||||
Collection<PathInfo> resolvedPaths = GetResolvedPaths(Path);
|
||||
if (resolvedPaths == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (resolvedPaths.Count == 1)
|
||||
{
|
||||
RenameItem(resolvedPaths[0].Path, literalPath: true);
|
||||
|
@ -3641,6 +3660,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Item.CopyItemDynamicParameters(Path[0], Destination, Recurse, context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Item.CopyItemDynamicParameters(".", Destination, Recurse, context);
|
||||
}
|
||||
|
||||
|
@ -3846,6 +3866,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Item.ClearItemDynamicParameters(Path[0], context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Item.ClearItemDynamicParameters(".", context);
|
||||
}
|
||||
|
||||
|
@ -4015,6 +4036,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Item.InvokeItemDynamicParameters(Path[0], context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Item.InvokeItemDynamicParameters(".", context);
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return base.Force;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
base.Force = value;
|
||||
|
@ -115,6 +116,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Property.NewPropertyDynamicParameters(Path[0], Name, PropertyType, Value, context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Property.NewPropertyDynamicParameters(".", Name, PropertyType, Value, context);
|
||||
}
|
||||
|
||||
|
|
|
@ -336,6 +336,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
separatorIndex + 1);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case parentSet:
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return base.Force;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
base.Force = value;
|
||||
|
|
|
@ -48,6 +48,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Path
|
||||
{
|
||||
get { return _paths; }
|
||||
|
||||
set { _paths = value; }
|
||||
}
|
||||
|
||||
|
@ -63,6 +64,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] LiteralPath
|
||||
{
|
||||
get { return _paths; }
|
||||
|
||||
set
|
||||
{
|
||||
base.SuppressWildcardExpansion = true;
|
||||
|
@ -77,6 +79,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public override string Filter
|
||||
{
|
||||
get { return base.Filter; }
|
||||
|
||||
set { base.Filter = value; }
|
||||
}
|
||||
|
||||
|
@ -87,6 +90,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public override string[] Include
|
||||
{
|
||||
get { return base.Include; }
|
||||
|
||||
set { base.Include = value; }
|
||||
}
|
||||
|
||||
|
@ -97,6 +101,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public override string[] Exclude
|
||||
{
|
||||
get { return base.Exclude; }
|
||||
|
||||
set { base.Exclude = value; }
|
||||
}
|
||||
|
||||
|
|
|
@ -91,12 +91,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _input;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
myMode = MatchMode.ByInput;
|
||||
_input = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Process[] _input = null;
|
||||
#endregion Parameters
|
||||
|
||||
|
@ -170,6 +172,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_matchingProcesses = new List<Process>(AllProcesses);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (string pattern in processNames)
|
||||
{
|
||||
WildcardPattern wildcard =
|
||||
|
@ -182,6 +185,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
found = true;
|
||||
AddIdempotent(process);
|
||||
}
|
||||
|
||||
if (!found &&
|
||||
!WildcardPattern.ContainsWildcardCharacters(pattern))
|
||||
{
|
||||
|
@ -211,6 +215,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
Diagnostics.Assert(false, "null processIds");
|
||||
throw PSTraceSource.NewInvalidOperationException();
|
||||
}
|
||||
|
||||
foreach (int processId in processIds)
|
||||
{
|
||||
Process process;
|
||||
|
@ -246,6 +251,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
Diagnostics.Assert(false, "null InputObject");
|
||||
throw PSTraceSource.NewInvalidOperationException();
|
||||
}
|
||||
|
||||
foreach (Process process in InputObject)
|
||||
{
|
||||
SafeRefresh(process);
|
||||
|
@ -272,9 +278,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
processes.AddRange(Process.GetProcesses());
|
||||
_allProcesses = processes.ToArray();
|
||||
}
|
||||
|
||||
return _allProcesses;
|
||||
}
|
||||
}
|
||||
|
||||
private Process[] _allProcesses = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -463,6 +471,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Name
|
||||
{
|
||||
get { return processNames; }
|
||||
|
||||
set
|
||||
{
|
||||
myMode = MatchMode.ByName;
|
||||
|
@ -482,6 +491,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return processIds;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
myMode = MatchMode.ById;
|
||||
|
@ -500,6 +510,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return base.InputObject;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
base.InputObject = value;
|
||||
|
@ -515,8 +526,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter IncludeUserName
|
||||
{
|
||||
get { return _includeUserName; }
|
||||
|
||||
set { _includeUserName = value; }
|
||||
}
|
||||
|
||||
private bool _includeUserName = false;
|
||||
|
||||
///<summary>
|
||||
|
@ -845,6 +858,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return processIds;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
myMode = MatchMode.ById;
|
||||
|
@ -865,6 +879,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Name
|
||||
{
|
||||
get { return processNames; }
|
||||
|
||||
set
|
||||
{
|
||||
myMode = MatchMode.ByName;
|
||||
|
@ -885,12 +900,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _timeout;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_timeout = value;
|
||||
_timeOutSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private int _timeout = 0;
|
||||
private bool _timeOutSpecified;
|
||||
|
||||
|
@ -911,6 +928,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_waitHandle.Dispose();
|
||||
_waitHandle = null;
|
||||
}
|
||||
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
|
@ -961,6 +979,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteNonTerminatingError(process, null, ProcessResources.WaitOnItself, "WaitOnItself", ErrorCategory.ObjectNotFound);
|
||||
continue;
|
||||
}
|
||||
|
||||
_processList.Add(process);
|
||||
}
|
||||
}
|
||||
|
@ -1002,6 +1021,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_waitHandle.WaitOne();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Process process in _processList)
|
||||
{
|
||||
try
|
||||
|
@ -1064,6 +1084,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return processNames;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
processNames = value;
|
||||
|
@ -1085,6 +1106,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return processIds;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
myMode = MatchMode.ById;
|
||||
|
@ -1107,6 +1129,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return base.InputObject;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
base.InputObject = value;
|
||||
|
@ -1121,6 +1144,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter PassThru
|
||||
{
|
||||
get { return _passThru; }
|
||||
|
||||
set { _passThru = value; }
|
||||
}
|
||||
|
||||
|
@ -1428,6 +1452,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return processIds;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
myMode = MatchMode.ById;
|
||||
|
@ -1448,6 +1473,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Name
|
||||
{
|
||||
get { return processNames; }
|
||||
|
||||
set
|
||||
{
|
||||
myMode = MatchMode.ByName;
|
||||
|
@ -1564,6 +1590,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
case 21: errorMessage = ProcessResources.AttachDebuggerReturnCode21; break;
|
||||
default: Diagnostics.Assert(false, "Unreachable code."); break;
|
||||
}
|
||||
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
|
@ -1609,12 +1636,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public PSCredential Credential
|
||||
{
|
||||
get { return _credential; }
|
||||
|
||||
set
|
||||
{
|
||||
_credential = value;
|
||||
_isDefaultSetParameterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private PSCredential _credential;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1632,12 +1661,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter LoadUserProfile
|
||||
{
|
||||
get { return _loaduserprofile; }
|
||||
|
||||
set
|
||||
{
|
||||
_loaduserprofile = value;
|
||||
_isDefaultSetParameterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter _loaduserprofile = SwitchParameter.Present;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1648,12 +1679,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter NoNewWindow
|
||||
{
|
||||
get { return _nonewwindow; }
|
||||
|
||||
set
|
||||
{
|
||||
_nonewwindow = value;
|
||||
_isDefaultSetParameterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter _nonewwindow;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1671,12 +1704,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string RedirectStandardError
|
||||
{
|
||||
get { return _redirectstandarderror; }
|
||||
|
||||
set
|
||||
{
|
||||
_redirectstandarderror = value;
|
||||
_isDefaultSetParameterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private string _redirectstandarderror;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1688,12 +1723,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string RedirectStandardInput
|
||||
{
|
||||
get { return _redirectstandardinput; }
|
||||
|
||||
set
|
||||
{
|
||||
_redirectstandardinput = value;
|
||||
_isDefaultSetParameterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private string _redirectstandardinput;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1705,12 +1742,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string RedirectStandardOutput
|
||||
{
|
||||
get { return _redirectstandardoutput; }
|
||||
|
||||
set
|
||||
{
|
||||
_redirectstandardoutput = value;
|
||||
_isDefaultSetParameterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private string _redirectstandardoutput;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1731,12 +1770,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public ProcessWindowStyle WindowStyle
|
||||
{
|
||||
get { return _windowstyle; }
|
||||
|
||||
set
|
||||
{
|
||||
_windowstyle = value;
|
||||
_windowstyleSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private ProcessWindowStyle _windowstyle = ProcessWindowStyle.Normal;
|
||||
private bool _windowstyleSpecified = false;
|
||||
|
||||
|
@ -1753,12 +1794,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter UseNewEnvironment
|
||||
{
|
||||
get { return _UseNewEnvironment; }
|
||||
|
||||
set
|
||||
{
|
||||
_UseNewEnvironment = value;
|
||||
_isDefaultSetParameterSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter _UseNewEnvironment;
|
||||
|
||||
#endregion
|
||||
|
@ -1827,6 +1870,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
startInfo.UseShellExecute = (ArgumentList == null);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ArgumentList != null)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -1835,6 +1879,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
sb.Append(str);
|
||||
sb.Append(' ');
|
||||
}
|
||||
|
||||
startInfo.Arguments = sb.ToString(); ;
|
||||
}
|
||||
|
||||
|
@ -1849,6 +1894,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteError(er);
|
||||
return;
|
||||
}
|
||||
|
||||
startInfo.WorkingDirectory = WorkingDirectory;
|
||||
}
|
||||
else
|
||||
|
@ -1892,6 +1938,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
startInfo.Domain = nwcredential.Domain;
|
||||
}
|
||||
|
||||
startInfo.Password = _credential.Password;
|
||||
}
|
||||
|
||||
|
@ -1953,6 +2000,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
else if (ParameterSetName.Equals("UseShellExecute"))
|
||||
{
|
||||
if (Verb != null) { startInfo.Verb = Verb; }
|
||||
|
||||
startInfo.WindowStyle = _windowstyle;
|
||||
}
|
||||
|
||||
|
@ -2074,6 +2122,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
processEnvironment.Remove(entry.Key.ToString());
|
||||
}
|
||||
|
||||
if (entry.Key.ToString().Equals("PATH"))
|
||||
{
|
||||
processEnvironment.Add(entry.Key.ToString(), Environment.GetEnvironmentVariable(entry.Key.ToString(), EnvironmentVariableTarget.Machine) + ";" + Environment.GetEnvironmentVariable(entry.Key.ToString(), EnvironmentVariableTarget.User));
|
||||
|
@ -2102,10 +2151,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
process.BeginOutputReadLine();
|
||||
}
|
||||
|
||||
if (process.StartInfo.RedirectStandardError)
|
||||
{
|
||||
process.BeginErrorReadLine();
|
||||
}
|
||||
|
||||
if (process.StartInfo.RedirectStandardInput)
|
||||
{
|
||||
WriteToStandardInput(process);
|
||||
|
@ -2114,6 +2165,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
process = StartWithCreateProcess(startInfo);
|
||||
#endif
|
||||
}
|
||||
|
||||
return process;
|
||||
}
|
||||
|
||||
|
@ -2156,6 +2208,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
_outputWriter.Dispose();
|
||||
}
|
||||
|
||||
if (_errorWriter != null)
|
||||
{
|
||||
_errorWriter.Dispose();
|
||||
|
@ -2216,6 +2269,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
string line = reader.ReadToEnd();
|
||||
writer.WriteLine(line);
|
||||
}
|
||||
|
||||
writer.Dispose();
|
||||
}
|
||||
#else
|
||||
|
@ -2239,6 +2293,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorRecord er = new ErrorRecord(new InvalidOperationException(message), "InvalidOperationException", ErrorCategory.InvalidOperation, null);
|
||||
ThrowTerminatingError(er);
|
||||
}
|
||||
|
||||
SafeFileHandle sf = new SafeFileHandle(hFileHandle, true);
|
||||
return sf;
|
||||
}
|
||||
|
@ -2252,16 +2307,19 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
builder.Append("\"");
|
||||
}
|
||||
|
||||
builder.Append(str);
|
||||
if (!flag)
|
||||
{
|
||||
builder.Append("\"");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(arguments))
|
||||
{
|
||||
builder.Append(" ");
|
||||
builder.Append(arguments);
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
@ -2281,6 +2339,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
builder.Append(strArray2[i]);
|
||||
builder.Append('\0');
|
||||
}
|
||||
|
||||
builder.Append('\0');
|
||||
|
||||
// Use Unicode encoding
|
||||
|
@ -2289,6 +2348,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
throw new InvalidOperationException("EnvironmentBlockTooLong");
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
@ -2395,6 +2455,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
AddressOfEnvironmentBlock = pinnedEnvironmentBlock.AddrOfPinnedObject();
|
||||
}
|
||||
}
|
||||
|
||||
bool flag;
|
||||
|
||||
if (_credential != null)
|
||||
|
@ -2435,6 +2496,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
er = er ?? new ErrorRecord(new InvalidOperationException(message), "InvalidOperationException", ErrorCategory.InvalidOperation, null);
|
||||
ThrowTerminatingError(er);
|
||||
}
|
||||
|
||||
goto Label_03AE;
|
||||
}
|
||||
finally
|
||||
|
@ -2496,6 +2558,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorRecord er = new ErrorRecord(new InvalidOperationException(message), "InvalidOperationException", ErrorCategory.InvalidOperation, null);
|
||||
ThrowTerminatingError(er);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
@ -2687,12 +2750,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
: base(true)
|
||||
{
|
||||
}
|
||||
|
||||
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
|
||||
internal SafeLocalMemHandle(IntPtr existingHandle, bool ownsHandle)
|
||||
: base(ownsHandle)
|
||||
{
|
||||
base.SetHandle(existingHandle);
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success), DllImport(PinvokeDllNames.LocalFreeDllName)]
|
||||
private static extern IntPtr LocalFree(IntPtr hMem);
|
||||
protected override bool ReleaseHandle()
|
||||
|
@ -2743,11 +2808,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
this.hStdInput.Dispose();
|
||||
this.hStdInput = null;
|
||||
}
|
||||
|
||||
if ((this.hStdOutput != null) && !this.hStdOutput.IsInvalid)
|
||||
{
|
||||
this.hStdOutput.Dispose();
|
||||
this.hStdOutput = null;
|
||||
}
|
||||
|
||||
if ((this.hStdError != null) && !this.hStdError.IsInvalid)
|
||||
{
|
||||
this.hStdError.Dispose();
|
||||
|
@ -2911,8 +2978,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string ProcessName
|
||||
{
|
||||
get { return _processName; }
|
||||
|
||||
set { _processName = value; }
|
||||
}
|
||||
|
||||
private string _processName = String.Empty;
|
||||
#endregion Properties
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _timeOut;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_timeOut = value;
|
||||
|
@ -85,6 +86,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
returnValue.Append(objectName);
|
||||
return returnValue.ToString();
|
||||
}
|
||||
|
||||
private string GetScopeString(string computer, string namespaceParameter)
|
||||
{
|
||||
StringBuilder returnValue = new StringBuilder("\\\\");
|
||||
|
@ -140,6 +142,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
conOptions.Username = cred.Domain + "\\" + cred.UserName;
|
||||
}
|
||||
|
||||
conOptions.Password = cred.Password;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Name
|
||||
{
|
||||
get { return _property; }
|
||||
|
||||
set { _property = value ?? Utils.EmptyArray<string>(); }
|
||||
}
|
||||
|
||||
|
@ -80,6 +81,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public override SwitchParameter Force
|
||||
{
|
||||
get { return base.Force; }
|
||||
|
||||
set { base.Force = value; }
|
||||
}
|
||||
|
||||
|
@ -107,6 +109,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Property.RemovePropertyDynamicParameters(Path[0], propertyName, context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Property.RemovePropertyDynamicParameters(".", propertyName, context);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public ManagementObject InputObject
|
||||
{
|
||||
get { return _inputObject; }
|
||||
|
||||
set { _inputObject = value; }
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -31,6 +32,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string Path
|
||||
{
|
||||
get { return _path; }
|
||||
|
||||
set { _path = value; }
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -40,6 +42,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string Class
|
||||
{
|
||||
get { return _className; }
|
||||
|
||||
set { _className = value; }
|
||||
}
|
||||
|
||||
|
@ -62,6 +65,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
RunAsJob("Remove-WMIObject");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_inputObject != null)
|
||||
{
|
||||
try
|
||||
|
@ -70,6 +74,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_inputObject.Delete();
|
||||
}
|
||||
catch (ManagementException e)
|
||||
|
@ -82,6 +87,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorRecord errorRecord = new ErrorRecord(e, "RemoveWMICOMException", ErrorCategory.InvalidOperation, null);
|
||||
WriteError(errorRecord);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -115,12 +121,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.InvalidOperation,
|
||||
this.ComputerName));
|
||||
}
|
||||
|
||||
if (!(mPath.Server == "." && serverNameSpecified))
|
||||
{
|
||||
string[] serverName = new string[] { mPath.Server };
|
||||
ComputerName = serverName;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string name in ComputerName)
|
||||
{
|
||||
try
|
||||
|
@ -138,6 +146,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ManagementObject mInstance = new ManagementObject(mPath);
|
||||
mObject = mInstance;
|
||||
}
|
||||
|
||||
ManagementScope mScope = new ManagementScope(mPath, options);
|
||||
mObject.Scope = mScope;
|
||||
}
|
||||
|
@ -148,10 +157,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
mObject = mClass;
|
||||
mObject.Scope = scope;
|
||||
}
|
||||
|
||||
if (!ShouldProcess(mObject["__PATH"].ToString()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
mObject.Delete();
|
||||
}
|
||||
catch (ManagementException e)
|
||||
|
|
|
@ -84,6 +84,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Property.RenamePropertyDynamicParameters(Path, Name, NewName, context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Property.RenamePropertyDynamicParameters(".", Name, NewName, context);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_relative = value;
|
||||
}
|
||||
}
|
||||
|
||||
private SwitchParameter _relative;
|
||||
|
||||
#endregion Parameters
|
||||
|
@ -115,6 +116,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteObject(currentPath.Path, enumerateCollection: false);
|
||||
continue;
|
||||
}
|
||||
|
||||
string adjustedPath = SessionState.Path.NormalizeRelativePath(currentPath.Path,
|
||||
SessionState.Path.CurrentLocation.ProviderPath);
|
||||
// Do not insert './' if result path is not relative
|
||||
|
@ -124,6 +126,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
adjustedPath = SessionState.Path.Combine(".", adjustedPath);
|
||||
}
|
||||
|
||||
WriteObject(adjustedPath, enumerateCollection: false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,12 +168,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return displayNames;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
displayNames = value;
|
||||
selectionMode = SelectionMode.DisplayName;
|
||||
}
|
||||
}
|
||||
|
||||
internal string[] displayNames = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -190,11 +192,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return include;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
include = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal string[] include = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -211,11 +215,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return exclude;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
exclude = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal string[] exclude = null;
|
||||
|
||||
// 1054295-2004/12/01-JonN This also works around 1054295.
|
||||
|
@ -237,12 +243,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _inputObject;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_inputObject = value;
|
||||
selectionMode = SelectionMode.InputObject;
|
||||
}
|
||||
}
|
||||
|
||||
private ServiceController[] _inputObject = null;
|
||||
#endregion Parameters
|
||||
|
||||
|
@ -265,9 +273,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
_allServices = ServiceController.GetServices();
|
||||
}
|
||||
|
||||
return _allServices;
|
||||
}
|
||||
}
|
||||
|
||||
private ServiceController[] _allServices = null;
|
||||
|
||||
internal ServiceController GetOneService(string nameOfService)
|
||||
|
@ -345,6 +355,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
IncludeExcludeAdd(matchingServices, service, false);
|
||||
}
|
||||
|
||||
return matchingServices;
|
||||
}
|
||||
|
||||
|
@ -385,6 +396,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.ObjectNotFound);
|
||||
}
|
||||
}
|
||||
|
||||
return matchingServices;
|
||||
}
|
||||
|
||||
|
@ -404,6 +416,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
Diagnostics.Assert(false, "null DisplayName");
|
||||
throw PSTraceSource.NewInvalidOperationException();
|
||||
}
|
||||
|
||||
foreach (string pattern in DisplayName)
|
||||
{
|
||||
WildcardPattern wildcard =
|
||||
|
@ -416,6 +429,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
found = true;
|
||||
IncludeExcludeAdd(matchingServices, service, true);
|
||||
}
|
||||
|
||||
if (!found && !WildcardPattern.ContainsWildcardCharacters(pattern))
|
||||
{
|
||||
WriteNonTerminatingError(
|
||||
|
@ -428,6 +442,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.ObjectNotFound);
|
||||
}
|
||||
}
|
||||
|
||||
return matchingServices;
|
||||
}
|
||||
|
||||
|
@ -444,11 +459,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
Diagnostics.Assert(false, "null InputObject");
|
||||
throw PSTraceSource.NewInvalidOperationException();
|
||||
}
|
||||
|
||||
foreach (ServiceController service in InputObject)
|
||||
{
|
||||
service.Refresh();
|
||||
IncludeExcludeAdd(matchingServices, service, false);
|
||||
}
|
||||
|
||||
return matchingServices;
|
||||
}
|
||||
|
||||
|
@ -481,6 +498,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
list.Add(service);
|
||||
}
|
||||
|
||||
|
@ -504,6 +522,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
if (wildcard.IsMatch(serviceID))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion Internal
|
||||
|
@ -537,6 +556,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return serviceNames;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
serviceNames = value;
|
||||
|
@ -581,6 +601,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
WriteObject(dependantserv);
|
||||
}
|
||||
}
|
||||
|
||||
if (RequiredServices.IsPresent)
|
||||
{
|
||||
foreach (ServiceController servicedependedon in service.ServicesDependedOn)
|
||||
|
@ -623,6 +644,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ServiceResources.FailToOpenServiceControlManager,
|
||||
ErrorCategory.PermissionDenied);
|
||||
}
|
||||
|
||||
hService = NativeMethods.OpenServiceW(
|
||||
hScManager,
|
||||
service.ServiceName,
|
||||
|
@ -700,6 +722,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return serviceAsPSObj;
|
||||
}
|
||||
}
|
||||
|
@ -728,6 +751,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return serviceNames;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
serviceNames = value;
|
||||
|
@ -747,6 +771,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return base.InputObject;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
base.InputObject = value;
|
||||
|
@ -824,6 +849,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.OpenError);
|
||||
return false;
|
||||
}
|
||||
|
||||
string message = StringUtil.Format(resourceIdPending,
|
||||
serviceController.ServiceName,
|
||||
serviceController.DisplayName
|
||||
|
@ -860,6 +886,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
exception = e;
|
||||
}
|
||||
}
|
||||
|
||||
if (exception != null)
|
||||
{
|
||||
// This service refused to accept the start command,
|
||||
|
@ -884,6 +911,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -976,6 +1004,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
exception = e;
|
||||
}
|
||||
}
|
||||
|
||||
if (exception != null)
|
||||
{
|
||||
// This service refused to accept the stop command,
|
||||
|
@ -1032,6 +1061,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1070,6 +1100,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
serviceNotRunning = true;
|
||||
}
|
||||
|
||||
exception = e;
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
|
@ -1080,8 +1111,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
serviceNotRunning = true;
|
||||
}
|
||||
|
||||
exception = e;
|
||||
}
|
||||
|
||||
if (exception != null)
|
||||
{
|
||||
// This service refused to accept the pause command,
|
||||
|
@ -1148,6 +1181,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
serviceNotRunning = true;
|
||||
}
|
||||
|
||||
exception = e;
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
|
@ -1158,8 +1192,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
serviceNotRunning = true;
|
||||
}
|
||||
|
||||
exception = e;
|
||||
}
|
||||
|
||||
if (exception != null)
|
||||
{
|
||||
// This service refused to accept the continue command,
|
||||
|
@ -1353,6 +1389,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (DoResumeService(serviceController))
|
||||
{
|
||||
if (PassThru)
|
||||
|
@ -1438,11 +1475,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
public new String Name
|
||||
{
|
||||
get { return serviceName; }
|
||||
|
||||
set
|
||||
{
|
||||
serviceName = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal String serviceName = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1464,11 +1503,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
public new string DisplayName
|
||||
{
|
||||
get { return displayName; }
|
||||
|
||||
set
|
||||
{
|
||||
displayName = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal string displayName = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1491,11 +1532,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string Description
|
||||
{
|
||||
get { return description; }
|
||||
|
||||
set
|
||||
{
|
||||
description = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal string description = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1511,6 +1554,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public ServiceStartupType StartupType
|
||||
{
|
||||
get { return startupType; }
|
||||
|
||||
set
|
||||
{
|
||||
startupType = value;
|
||||
|
@ -1533,11 +1577,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string Status
|
||||
{
|
||||
get { return serviceStatus; }
|
||||
|
||||
set
|
||||
{
|
||||
serviceStatus = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal string serviceStatus = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1560,11 +1606,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return include;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
include = null;
|
||||
}
|
||||
}
|
||||
|
||||
internal new string[] include = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1578,11 +1626,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return exclude;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
exclude = null;
|
||||
}
|
||||
}
|
||||
|
||||
internal new string[] exclude = null;
|
||||
#endregion Parameters
|
||||
|
||||
|
@ -1609,6 +1659,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
service = new ServiceController(serviceName);
|
||||
objServiceShouldBeDisposed = true;
|
||||
}
|
||||
|
||||
Diagnostics.Assert(!String.IsNullOrEmpty(Name), "null ServiceName");
|
||||
|
||||
// "new ServiceController" will succeed even if
|
||||
|
@ -1663,6 +1714,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.PermissionDenied);
|
||||
return;
|
||||
}
|
||||
|
||||
hService = NativeMethods.OpenServiceW(
|
||||
hScManager,
|
||||
Name,
|
||||
|
@ -1700,6 +1752,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
username = Credential.UserName;
|
||||
password = Marshal.SecureStringToCoTaskMemUnicode(Credential.Password);
|
||||
}
|
||||
|
||||
bool succeeded = NativeMethods.ChangeServiceConfigW(
|
||||
hService,
|
||||
NativeMethods.SERVICE_NO_CHANGE,
|
||||
|
@ -1816,6 +1869,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PassThru.IsPresent)
|
||||
{
|
||||
// To display the service, refreshing the service would not show the display name after updating
|
||||
|
@ -1829,6 +1883,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
Marshal.FreeCoTaskMem(delayedAutoStartInfoBuffer);
|
||||
}
|
||||
|
||||
if (IntPtr.Zero != hService)
|
||||
{
|
||||
bool succeeded = NativeMethods.CloseServiceHandle(hService);
|
||||
|
@ -1868,6 +1923,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
Marshal.ZeroFreeCoTaskMemUnicode(password);
|
||||
}
|
||||
|
||||
if (objServiceShouldBeDisposed)
|
||||
{
|
||||
service.Dispose();
|
||||
|
@ -1897,8 +1953,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string Name
|
||||
{
|
||||
get { return serviceName; }
|
||||
|
||||
set { serviceName = value; }
|
||||
}
|
||||
|
||||
internal string serviceName = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1910,8 +1968,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string BinaryPathName
|
||||
{
|
||||
get { return binaryPathName; }
|
||||
|
||||
set { binaryPathName = value; }
|
||||
}
|
||||
|
||||
internal string binaryPathName = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1923,8 +1983,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string DisplayName
|
||||
{
|
||||
get { return displayName; }
|
||||
|
||||
set { displayName = value; }
|
||||
}
|
||||
|
||||
internal string displayName = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1936,8 +1998,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string Description
|
||||
{
|
||||
get { return description; }
|
||||
|
||||
set { description = value; }
|
||||
}
|
||||
|
||||
internal string description = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1948,8 +2012,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public ServiceStartupType StartupType
|
||||
{
|
||||
get { return startupType; }
|
||||
|
||||
set { startupType = value; }
|
||||
}
|
||||
|
||||
internal ServiceStartupType startupType = ServiceStartupType.Automatic;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1961,8 +2027,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public PSCredential Credential
|
||||
{
|
||||
get { return credential; }
|
||||
|
||||
set { credential = value; }
|
||||
}
|
||||
|
||||
internal PSCredential credential = null;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1973,8 +2041,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] DependsOn
|
||||
{
|
||||
get { return dependsOn; }
|
||||
|
||||
set { dependsOn = value; }
|
||||
}
|
||||
|
||||
internal string[] dependsOn = null;
|
||||
#endregion Parameters
|
||||
|
||||
|
@ -2023,6 +2093,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.PermissionDenied);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!NativeMethods.TryGetNativeStartupType(StartupType, out DWORD dwStartType))
|
||||
{
|
||||
WriteNonTerminatingError(StartupType.ToString(), "New-Service", Name,
|
||||
|
@ -2040,6 +2111,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
numchars += dependedOn.Length + 1;
|
||||
}
|
||||
|
||||
char[] doubleNullArray = new char[numchars];
|
||||
int pos = 0;
|
||||
foreach (string dependedOn in DependsOn)
|
||||
|
@ -2052,6 +2124,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
pos += dependedOn.Length;
|
||||
doubleNullArray[pos++] = (char)0; // null terminator
|
||||
}
|
||||
|
||||
doubleNullArray[pos++] = (char)0; // double-null terminator
|
||||
Diagnostics.Assert(pos == numchars, "lpDependencies build error");
|
||||
lpDependencies = Marshal.AllocHGlobal(
|
||||
|
@ -2262,6 +2335,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
service = new ServiceController(Name);
|
||||
objServiceShouldBeDisposed = true;
|
||||
}
|
||||
|
||||
Diagnostics.Assert(!String.IsNullOrEmpty(Name), "null ServiceName");
|
||||
|
||||
// "new ServiceController" will succeed even if there is no such service.
|
||||
|
@ -2314,6 +2388,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.PermissionDenied);
|
||||
return;
|
||||
}
|
||||
|
||||
hService = NativeMethods.OpenServiceW(
|
||||
hScManager,
|
||||
Name,
|
||||
|
@ -2463,8 +2538,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string ServiceName
|
||||
{
|
||||
get { return _serviceName; }
|
||||
|
||||
set { _serviceName = value; }
|
||||
}
|
||||
|
||||
private string _serviceName = String.Empty;
|
||||
#endregion Properties
|
||||
}
|
||||
|
@ -2706,6 +2783,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
Marshal.FreeCoTaskMem(lpBuffer);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -2744,6 +2822,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
Marshal.FreeCoTaskMem(lpBuffer);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -2782,6 +2861,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -2800,6 +2880,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
result = ServiceStartupType.Disabled;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,12 +70,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter AsHtml
|
||||
{
|
||||
get { return _asHtml; }
|
||||
|
||||
set
|
||||
{
|
||||
_isHtmlSet = true;
|
||||
_asHtml = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _asHtml;
|
||||
private bool _isHtmlSet = false;
|
||||
|
||||
|
@ -150,6 +152,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
Clipboard.Clear();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -417,6 +420,7 @@ EndSelection:<<<<<<<<4";
|
|||
_byteCount[0] = sb[i];
|
||||
count += Encoding.UTF8.GetByteCount(_byteCount);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] Path
|
||||
{
|
||||
get { return paths; }
|
||||
|
||||
set { paths = value; }
|
||||
}
|
||||
|
||||
|
@ -45,6 +46,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] LiteralPath
|
||||
{
|
||||
get { return paths; }
|
||||
|
||||
set
|
||||
{
|
||||
base.SuppressWildcardExpansion = true;
|
||||
|
@ -123,6 +125,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
mshObject = new PSObject();
|
||||
mshObject.Properties.Add(new PSNoteProperty(Name, Value));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -134,6 +137,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return InvokeProvider.Property.SetPropertyDynamicParameters(Path[0], mshObject, context);
|
||||
}
|
||||
|
||||
return InvokeProvider.Property.SetPropertyDynamicParameters(".", mshObject, context);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public PutType PutType
|
||||
{
|
||||
get { return _putType; }
|
||||
|
||||
set { _putType = value; flagSpecified = true; }
|
||||
}
|
||||
|
||||
|
@ -79,6 +80,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
RunAsJob("Set-WMIInstance");
|
||||
return;
|
||||
}
|
||||
|
||||
if (InputObject != null)
|
||||
{
|
||||
object result = null;
|
||||
|
@ -94,6 +96,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mObj.Put(pOptions);
|
||||
}
|
||||
else
|
||||
|
@ -101,6 +104,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
InvalidOperationException exp = new InvalidOperationException();
|
||||
throw exp;
|
||||
}
|
||||
|
||||
result = mObj;
|
||||
}
|
||||
catch (ManagementException e)
|
||||
|
@ -113,6 +117,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorRecord errorRecord = new ErrorRecord(e, "SetWMICOMException", ErrorCategory.InvalidOperation, null);
|
||||
WriteError(errorRecord);
|
||||
}
|
||||
|
||||
WriteObject(result);
|
||||
}
|
||||
else
|
||||
|
@ -129,6 +134,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ComputerName = serverName;
|
||||
}
|
||||
}
|
||||
|
||||
ConnectionOptions options = GetConnectionOption();
|
||||
object result = null;
|
||||
ManagementObject mObject = null;
|
||||
|
@ -146,6 +152,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
mObject.Put(pOptions);
|
||||
}
|
||||
else
|
||||
|
@ -153,6 +160,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
InvalidOperationException exp = new InvalidOperationException();
|
||||
throw exp;
|
||||
}
|
||||
|
||||
result = mObject;
|
||||
}
|
||||
catch (ManagementException e)
|
||||
|
@ -165,6 +173,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorRecord errorRecord = new ErrorRecord(e, "SetWMICOMException", ErrorCategory.InvalidOperation, null);
|
||||
WriteError(errorRecord);
|
||||
}
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
WriteObject(result);
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return (int)_timeout.TotalMinutes;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
// The transactions constructor treats a timeout of
|
||||
|
@ -37,6 +38,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_timeoutSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _timeoutSpecified = false;
|
||||
private TimeSpan _timeout = TimeSpan.MinValue;
|
||||
|
||||
|
@ -48,8 +50,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public SwitchParameter Independent
|
||||
{
|
||||
get { return _independent; }
|
||||
|
||||
set { _independent = value; }
|
||||
}
|
||||
|
||||
private SwitchParameter _independent;
|
||||
|
||||
/// <summary>
|
||||
|
@ -59,8 +63,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public RollbackSeverity RollbackPreference
|
||||
{
|
||||
get { return _rollbackPreference; }
|
||||
|
||||
set { _rollbackPreference = value; }
|
||||
}
|
||||
|
||||
private RollbackSeverity _rollbackPreference = RollbackSeverity.Error;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -25,11 +25,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return _transactedScript;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_transactedScript = value;
|
||||
}
|
||||
}
|
||||
|
||||
private ScriptBlock _transactedScript;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
return internalException;
|
||||
}
|
||||
}
|
||||
|
||||
protected Exception internalException = null;
|
||||
}
|
||||
|
||||
|
@ -93,6 +94,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
internal WmiState State
|
||||
{
|
||||
get { return _state; }
|
||||
|
||||
set { _state = value; }
|
||||
}
|
||||
|
||||
|
@ -122,6 +124,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
returnValue.Append(" where ");
|
||||
returnValue.Append(getObject.Filter);
|
||||
}
|
||||
|
||||
return returnValue.ToString();
|
||||
}
|
||||
|
||||
|
@ -155,6 +158,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
return;
|
||||
}
|
||||
|
||||
thread.IsBackground = true;
|
||||
//thread.SetApartmentState( ApartmentState.STA);
|
||||
thread.Start();
|
||||
|
@ -212,6 +216,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
return;
|
||||
}
|
||||
|
||||
mObj = ((ManagementClass)setObject.InputObject).CreateInstance();
|
||||
setObject.PutType = PutType.CreateOnly;
|
||||
}
|
||||
|
@ -236,6 +241,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
mObj = (ManagementObject)setObject.InputObject.Clone();
|
||||
}
|
||||
|
||||
if (setObject.Arguments != null)
|
||||
{
|
||||
IDictionaryEnumerator en = setObject.Arguments.GetEnumerator();
|
||||
|
@ -244,6 +250,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
mObj[en.Key as string] = en.Value;
|
||||
}
|
||||
}
|
||||
|
||||
pOptions.Type = setObject.PutType;
|
||||
if (mObj != null)
|
||||
{
|
||||
|
@ -290,6 +297,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
return;
|
||||
}
|
||||
|
||||
setObject.PutType = PutType.CreateOnly;
|
||||
}
|
||||
else
|
||||
|
@ -316,6 +324,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPath.IsClass)
|
||||
{
|
||||
if (setObject.flagSpecified && setObject.PutType != PutType.CreateOnly)
|
||||
|
@ -326,6 +335,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
return;
|
||||
}
|
||||
|
||||
setObject.PutType = PutType.CreateOnly;
|
||||
}
|
||||
else
|
||||
|
@ -355,6 +365,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_computerName = mPath.Server;
|
||||
}
|
||||
}
|
||||
|
||||
ConnectionOptions options = setObject.GetConnectionOption();
|
||||
ManagementObject mObject = null;
|
||||
try
|
||||
|
@ -387,6 +398,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
return;
|
||||
}
|
||||
|
||||
int namespaceIndex = setObject.Path.IndexOf(':');
|
||||
if (namespaceIndex == -1)
|
||||
{
|
||||
|
@ -395,6 +407,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
return;
|
||||
}
|
||||
|
||||
int classIndex = (setObject.Path.Substring(namespaceIndex)).IndexOf('.');
|
||||
if (classIndex == -1)
|
||||
{
|
||||
|
@ -410,6 +423,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
mClass.Scope = mScope;
|
||||
mInstance = mClass.CreateInstance();
|
||||
}
|
||||
|
||||
mObject = mInstance;
|
||||
}
|
||||
}
|
||||
|
@ -420,6 +434,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
mClass.Scope = scope;
|
||||
mObject = mClass.CreateInstance();
|
||||
}
|
||||
|
||||
if (setObject.Arguments != null)
|
||||
{
|
||||
IDictionaryEnumerator en = setObject.Arguments.GetEnumerator();
|
||||
|
@ -428,6 +443,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
mObject[en.Key as string] = en.Value;
|
||||
}
|
||||
}
|
||||
|
||||
PutOptions pOptions = new PutOptions();
|
||||
pOptions.Type = setObject.PutType;
|
||||
if (mObject != null)
|
||||
|
@ -489,6 +505,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
inParamCount--;
|
||||
}
|
||||
}
|
||||
|
||||
invokeObject.InputObject.InvokeMethod(_results, invokeObject.Name, inputParameters, null);
|
||||
}
|
||||
catch (ManagementException e)
|
||||
|
@ -509,6 +526,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_state = WmiState.Failed;
|
||||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -581,6 +599,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ManagementObject mInstance = new ManagementObject(mPath);
|
||||
mObject = mInstance;
|
||||
}
|
||||
|
||||
ManagementScope mScope = new ManagementScope(mPath, options);
|
||||
mObject.Scope = mScope;
|
||||
}
|
||||
|
@ -719,6 +738,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_state = WmiState.Failed;
|
||||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -750,11 +770,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(mPath.Server == "." && removeObject.serverNameSpecified))
|
||||
{
|
||||
_computerName = mPath.Server;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (removeObject.Path != null)
|
||||
|
@ -770,6 +792,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ManagementObject mInstance = new ManagementObject(mPath);
|
||||
mObject = mInstance;
|
||||
}
|
||||
|
||||
ManagementScope mScope = new ManagementScope(mPath, options);
|
||||
mObject.Scope = mScope;
|
||||
}
|
||||
|
@ -780,6 +803,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
mObject = mClass;
|
||||
mObject.Scope = scope;
|
||||
}
|
||||
|
||||
mObject.Delete(_results);
|
||||
}
|
||||
catch (ManagementException e)
|
||||
|
@ -826,6 +850,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (getObject.Recurse.IsPresent)
|
||||
|
@ -849,6 +874,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
namespaceArray.Add(connectNamespace + "\\" + obj["Name"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (topNamespace)
|
||||
{
|
||||
topNamespace = false;
|
||||
|
@ -858,6 +884,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
sinkArray.Add(_job.GetNewSink());
|
||||
}
|
||||
|
||||
connectArray.Add(scope);
|
||||
currentNamespaceCount++;
|
||||
}
|
||||
|
@ -880,6 +907,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
currentNamespaceCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (topNamespace)
|
||||
{
|
||||
topNamespace = false;
|
||||
|
@ -889,6 +917,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
searcher.Get((ManagementOperationObserver)sinkArray[currentNamespaceCount]);
|
||||
}
|
||||
|
||||
currentNamespaceCount++;
|
||||
}
|
||||
}
|
||||
|
@ -920,8 +949,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
_state = WmiState.Failed;
|
||||
RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
string queryString = string.IsNullOrEmpty(getObject.Query) ? GetWmiQueryString() : getObject.Query;
|
||||
ObjectQuery query = new ObjectQuery(queryString.ToString());
|
||||
try
|
||||
|
@ -1110,6 +1141,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string[] ComputerName
|
||||
{
|
||||
get { return _computerName; }
|
||||
|
||||
set { _computerName = value; serverNameSpecified = true; }
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -1124,6 +1156,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string Namespace
|
||||
{
|
||||
get { return _nameSpace; }
|
||||
|
||||
set { _nameSpace = value; namespaceSpecified = true; }
|
||||
}
|
||||
#endregion Parameters
|
||||
|
@ -1171,6 +1204,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
options.SecurePassword = this.Credential.Password;
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -1208,11 +1242,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
int namespaceIndex = setObject.Path.IndexOf(':');
|
||||
if (namespaceIndex == -1)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
int classIndex = (setObject.Path.Substring(namespaceIndex)).IndexOf('.');
|
||||
if (classIndex == -1)
|
||||
{
|
||||
|
@ -1225,6 +1261,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
mClass.Scope = mScope;
|
||||
mInstance = mClass.CreateInstance();
|
||||
}
|
||||
|
||||
mObject = mInstance;
|
||||
}
|
||||
}
|
||||
|
@ -1235,6 +1272,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
mClass.Scope = scope;
|
||||
mObject = mClass.CreateInstance();
|
||||
}
|
||||
|
||||
if (setObject.Arguments != null)
|
||||
{
|
||||
IDictionaryEnumerator en = setObject.Arguments.GetEnumerator();
|
||||
|
@ -1244,6 +1282,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mObject;
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -1267,6 +1306,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.InvalidOperation,
|
||||
wmiInstance.PutType));
|
||||
}
|
||||
|
||||
wmiInstance.PutType = PutType.CreateOnly;
|
||||
}
|
||||
else
|
||||
|
@ -1295,6 +1335,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.InvalidOperation,
|
||||
wmiInstance.ComputerName));
|
||||
}
|
||||
|
||||
if (mPath.IsClass)
|
||||
{
|
||||
if (wmiInstance.flagSpecified && wmiInstance.PutType != PutType.CreateOnly)
|
||||
|
@ -1306,6 +1347,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.InvalidOperation,
|
||||
wmiInstance.PutType));
|
||||
}
|
||||
|
||||
wmiInstance.PutType = PutType.CreateOnly;
|
||||
}
|
||||
else
|
||||
|
@ -1329,6 +1371,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mPath;
|
||||
}
|
||||
|
||||
|
@ -1357,6 +1400,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
ErrorCategory.InvalidOperation,
|
||||
wmiInstance.PutType));
|
||||
}
|
||||
|
||||
mObj = ((ManagementClass)wmiInstance.InputObject).CreateInstance();
|
||||
wmiInstance.PutType = PutType.CreateOnly;
|
||||
}
|
||||
|
@ -1382,6 +1426,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
mObj = (ManagementObject)wmiInstance.InputObject.Clone();
|
||||
}
|
||||
|
||||
if (wmiInstance.Arguments != null)
|
||||
{
|
||||
IDictionaryEnumerator en = wmiInstance.Arguments.GetEnumerator();
|
||||
|
@ -1392,6 +1437,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mObj;
|
||||
}
|
||||
|
||||
|
@ -1405,6 +1451,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
((System.Management.Automation.Runspaces.LocalRunspace)_context.CurrentRunspace).JobRepository.Add(wmiJob);
|
||||
}
|
||||
|
||||
WriteObject(wmiJob);
|
||||
}
|
||||
// Get the PowerShell execution context if it's available at cmdlet creation time...
|
||||
|
@ -1435,6 +1482,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
job.JobUnblocked += new EventHandler(HandleJobUnblocked);
|
||||
ChildJobs.Add(job);
|
||||
}
|
||||
|
||||
CommonInit(throttleLimt);
|
||||
}
|
||||
|
||||
|
@ -1496,6 +1544,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.JobStateInfo.State == JobState.Failed)
|
||||
{
|
||||
//If any of the child job failed, we set status to failed
|
||||
|
@ -1513,6 +1562,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
allChildJobsFinished = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (allChildJobsFinished)
|
||||
{
|
||||
//if any child job failed, set status to failed
|
||||
|
@ -1599,6 +1649,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
return ConstructLocation();
|
||||
}
|
||||
}
|
||||
|
||||
private String ConstructLocation()
|
||||
{
|
||||
StringBuilder location = new StringBuilder();
|
||||
|
@ -1608,6 +1659,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
location.Append(job.Location);
|
||||
location.Append(",");
|
||||
}
|
||||
|
||||
location.Remove(location.Length - 1, 1);
|
||||
|
||||
return location.ToString();
|
||||
|
@ -1647,6 +1699,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
StopJob();
|
||||
}
|
||||
|
||||
_throttleManager.Dispose();
|
||||
foreach (Job job in ChildJobs)
|
||||
{
|
||||
|
@ -1796,6 +1849,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
SetJobState(JobState.Running, null);
|
||||
JobUnblocked.SafeInvoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
internal ManagementOperationObserver GetNewSink()
|
||||
{
|
||||
ManagementOperationObserver wmiSink = new ManagementOperationObserver();
|
||||
|
@ -1804,6 +1858,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
_sinkCompleted++;
|
||||
}
|
||||
|
||||
wmiSink.ObjectReady += new ObjectReadyEventHandler(this.NewObject);
|
||||
wmiSink.Completed += new CompletedEventHandler(this.JobDone);
|
||||
return wmiSink;
|
||||
|
@ -1818,6 +1873,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
_bAtLeastOneObject = true;
|
||||
}
|
||||
|
||||
this.WriteObject(obj.NewObject);
|
||||
}
|
||||
|
||||
|
@ -1830,10 +1886,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
_sinkCompleted--;
|
||||
}
|
||||
|
||||
if (obj.Status != ManagementStatus.NoError)
|
||||
{
|
||||
_bJobFailed = true;
|
||||
}
|
||||
|
||||
if (_sinkCompleted == 0)
|
||||
{
|
||||
//Notify throttle manager and change the state to complete
|
||||
|
@ -1865,6 +1923,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
_sinkCompleted--;
|
||||
}
|
||||
|
||||
if (_sinkCompleted == 0)
|
||||
{
|
||||
_helper.RaiseOperationCompleteEvent(null, OperationState.StopComplete);
|
||||
|
@ -1929,6 +1988,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isDisposed;
|
||||
|
||||
/// <summary>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue