@@ -341,26 +341,6 @@ function Register-PSSessionConfiguration
341
341
[ ValidateSet ( "x86" , "amd64" ) ]
342
342
public string ProcessorArchitecture { get ; set ; }
343
343
344
- /// <summary>
345
- /// SessionType.
346
- /// </summary>
347
- /// Only want this on non assemblyName parameter set, since assembly decides the sessiontype.
348
- [ Parameter ( ParameterSetName = PSSessionConfigurationCommandBase . NameParameterSetName ) ]
349
- public PSSessionType SessionType
350
- {
351
- get
352
- {
353
- return sessionType ;
354
- }
355
-
356
- set
357
- {
358
- sessionType = value ;
359
- }
360
- }
361
-
362
- internal PSSessionType sessionType = PSSessionType . DefaultRemoteShell ;
363
-
364
344
#endregion
365
345
366
346
#region Constructors
@@ -648,7 +628,7 @@ protected override void ProcessRecord()
648
628
protected override void EndProcessing ( )
649
629
{
650
630
System . Management . Automation . Tracing . Tracer tracer = new System . Management . Automation . Tracing . Tracer ( ) ;
651
- tracer . EndpointRegistered ( this . Name , this . sessionType . ToString ( ) , WindowsIdentity . GetCurrent ( ) . Name ) ;
631
+ tracer . EndpointRegistered ( this . Name , WindowsIdentity . GetCurrent ( ) . Name ) ;
652
632
}
653
633
654
634
#endregion
@@ -821,28 +801,6 @@ private string ConstructPluginContent(out string srcConfigFilePath, out string d
821
801
StringBuilder initParameters = new StringBuilder ( ) ;
822
802
823
803
bool assemblyAndTypeTokensSet = false ;
824
- if ( sessionType == PSSessionType . Workflow )
825
- {
826
- initParameters . Append ( string . Format ( CultureInfo . InvariantCulture ,
827
- initParamFormat ,
828
- ConfigurationDataFromXML . ENDPOINTCONFIGURATIONTYPE ,
829
- sessionType ,
830
- Environment . NewLine ) ) ;
831
-
832
- initParameters . Append ( string . Format ( CultureInfo . InvariantCulture ,
833
- initParamFormat ,
834
- ConfigurationDataFromXML . ASSEMBLYTOKEN ,
835
- ConfigurationDataFromXML . WORKFLOWCOREASSEMBLY ,
836
- Environment . NewLine ) ) ;
837
-
838
- initParameters . Append ( string . Format ( CultureInfo . InvariantCulture ,
839
- initParamFormat ,
840
- ConfigurationDataFromXML . SHELLCONFIGTYPETOKEN ,
841
- ConfigurationDataFromXML . WORKFLOWCORETYPENAME ,
842
- Environment . NewLine ) ) ;
843
-
844
- assemblyAndTypeTokensSet = true ;
845
- }
846
804
847
805
// DISC endpoint
848
806
if ( Path != null )
@@ -1169,7 +1127,7 @@ private string ConstructPluginContent(out string srcConfigFilePath, out string d
1169
1127
tempValue ) ;
1170
1128
}
1171
1129
1172
- if ( sessionType == PSSessionType . Workflow && ! isUseSharedProcessSpecified )
1130
+ if ( ! isUseSharedProcessSpecified )
1173
1131
{
1174
1132
UseSharedProcess = true ;
1175
1133
}
@@ -1214,13 +1172,6 @@ private string ConstructPluginContent(out string srcConfigFilePath, out string d
1214
1172
1215
1173
StringBuilder sessionConfigurationData = new StringBuilder ( ) ;
1216
1174
1217
- if ( sessionType == PSSessionType . Workflow )
1218
- {
1219
- List < object > modifiedModulePath = new List < object > ( modulesToImport ?? Array . Empty < string > ( ) ) ;
1220
- modifiedModulePath . Insert ( 0 , ConfigurationDataFromXML . PSWORKFLOWMODULE ) ;
1221
- modulesToImport = modifiedModulePath . ToArray ( ) ;
1222
- }
1223
-
1224
1175
if ( modulesToImport != null && modulesToImport . Length > 0 )
1225
1176
{
1226
1177
sessionConfigurationData . Append ( string . Format ( CultureInfo . InvariantCulture ,
@@ -1262,7 +1213,7 @@ private string ConstructPluginContent(out string srcConfigFilePath, out string d
1262
1213
transportOption = transportOption . Clone ( ) as PSTransportOption ;
1263
1214
}
1264
1215
1265
- transportOption . LoadFromDefaults ( sessionType , true ) ;
1216
+ transportOption . LoadFromDefaults ( true ) ;
1266
1217
1267
1218
// If useSharedHost is set to false, we need to set hostIdleTimeout to 0 as well, else WS-Man throws error
1268
1219
if ( isUseSharedProcessSpecified && ! UseSharedProcess )
@@ -3783,23 +3734,20 @@ private void SetSessionConfigurationTypeOptions()
3783
3734
StringBuilder sessionConfigurationData = new StringBuilder ( ) ;
3784
3735
3785
3736
string modulePathParameter = null ;
3786
- string unsetModulePathStr = string . Empty ;
3787
3737
bool unsetModulePath = false ;
3788
3738
if ( modulePathSpecified )
3789
3739
{
3790
- bool isWorkflowConfiguration = IsWorkflowConfigurationType ( ps ) ;
3791
3740
if ( modulesToImport == null ||
3792
3741
modulesToImport . Length == 0 ||
3793
3742
( modulesToImport . Length == 1 && modulesToImport [ 0 ] is string && ( ( string ) modulesToImport [ 0 ] ) . Equals ( string . Empty , StringComparison . OrdinalIgnoreCase ) ) )
3794
3743
{
3795
3744
unsetModulePath = true ;
3796
- unsetModulePathStr = isWorkflowConfiguration ? ConfigurationDataFromXML . PSWORKFLOWMODULE : string . Empty ;
3797
3745
}
3798
3746
else
3799
3747
{
3800
3748
modulePathParameter = PSSessionConfigurationCommandUtilities . GetModulePathAsString ( this . modulesToImport ) . Trim ( ) ;
3801
3749
// Add the built-in module path if it's a workflow config
3802
- if ( ! string . IsNullOrEmpty ( modulePathParameter ) && isWorkflowConfiguration )
3750
+ if ( ! string . IsNullOrEmpty ( modulePathParameter ) )
3803
3751
{
3804
3752
List < object > modifiedModulePath = new List < object > ( modulesToImport ) ;
3805
3753
modifiedModulePath . Insert ( 0 , ConfigurationDataFromXML . PSWORKFLOWMODULE ) ;
@@ -3825,7 +3773,7 @@ private void SetSessionConfigurationTypeOptions()
3825
3773
{
3826
3774
sessionConfigurationData . Append ( string . Format ( CultureInfo . InvariantCulture ,
3827
3775
initParamFormat ,
3828
- PSSessionConfigurationData . ModulesToImportToken , unsetModulePathStr ) ) ;
3776
+ PSSessionConfigurationData . ModulesToImportToken , string . Empty ) ) ;
3829
3777
}
3830
3778
// unsetModulePath is false AND modulePathParameter is not empty.
3831
3779
// 1. modulePathSpecified is false. In this case, modulePathParameter will be the original module path.
@@ -3891,30 +3839,6 @@ protected override void EndProcessing()
3891
3839
3892
3840
#region Private Methods
3893
3841
3894
- /// <summary>
3895
- /// Check if the current configuration is a workflow endpoint.
3896
- /// </summary>
3897
- /// <returns></returns>
3898
- private bool IsWorkflowConfigurationType ( System . Management . Automation . PowerShell ps )
3899
- {
3900
- // Get the AssemblyName
3901
- ps . AddScript ( string . Format ( CultureInfo . InvariantCulture , getAssemblyNameDataFormat , CodeGeneration . EscapeSingleQuotedStringContent ( Name ) ) ) ;
3902
- Collection < PSObject > psObjectCollection = ps . Invoke ( new object [ ] { Name } ) as Collection < PSObject > ;
3903
- if ( psObjectCollection == null || psObjectCollection . Count != 1 )
3904
- {
3905
- Dbg . Assert ( false , "This should never happen. ps.Invoke always return a Collection<PSObject>" ) ;
3906
- }
3907
-
3908
- if ( psObjectCollection [ 0 ] == null )
3909
- {
3910
- // Not workflow endpoint, no assembly name
3911
- return false ;
3912
- }
3913
-
3914
- string assemblyNameOfCurrentConfiguration = psObjectCollection [ 0 ] . BaseObject . ToString ( ) ;
3915
- return assemblyNameOfCurrentConfiguration . Equals ( ConfigurationDataFromXML . WORKFLOWCOREASSEMBLY , StringComparison . OrdinalIgnoreCase ) ;
3916
- }
3917
-
3918
3842
private PSObject ConstructPropertiesForUpdate ( )
3919
3843
{
3920
3844
PSObject result = new PSObject ( ) ;
@@ -4000,14 +3924,6 @@ private PSObject ConstructPropertiesForUpdate()
4000
3924
{
4001
3925
using ( System . Management . Automation . PowerShell ps = System . Management . Automation . PowerShell . Create ( ) )
4002
3926
{
4003
- bool isWorkflowConfiguration = IsWorkflowConfigurationType ( ps ) ;
4004
- if ( ! string . IsNullOrEmpty ( modulePathParameter ) && isWorkflowConfiguration )
4005
- {
4006
- List < object > modifiedModulePath = new List < object > ( modulesToImport ) ;
4007
- modifiedModulePath . Insert ( 0 , ConfigurationDataFromXML . PSWORKFLOWMODULE ) ;
4008
- modulePathParameter = PSSessionConfigurationCommandUtilities . GetModulePathAsString ( modifiedModulePath . ToArray ( ) ) . Trim ( ) ;
4009
- }
4010
-
4011
3927
// Get the SessionConfigurationDataFormat
4012
3928
ps . AddScript ( string . Format ( CultureInfo . InvariantCulture , getSessionConfigurationDataSbFormat , CodeGeneration . EscapeSingleQuotedStringContent ( Name ) ) ) ;
4013
3929
Collection < PSObject > psObjectCollection = ps . Invoke ( new object [ ] { Name } ) as Collection < PSObject > ;
@@ -4045,10 +3961,9 @@ private PSObject ConstructPropertiesForUpdate()
4045
3961
// ModulesToImport exist in the pssessionConfigurationData
4046
3962
if ( scd . ModulesToImportInternal != null && scd . ModulesToImportInternal . Count != 0 )
4047
3963
{
4048
- string unsetModulePathStr = isWorkflowConfiguration ? ConfigurationDataFromXML . PSWORKFLOWMODULE : string . Empty ;
4049
3964
sessionConfigurationData . Append ( string . Format ( CultureInfo . InvariantCulture ,
4050
3965
initParamFormat ,
4051
- PSSessionConfigurationData . ModulesToImportToken , unsetModulePathStr ) ) ;
3966
+ PSSessionConfigurationData . ModulesToImportToken , string . Empty ) ) ;
4052
3967
if ( ! string . IsNullOrEmpty ( privateData ) )
4053
3968
{
4054
3969
sessionConfigurationData . Append ( string . Format ( CultureInfo . InvariantCulture , privateDataFormat , privateData ) ) ;
0 commit comments