[VBScript] Aunty Mel's Cheap And Nasty SxS Package Extractor (Updated 2013/09/30)

Discussion in 'Scripting' started by SuperBubble, Sep 17, 2013.

  1. dhjohns

    dhjohns MDL Guru

    Sep 5, 2013
    3,275
    1,731
    120
    #81 dhjohns, Mar 27, 2017
    Last edited by a moderator: Apr 20, 2017
    I would like to extract the Edge Browser Package, but all this tool shows is this
    Code:
    1;    Microsoft-Desktop-DebugRegSvc-Package
    2;    Microsoft-Desktop-WebManagement-onecoreuap-Package
    3;    Microsoft-Desktop-WebManagement-Package
    4;    Microsoft-OneCore-DeveloperMode-Desktop-analog-Package
    5;    Microsoft-OneCore-DeveloperMode-Desktop-onecoreuap-Package
    6;    Microsoft-OneCore-DeveloperMode-Desktop-Package
    7;    Microsoft-OneCore-DevTools-Bootstrapping-Service-Package
    8;    Microsoft-OneCore-WebManagement-Package
    9;    Microsoft-Windows-Browser-Brokers-Package
    10;    Microsoft-Windows-InternetExplorer-Optional-Package
    11;    Microsoft-Windows-InternetExplorer-Package
    12;    Microsoft-Windows-Killbits-Package
    13;    Microsoft-Windows-Ssh-Server-Package
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,130
    24,051
    340
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. dhjohns

    dhjohns MDL Guru

    Sep 5, 2013
    3,275
    1,731
    120
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,130
    24,051
    340
    Are you checking online or in WIM? Got package removed eventually?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. dhjohns

    dhjohns MDL Guru

    Sep 5, 2013
    3,275
    1,731
    120
    I am online. I want to export the two cab files associated with the Edge Browser in 15063 so I can import to unsupported such as LTSB.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,130
    24,051
    340
    For LTSB i recommend to use 14393 Pro WIM, since LTSB is same build.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. dhjohns

    dhjohns MDL Guru

    Sep 5, 2013
    3,275
    1,731
    120
    Never the less, I would still like to learn how to extract the packages.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,130
    24,051
    340
    #88 s1ave77, Mar 27, 2017
    Last edited by a moderator: Apr 20, 2017
    With KNARZ script package it's pretty easy :D.

    Best is to place it in a folder near root of a drive/partition, i.e. d:\win. Create ImportList.txt next to Start.cmd with content:
    Code:
    Microsoft-Windows-Internet-Browser-Package
    Run Start.cmd as admin to export. Default is systems WinSxs folder.

    To export from mounted WIM, open SxsExport.cmd in _Helper folder and edit:

    Code:
    set Flag_AskImage=0
    
    to:
    
    set Flag_AskImage=1
    
    and rem out:
    
    set Path_Image=%SystemRoot%
    
    
    The script will ask to point it to the mount folder.

    The exported packages can be found in Output folder.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. dhjohns

    dhjohns MDL Guru

    Sep 5, 2013
    3,275
    1,731
    120
    #89 dhjohns, Mar 27, 2017
    Last edited by a moderator: Apr 20, 2017
    I do believe I have it. I did get this output though, but the file sizes are appropriate for the cabs I have for Edge from 14393.
    Code:
     >550
    In prog.: Microsoft-Windows-Internet-Browser-PackageC:\Export-System-Packages\_Helper\SxSExtract.vbs(924, 4) Microsoft VBScript runtime error: Path not found
    In prog.: Microsoft-Windows-Internet-Browser-Package (en-US)
    >
    It worked perfectly, many thanks, and kudos!!! :worthy::worthy::worthy:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,130
    24,051
    340
    #90 s1ave77, Mar 27, 2017
    Last edited by a moderator: Apr 20, 2017

    Interesting, that error is new to me :g:.

    EDIT: Seems =)(= made progress: https://forums.mydigitallife.net/th...0-Enterprise-LTSB/page7?p=1331956#post1331956
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. dhjohns

    dhjohns MDL Guru

    Sep 5, 2013
    3,275
    1,731
    120
    See previous post. It worked perfectly. I applied it to a build I made, and installed in Hyper-V in which I had previously removed Edge. After restart Edge was in start menu, and opened beautifully. This was on 15063. I would need to try it on 14393 LTSB just for s**ts, and giggles! :worthy::worthy::worthy:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. dhjohns

    dhjohns MDL Guru

    Sep 5, 2013
    3,275
    1,731
    120
    Does not work on 14963.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. mark2323

    mark2323 MDL Novice

    Nov 12, 2017
    1
    0
    0
    The tool is not listed to be downloaded anywhere... can you please fix this?
     
  14. ottoxas

    ottoxas MDL Novice

    Feb 23, 2018
    1
    0
    0
    someone reupload this
     
  15. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,053
    1,860
    210
  16. xinso

    xinso MDL Guru

    Mar 5, 2009
    4,242
    5,519
    150
    #96 xinso, Jun 15, 2018
    Last edited by a moderator: Jun 15, 2018
    Q: How to modify SxSExtract.vbs in order to extract a package into Folder without making Cab?
    A: My humble but working workaround

    Before

    Code:
        ' Make a cabinet file.
        If MakingCAB Then
            Call LogInfo("Compressing folder to cabinet file: " & AOutputPath)
    
            ' Generate command line parameters for CABARC.EXE.
            TheCommand = "-m LZX:21 -r -p N """ & _
                FSO.GetAbsolutePathName(AOutputPath) & """ *.*"
            Call LogDebug("Command-line parameters for CABARC.EXE: " & TheCommand)
    
            ' Write a batch file to invoke CABARC.EXE.
            Do
                BatchFileName = FSO.BuildPath(TempFolder, FSO.GetTempName + ".BAT")
            Loop Until _
                (Not FSO.FileExists(BatchFileName))
            Set BatchFile = FSO.CreateTextFile(BatchFileName, TRUE, FALSE)
            BatchFile.WriteLine("[USER=842012]@echo[/USER] OFF")
            BatchFile.WriteLine("CD /D " & OutputPath)
            BatchFile.WriteLine("CABARC.EXE " & TheCommand)
            BatchFile.WriteLine("IF ERRORLEVEL 9009 GOTO RETRY")
            BatchFile.WriteLine("GOTO END")
            BatchFile.WriteLine(":RETRY")
            BatchFile.WriteLine("""" & FSO.BuildPath(FSO.GetFolder(".").Path, _
                "CABARC.EXE") & """ " & TheCommand)
            BatchFile.WriteLine(":END")
            BatchFile.Close
            Set BatchFile = NOTHING
            Call LogDebug("Created CABARC.EXE invocation batch file: " & _
                BatchFileName)
    
            ' Invoke the created batch file..
            If DebugMode Then
                WinStyle = [COLOR=#404040]1[/COLOR]
            Else
                WinStyle = 0
            End If
            TheCommand = "CMD.EXE /C """ & BatchFileName & """"
            Call LogDebug("Executing: " & TheCommand)
    
            ' Shell.Run on its own, without checking return code.
            Shell.Run TheCommand, WinStyle, TRUE
    
            Call UnSubst(OutputPath)
            If Not FSO.FileExists(AOutputPath) Then
                ' Error creating cabinet. Leave the target folder for the user to
                ' deal with.
                Call LogError("Couldn't create target cabinet - not deleting " & _
                    "temporary target folder: " & Folder.Path)
            Else
               [COLOR=#ff0000] ' Remove target folder, leaving just the cabinet.
                Call LogDebug("Deleting temporary target folder: " & Folder.Path)
                Folder.Delete TRUE[/COLOR]
            End If
    
            ' Remove invocation batch file.
            Call LogDebug("Deleting CABARC.EXE invocation batch file: " & _
                BatchFileName)
            FSO.GetFile(BatchFileName).Delete TRUE
        Else
            Call UnSubst(OutputPath)
        End If
    
        Set Folder = NOTHING
    End Sub
    
    
    
    
    ' Flag whether the script makes a cabinet or not.
    If StrComp(FSO.GetExtensionName(OutputPath), "cab", vbTextCompare) = 0 Then
        If Not CABArcAvailable Then
            Call LogError("MS Cabinet Tool not available - can't create cabinet file.")
            MakingCAB = FALSE
        Else
            MakingCAB = [COLOR=#ff0000]TRUE[/COLOR]
        End If
    Else
        MakingCAB = FALSE
    End If
    


    After
    Code:
        ' Make a cabinet file.
        If MakingCAB Then
            Call LogInfo("Compressing folder to cabinet file: " & AOutputPath)
    
            ' Generate command line parameters for CABARC.EXE.
            TheCommand = "-m LZX:21 -r -p N """ & _
                FSO.GetAbsolutePathName(AOutputPath) & """ *.*"
            Call LogDebug("Command-line parameters for CABARC.EXE: " & TheCommand)
    
            ' Write a batch file to invoke CABARC.EXE.
            Do
                BatchFileName = FSO.BuildPath(TempFolder, FSO.GetTempName + ".BAT")
            Loop Until _
                (Not FSO.FileExists(BatchFileName))
            Set BatchFile = FSO.CreateTextFile(BatchFileName, TRUE, FALSE)
            BatchFile.WriteLine("[USER=842012]@echo[/USER] OFF")
            BatchFile.WriteLine("CD /D " & OutputPath)
            BatchFile.WriteLine("CABARC.EXE " & TheCommand)
            BatchFile.WriteLine("IF ERRORLEVEL 9009 GOTO RETRY")
            BatchFile.WriteLine("GOTO END")
            BatchFile.WriteLine(":RETRY")
            BatchFile.WriteLine("""" & FSO.BuildPath(FSO.GetFolder(".").Path, _
                "CABARC.EXE") & """ " & TheCommand)
            BatchFile.WriteLine(":END")
            BatchFile.Close
            Set BatchFile = NOTHING
            Call LogDebug("Created CABARC.EXE invocation batch file: " & _
                BatchFileName)
    
            ' Invoke the created batch file..
            If DebugMode Then
                WinStyle = [COLOR=#404040]1[/COLOR]
            Else
                WinStyle = 0
            End If
            TheCommand = "CMD.EXE /C """ & BatchFileName & """"
            Call LogDebug("Executing: " & TheCommand)
    
            ' Shell.Run on its own, without checking return code.
            Shell.Run TheCommand, WinStyle, TRUE
    
            Call UnSubst(OutputPath)
            If Not FSO.FileExists(AOutputPath) Then
                ' Error creating cabinet. Leave the target folder for the user to
                ' deal with.
                Call LogError("Couldn't create target cabinet - not deleting " & _
                    "temporary target folder: " & Folder.Path)
            Else
                [COLOR=#0000ff]' Error creating cabinet. Leave the target folder for the user to
                ' deal with.
                Call LogError("Couldn't create target cabinet - not deleting " & _
                    "temporary target folder: " & Folder.Path)[/COLOR]
            End If
    
            ' Remove invocation batch file.
            Call LogDebug("Deleting CABARC.EXE invocation batch file: " & _
                BatchFileName)
            FSO.GetFile(BatchFileName).Delete TRUE
        Else
            Call UnSubst(OutputPath)
        End If
    
        Set Folder = NOTHING
    End Sub
    
    
    
    ' Flag whether the script makes a cabinet or not.
    If StrComp(FSO.GetExtensionName(OutputPath), "cab", vbTextCompare) = 0 Then
        If Not CABArcAvailable Then
            Call LogError("MS Cabinet Tool not available - can't create cabinet file.")
            MakingCAB = FALSE
        Else
            MakingCAB = [COLOR=#0000ff]FALSE[/COLOR]
        End If
    Else
        MakingCAB = FALSE
    End If
    
     
  17. xinso

    xinso MDL Guru

    Mar 5, 2009
    4,242
    5,519
    150
    #97 xinso, Jun 15, 2018
    Last edited: Jun 22, 2018
    sr-..-rs issue
     
  18. DigDeep_

    DigDeep_ MDL Novice

    Nov 13, 2018
    1
    0
    0
    I tried to extract Cortana but I cannot.
     
  19. KNARZ

    KNARZ MDL Addicted

    Oct 9, 2012
    885
    462
    30
    no cab: set Flag_CAB=0