locked
Problem with SMLets inside SCSM's workflow RRS feed

  • Question

  • Repro steps:

    1. Create simple workflow with authoring tools: based on scheduled, add 1 activity - powershellscript
    2. Add to this activity next script text:
      try
      {
      import-module SMLets -Force
      }
      catch
      {
       ($_ | ConvertTo-XML).Save("c:\Test_error.xml")
      }
    3. After executing of workflow file Test_error.xml contain message:
      System.Management.Automation.RuntimeException: The following error occurred while loading the extended type data file:
      Microsoft.PowerShell, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\SMLets\SMLets.Types.ps1xml : File skipped because it was already present from "Microsoft.PowerShell".
      Microsoft.PowerShell, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\SMLets\SMLets.Types.ps1xml : File skipped because it was already present from "Microsoft.PowerShell".
           at System.Management.Automation.Runspaces.FormatAndTypeDataHelper.ThrowExceptionOnError(String errorId, Collection`1 independentErrors, Collection`1 PSSnapinFilesCollection, RunspaceConfigurationCategory category)
         at System.Management.Automation.Runspaces.RunspaceConfiguration.UpdateTypes()
         at System.Management.Automation.Runspaces.RunspaceConfigurationEntryCollection`1.Update(Boolean force)
         at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(ExternalScriptInfo scriptInfo, ManifestProcessingFlags manifestProcessingFlags, Version version)</Property>
         

     After that no one cmlets from SMLets was not executed. Raised error "cmdlet or command not found"


    http://opsmgr.ru
    Thursday, November 25, 2010 8:08 PM

All replies

  • Hi Anton,

     

    did you try to remove-module at the end of the script? This works for me...

     

    Cheers,

    Andreas Rynes,

    Senior Consultant, Microsoft

    Monday, January 31, 2011 9:46 PM
  • But not for me (((

    More details: after execution count of "Microsoft.PowerShell, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\SMLets\SMLets.Types.ps1xml : File skipped because it was already present from "Microsoft.PowerShell"." grow at one. First execution - one line, second - two line and etc.


    http://opsmgr.ru
    Tuesday, February 1, 2011 9:20 PM
  • What's powershell's execution policy on your workflow account? If it's restricted it could explain why it's not loading the module
    Tuesday, February 1, 2011 10:09 PM
  • Yes, I read about this problem. Policy set to unrestricted.
    http://opsmgr.ru
    Wednesday, February 2, 2011 2:37 AM
  • I'm getting the same thing (File skipped because it was already present from "Microsoft.PowerShell") but I think it's happening because I have two custom workflows running at the same time. Has anyone had a similar issue with multiple workflows? Pete
    Monday, March 14, 2011 3:30 AM
  • Hey

    is it possible that you already loaded the snapIn/module in the workflow details and then again in the script itself?

    regards
    Marcel

    Tuesday, March 15, 2011 1:20 PM
  • same errore here...my workflow works if run alone. If two or more workflow runs at the same time I get the error -File skipped because it was already present from "Microsoft.PowerShell"-
    -- Donato Pasqualicchio System Administrator Bluarancio SPA
    Friday, March 18, 2011 2:12 PM
  • Hi all,

    Maybe you can check in the script if module is allready loaded and if it is not load it.

    This could be helpfull: http://blogs.technet.com/b/heyscriptingguy/archive/2010/07/11/hey-scripting-guy-weekend-scripter-checking-for-module-dependencies-in-windows-powershell.aspx

    Regards!


    http://www.purgar.net
    Wednesday, March 23, 2011 10:27 AM
  • Hi all,

    we encounter the same problem. As soon as two workflows are running at the same time the workflow doesn't work and in the JobStatus table I can see the following error:

    <Property Name="Message" Type="System.String">The following error occurred while loading the extended type data file: Microsoft.PowerShell, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\SMLets\SMLets.Types.ps1xml : File skipped because it was already present from "Microsoft.PowerShell".</Property>

    The script in the PowerShell activity checks if the module is loaded in the beginning and removes the module at the end:

    $a = (get-module|%{$_.name}) -join " "
    if(!$a.Contains("SMLets")){Import-Module SMLets -ErrorVariable err -Force}
    ....
    ....
    remove-module -name SMLets -force

    Does anyone found asolution for this?

    Regards
    gk


    gk
    Wednesday, May 25, 2011 5:44 PM
  • Same problem !!!

    Does anybody have a sollution or workaround?

    Tuesday, September 6, 2011 9:00 AM
  • Hello,

     

    if you use only some cmdelts (ex get-scsmobject/get-scsmclass/or abour relationship) try to import only what you need...

    i understand that by design import-module on directory import all ...

    in fact i have the same issue than you ... and the pb is just on "Types.ps1xml"

    try import just "smlets.module" (or an other if you need ...but not Types.ps1xml)  at the beggining of your script and maybe than works pretty fine ...

    import-module C:\Windows\System32\WindowsPowerShell\v1.0\Modules\SMLets\SMLets.Module.dll.

    regards

    • Proposed as answer by drouck Wednesday, January 4, 2012 2:28 PM
    Tuesday, January 3, 2012 2:05 PM
  • Hai, I am also facing the same problem while trying to import ActiveDirectory module using X86 version of powershell, if we follow the below instructions everything working fine.

    1. set the execution policy to unrestricted or remotly signed.

    2. Close and re-open the X86 powershell and try to import the module.

    But in my case i should not set execution policy to unrestricted or remotly signed, we should able to import the ActiveDirectory module when the set execution policy is set to all signed. The reason behind this is we execute all signed scripts and the import Active directory module is a part of the script.

    Any one have idea about this issue?

    Thanks in advance....

    Ramana


    ramana reddy

    Monday, May 21, 2012 1:03 PM
  • Hey guys,

    got the same issue here as well.

    Please see my reply in this thread: http://social.technet.microsoft.com/Forums/en-US/administration/thread/de7214e3-dc4a-492b-99eb-3141e6de3b20

    Any thoughts?

    Cheers

    Alex

    Wednesday, August 15, 2012 12:04 PM
  • I was having a similar problem, where I would load System.Center.Service.Manager.psd1 and then try to load Microsoft.EnterpriseManagement.Warehouse.Cmdlets.psd1 and it would complain that a format file was already loaded (Microsoft.EnterpriseManagement.Core.Cmdlets.Types.ps1xml). 

    I followed drouck's suggestion and just loaded the dll (Microsoft.EnterpriseManagement.Warehouse.Cmdlets.dll) and it worked like a charm. Thanks!

    Thursday, September 27, 2012 7:54 PM
  • Try this for the out of the box Service Manager modules:

    http://blogs.technet.com/b/servicemanager/archive/2013/01/10/resolving-the-error-file-skipped-because-it-was-already-present-from-microsoft-powershell.aspx


    Travis Wright, Principal Program Manager, Microsoft

    Thursday, January 10, 2013 10:24 PM