Quantcast
Channel: TechNet Technology News
Viewing all articles
Browse latest Browse all 13502

Resolving the Error: “File skipped because it was already present from Microsoft.PowerShell”

$
0
0

This error message - File skipped because it was already present from Microsoft.PowerShell - can appear when a workflow is run that is loading the Service Manager modules that are provided out of the box.  Something similar to this used to happen when loading the SMLets module in a workflow.  We fixed the SMLets issue in SMLets Beta 3, but now we are getting reports that this is also happening with the Service Module provided out of the box.  Here is an example:

http://social.technet.microsoft.com/Forums/en-US/systemcenterservicemanager/thread/bb0909c9-1589-4b60-957c-12b865e506eb

The symptom of this problem is that the first time the workflow runs it will do what it is supposed to do, but subsequent runs of the PowerShell in the workflow will fail because of this error.  The problem is that the workflow engine has already loaded the module into the PowerShell runspace.  When the script tells it to import the module again it fails.

 

To resolve this issue, Manoj Parvathaneni, one of our Senior Support Escalation Engineers, provides these instructions:

1. Comment out the following lines in the file Microsoft.EnterpriseManagement.Core.Cmdlets.psd1. The file can be found on the drive where SM is installed and under the following path Program Files\Microsoft System Center 2012\Service Manager\Powershell\Microsoft.EnterpriseManagement.Core.Cmdlets

# The type files (.ps1xml) loaded by this module.

TypesToProcess = 'Microsoft.EnterpriseManagement.Core.Cmdlets.Types.ps1xml'

# The format files (.ps1xml) loaded by this module.

FormatsToProcess = 'Microsoft.EnterpriseManagement.Core.Cmdlets.Format.ps1xml'

Basically add the # character at the beginning of the two code lines above. After the change it would look like the following:

# The type files (.ps1xml) loaded by this module.

#TypesToProcess = 'Microsoft.EnterpriseManagement.Core.Cmdlets.Types.ps1xml'

# The format files (.ps1xml) loaded by this module.

#FormatsToProcess = 'Microsoft.EnterpriseManagement.Core.Cmdlets.Format.ps1xml'

2. Comment the following lines in the file Microsoft.EnterpriseManagement.ServiceManager.Cmdlets.psd1. The file can be found on the drive where SM is installed and under the following path Program Files\Microsoft System Center 2012\Service Manager\Powershell\Microsoft.EnterpriseManagement.ServiceManager.Cmdlets

# The type files (.ps1xml) loaded by this module.

TypesToProcess = 'Microsoft.EnterpriseManagement.ServiceManager.Cmdlets.Types.ps1xml'

# The format files (.ps1xml) loaded by this module.

FormatsToProcess = 'Microsoft.EnterpriseManagement.ServiceManager.Cmdlets.Format.ps1xml'

Basically add the # character at the beginning of the two code lines above. After the change it would look like the following:

# The type files (.ps1xml) loaded by this module.

#TypesToProcess = 'Microsoft.EnterpriseManagement.ServiceManager.Cmdlets.Types.ps1xml'

# The format files (.ps1xml) loaded by this module.

#FormatsToProcess = 'Microsoft.EnterpriseManagement.ServiceManager.Cmdlets.Format.ps1xml'

3. Add the following entries to the end of the module file System.Center.Service.Manager.psm1. The file can be found on the drive where SM is installed and under the following path Program Files\Microsoft System Center 2012\Service Manager\Powershell.

$SMDIR    = (Get-ItemProperty 'hklm:/software/microsoft/System Center/2010/Service Manager/Setup').InstallDirectory

$SMPowerShell= "$SMDIR\Powershell"

Update-TypeData $SMPowerShell\Microsoft.EnterpriseManagement.Core.Cmdlets\Microsoft.EnterpriseManagement.Core.Cmdlets.Types.ps1xml,$SMPowerShell\Microsoft.EnterpriseManagement.ServiceManager.Cmdlets\Microsoft.EnterpriseManagement.ServiceManager.Cmdlets.Types.ps1xml -ErrorAction SilentlyContinue

Update-FormatData $SMPowerShell\Microsoft.EnterpriseManagement.Core.Cmdlets\Microsoft.EnterpriseManagement.Core.Cmdlets.Format.ps1xml,$SMPowerShell\Microsoft.EnterpriseManagement.ServiceManager.Cmdlets\Microsoft.EnterpriseManagement.ServiceManager.Cmdlets.Format.ps1xml  -ErrorAction SilentlyContinue

 

Thanks Manoj for providing this information!!


Viewing all articles
Browse latest Browse all 13502

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>