[Solved by Superfly] How to skip repetitive links?

Discussion in 'Scripting' started by xinso, Jun 14, 2015.

  1. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,526
    13,516
    340
    #1 xinso, Jun 14, 2015
    Last edited by a moderator: Apr 20, 2017
    If possible, could you please improve the Get-Link.vbs so that it skips all unnecessary repetitive links?

    Get-Link.vbs

    Code:
    Set shell = CreateObject("WScript.Shell") 
    CMD = "PowerShell.exe -ExecutionPolicy Bypass Get-BitsTransfer -AllUsers | Select -ExpandProperty FileList | Select -ExpandProperty RemoteName | Select-String -Pattern '.esd' >> $env:userprofile\desktop\ESD-url.txt" 
    shell.Run CMD,0


    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/c/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_en-us_d24b6b72265b896d0a6bc0e4fe9e7234711fb699.esd?P1=1434276044&P2=101&P3=1&P4=vw0okxA6phxIKXX9EPwvDAbWYYQ%3d
    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_
    de-de_2bc6b34d092410af28d85cb1106b23a7c0d24344.esd?P1=1434277483&P2=101&P3=1&P4=zd7sD6T%2b2G7l9U%2fxZgA%2fPlP2snU%3d


    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/c/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_en-us_d24b6b72265b896d0a6bc0e4fe9e7234711fb699.esd?P1=1434276044&P2=101&P3=1&P4=vw0okxA6phxIKXX9EPwvDAbWYYQ%3d
    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/c/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_
    en-gb_7dd251ea262d25eb9cd66ccb2a71f590c98ef53c.esd?P1=1434274163&P2=101&P3=1&P4=IUAtflspdZb6EpTRaRZXh6SzMMM%3d


    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/c/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_en-us_d24b6b72265b896d0a6bc0e4fe9e7234711fb699.esd?P1=1434276044&P2=101&P3=1&P4=vw0okxA6phxIKXX9EPwvDAbWYYQ%3d
    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_
    es-es_b5809b8e0eff64b473aee4840a55196a4bf8445b.esd?P1=1434273712&P2=101&P3=1&P4=C9XHJcn3MysNhpWsu67XwH60FR0%3d

    >

    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/c/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_en-us_d24b6b72265b896d0a6bc0e4fe9e7234711fb699.esd?P1=1434276044&P2=101&P3=1&P4=vw0okxA6phxIKXX9EPwvDAbWYYQ%3d


    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_de-de_2bc6b34d092410af28d85cb1106b23a7c0d24344.esd?P1=1434277483&P2=101&P3=1&P4=zd7sD6T%2b2G7l9U%2fxZgA%2fPlP2snU%3d


    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/c/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_en-gb_7dd251ea262d25eb9cd66ccb2a71f590c98ef53c.esd?P1=1434274163&P2=101&P3=1&P4=IUAtflspdZb6EpTRaRZXh6SzMMM%3d


    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_es-es_b5809b8e0eff64b473aee4840a55196a4bf8445b.esd?P1=1434273712&P2=101&P3=1&P4=C9XHJcn3MysNhpWsu67XwH60FR0%3d
     
  2. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,143
    543
    60
    #2 Superfly, Jun 14, 2015
    Last edited by a moderator: Apr 20, 2017
    I don't have duplicates in Bits - so tested with what you posted in txt file.

    I noticed by leaving it to filter by Select-String it removes part of the URL as well... so remove that and let it filter by object...

    Code:
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-Content $env:userprofile\desktop\ESD-url.txt | Select-Object -Unique | Set-Content $env:userprofile\desktop\ESD-url.txt
    BTW: We don't need vbs anymore, do we? - can't you just run the PS commands from cmdline?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,526
    13,516
    340
    #3 xinso, Jun 14, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    To be frank, no.

    My main purpose is to get all links in a list as follows. And each link in a single line.

    AR-SA
    CS-CZ
    DE-DE

    Here are the results:

    1.cmd (3 links in a list, each link divided in two lines)

    Code:
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-BitsTransfer -AllUsers | Select -ExpandProperty FileList | Select -ExpandProperty RemoteName | Select-String -Pattern '.esd' >> $env:userprofile\desktop\1.txt
    
    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_
    ar-sa_31b4468a080460e34d52a93e994b26c002f7097e.esd?P1=1434306203&P2=101&P3=1&P4=LNx%2bopsjykUgPPQ7oBQza0CjdXE%3d

    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_
    cs-cz_ac744a55b263482b0bf0e9398a65eff76d82cdd4.esd?P1=1434309331&P2=101&P3=1&P4=6qRvCOjN53m6%2b6pil%2b8QjGTMX5w%3d

    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_
    de-de_2bc6b34d092410af28d85cb1106b23a7c0d24344.esd?P1=1434300929&P2=101&P3=1&P4=noUEowKQhSd9Wd2TeB7LkcbKIcU%3d

    2.cmd (previous link overwritten, but the link is in one line)

    Code:
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-BitsTransfer -AllUsers | Select -ExpandProperty FileList | Select -ExpandProperty RemoteName | Select-String -Pattern '.esd' | Select-Object -Unique | Set-Content $env:userprofile\desktop\2.txt
    
    2-1.txt

    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_ar-sa_31b4468a080460e34d52a93e994b26c002f7097e.esd?P1=1434306203&P2=101&P3=1&P4=LNx%2bopsjykUgPPQ7oBQza0CjdXE%3

    2-2.txt

    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_cs-cz_ac744a55b263482b0bf0e9398a65eff76d82cdd4.esd?P1=1434309331&P2=101&P3=1&P4=6qRvCOjN53m6%2b6pil%2b8QjGTMX5w%3

    2-3.txt

    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_de-de_2bc6b34d092410af28d85cb1106b23a7c0d24344.esd?P1=1434300929&P2=101&P3=1&P4=noUEowKQhSd9Wd2TeB7LkcbKIcU%3

    So I need 1.cmd, with each link in one line.
     
  4. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,143
    543
    60
    #4 Superfly, Jun 14, 2015
    Last edited by a moderator: Apr 20, 2017
    If you want to add links to the file use this:

    Code:
    Get-BitsTransfer -AllUsers | Select -ExpandProperty FileList | Select -ExpandProperty RemoteName | Select-String -Pattern '.esd' | Add-Content $env:userprofile\desktop\ESD-url.txt 

    and to remove duplicates the one I posted above.

    BTW: for WU links maybe my batch generator will help.

    http://rghost.net/private/6JDqvGCfs/3ea678f22655e42e0024c81e0f506bc0
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,526
    13,516
    340
    #5 xinso, Jun 14, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    The GenerateLink.exe is for Slow ring static link, right?

    Superfly, I am afraid that we might need it no more, for I found there was no 10130 Slow ring static link.

    Here is 3.cmd, exactly the one I want - no space and all in one line:

    Code:
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-BitsTransfer -AllUsers | Select -ExpandProperty FileList | Select -ExpandProperty RemoteName | Select-String -Pattern '.esd' | Add-Content $env:userprofile\desktop\3.txt"
    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_ar-sa_31b4468a080460e34d52a93e994b26c002f7097e.esd?P1=1434311226&P2=101&P3=1&P4=74LtcGmcS9wZTd9D%2b0s8PeG7q%2fU%3d
    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_cs-cz_ac744a55b263482b0bf0e9398a65eff76d82cdd4.esd?P1=1434303585&P2=101&P3=1&P4=tZuz6GNbo87fswtDfdoqhc8aEmg%3d
    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_de-de_2bc6b34d092410af28d85cb1106b23a7c0d24344.esd?P1=1434309452&P2=101&P3=1&P4=27n7q%2fxKFfiN7MrI%2feDxlKWK75M%3

    Solved at last. Thank you, Superfly.
     
  6. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,143
    543
    60
    #6 Superfly, Jun 14, 2015
    Last edited by a moderator: Apr 20, 2017
    Cool...I'm glad :D

    I was about to ask you to test this for one line links:

    Code:
    Get-BitsTransfer -AllUsers | Select -ExpandProperty FileList | Select -ExpandProperty RemoteName | Select-Object -Unique | Select-String -Pattern '.esd' | Add-Content $env:userprofile\desktop\ESD-url.txt 
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,526
    13,516
    340
    #7 xinso, Jun 14, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    No problem at all, my friend and hero.

    I will swap to 10122. Wont be long.

    Well, the result is of the same as that from 3.cmd.

    4.cmd

    Code:
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-BitsTransfer -AllUsers | Select -ExpandProperty FileList | Select -ExpandProperty RemoteName | Select-Object -Unique | Select-String -Pattern '.esd' | Add-Content $env:userprofile\desktop\ESD-url.txt"
    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_es-es_b5809b8e0eff64b473aee4840a55196a4bf8445b.esd?P1=1434312921&P2=101&P3=1&P4=k4%2bDnxPcchrHXJNclhqg4g2P3P4%3d
    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_es-mx_50b5f21a0ff811915a48e3982a0fffc5bd18b2a7.esd?P1=1434309866&P2=101&P3=1&P4=gJuECBzGgivJ3aySr3VF4fLNbKw%3d
    http://bg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientcore_ret_x86fre_fi-fi_f2047f37c6a81a4d6cc74e847e2e7c3af291c22a.esd?P1=1434313835&P2=101&P3=1&P4=Rz0PCGdiJSu7uhiSuL%2bxgjCfbuY%3d

    What is the difference? Is 4.cmd good for deleting repetitive left-over links?

    Now I can get all 22 links in 10 minutes (without your method, I need about one hour.), I think, all for your kind and efficient help.

    Thanks again, Superfly.
     
  8. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,143
    543
    60
    #8 Superfly, Jun 14, 2015
    Last edited by a moderator: Apr 20, 2017
    You are very welcome, buddy...:biggrin:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,526
    13,516
    340
    #9 xinso, Jun 15, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Feedback

    Superfly,

    I use this script to make sure that the UILanguage of a link copes with that in registry

    Get-Link.cmd
    Code:
    @echo off
    pushd "%~dp0"
    
    for /f "tokens=7  delims=\" %%a in ('"reg query HKLM\SYSTEM\ControlSet001\Control\MUI\UILanguages" 2^>nul') do (set UI=%%a)
    
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-BitsTransfer -AllUsers | Select -ExpandProperty FileList | Select -ExpandProperty RemoteName | Select-String -Pattern '%UI%' | Add-Content $env:userprofile\desktop\ESD-url.txt"
    
    sc stop wuauserv >nul 2>&1
     
  10. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,143
    543
    60
    #10 Superfly, Jun 15, 2015
    Last edited by a moderator: Apr 20, 2017
    Exellent idea.... Nice one :tasty:

    BTW - in case there are other files with the UILanguage you can add '.esd' as well - thisis how I do it in PS:

    Code:
    If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
    
    {   
    $arguments = "& '" + $myinvocation.mycommand.definition + "'"
    Start-Process powershell -Verb runAs -ArgumentList $arguments
    Break
    }
    
    if ((Get-ExecutionPolicy) -ne 'Bypass') {Set-ExecutionPolicy -ExecutionPolicy Bypass -ErrorAction SilentlyContinue} 
    
    
    $UI = Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\ -Name
    
    #Get links
    Get-BitsTransfer -AllUsers | 
    Select -ExpandProperty FileList | 
    Select -ExpandProperty RemoteName | 
    Select-String -Pattern $UI | 
    Select-String -Pattern 'esd' |
    Add-Content $env:userprofile\desktop\ESD-url.txt 
    
    #Remove duplicates from file
    Get-Content $env:userprofile\desktop\ESD-url.txt | 
    Select-Object -Unique | 
    Set-Content $env:userprofile\desktop\ESD-url.txt
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,526
    13,516
    340
    #11 xinso, Jun 16, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    I did not know how to use this.

    Then I named it Get-Link.PS1 and ran it with Powershell. It ran with messages in RED and to no avail.

    So I had it worked as

    Get-Link.cmd

    Code:
    @echo off
    pushd "%~dp0"
    
    for /f "tokens=7  delims=\" %%a in ('"reg query HKLM\SYSTEM\ControlSet001\Control\MUI\UILanguages" 2^>nul') do (set UI=%%a)
    
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-BitsTransfer -AllUsers | Select -ExpandProperty FileList | Select -ExpandProperty RemoteName | Select-String -Pattern '%UI%' | Select-String -Pattern 'esd' | Add-Content $env:userprofile\desktop\ESD-url.txt"
    
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-Content $env:userprofile\desktop\ESD-url.txt | Select-Object -Unique | Set-Content $env:userprofile\desktop\ESD-url.txt"
    
    sc stop wuauserv >nul 2>&1
    But this worked only when there was one link.

    en-usLink

    >

    en-usLink

    When there were more than one, it went messy. e.g.

    en-usLink
    en-usLink

    >

    en-usLink
    en-usLinken-usLinken-usLink
     
  12. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,143
    543
    60
    #12 Superfly, Jun 16, 2015
    Last edited by a moderator: Apr 20, 2017
    I wonder if perhaps 4.cmd will be better then:

    Code:
    @echo off
    pushd "%~dp0"
    
    for /f "tokens=7  delims=\" %%a in ('"reg query HKLM\SYSTEM\ControlSet001\Control\MUI\UILanguages" 2^>nul') do (set UI=%%a)
    
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-BitsTransfer -AllUsers | Select -ExpandProperty FileList | Select -ExpandProperty RemoteName | Select-Object -Unique | Select-String -Pattern '%UI%' | Select-String -Pattern '.esd' | Add-Content $env:userprofile\desktop\ESD-url.txt"
    
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-Content $env:userprofile\desktop\ESD-url.txt | Select-Object -Unique | Set-Content $env:userprofile\desktop\ESD-url.txt"
    
    sc stop wuauserv >nul 2>&1
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,526
    13,516
    340
    #13 xinso, Jun 16, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    4.cmd has two Select-Object -Unique.

    Besides that, both have the same problem.

    Superfly, thanks for your attention.
     
  14. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,143
    543
    60
    #14 Superfly, Jun 16, 2015
    Last edited by a moderator: Apr 20, 2017
    No problem - see if it's a PS execution problem - can you try to run this in PS ISE:
    Code:
    ################################################ Elevate ############################################
    $myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
    $myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
    $adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
    
    if (-not $myWindowsPrincipal.IsInRole($adminRole))
    
      {
        Start-Process PowerShell.exe -Verb Runas -WindowStyle Hidden -ArgumentList $myInvocation.MyCommand.Definition
        return
       }
    #####################################################################################################>
    
    if((Get-ExecutionPolicy) -ne 'Bypass') {Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force}
    
    
    
    [string] $UI = Get-ChildItem -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\MUI\UILanguages' -Name -ErrorAction Inquire
    [string] $path = $env:userprofile +'\Desktop\ESD-url.txt'
    
    #Get links
    Get-BitsTransfer -AllUsers | 
    Select -ExpandProperty FileList | 
    Select -ExpandProperty RemoteName |
    Select-Object -Unique |
    Select-String -Pattern $UI | 
    Select-String -Pattern '.esd' |
    Add-Content $path 
    
    if (Test-Path $path)
    {
    
    #Remove duplicates from file
    Get-Content $path |
    Select-Object -Unique |
    Set-Content $path 
    }
    The red errors that relate to execution policy is just a warning but you can copy the Set-execution bit from the script and run directly in PS admin. window to get rid of it.

    I tested with .cab's and it worked fine.

    BTW: Change to 'ControlSet001' for your setup. You can remove the first -unique check.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,526
    13,516
    340
    #15 xinso, Jun 16, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    PS & PS ISE have the same result.

    They work under these conditions:

    Code:
    Execution Policy Change
    The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
    you to the security risks described in the about_Execution_Policies help topic at
    http://go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
    [Y] Yes  [N] No   Suspend  [?] Help (default is "Y"):
    


    Code:
    C:\windows\system32>powershell c:\Get-Link.PS1
    c:\Get-Link.PS1 : File C:\Get-Link.PS1 cannot be loaded because running scripts is disabled on this system. For more
    information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
    At line:1 char:1
    + c:\Get-Link.PS1
    + ~~~~~~~~~~~~~~~
        + CategoryInfo          : SecurityError: (:) [], PSSecurityException
        + FullyQualifiedErrorId : UnauthorizedAccess
    
    Code:
    PS C:\windows\system32> C:\Users\A\Desktop\Get-Link.PS1
    Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is 
    overridden by a policy defined at a more specific scope.  Due to the override, your shell will retain its 
    current effective execution policy of Unrestricted. Type "Get-ExecutionPolicy -List" to view your execution 
    policy settings. For more information please see "Get-Help Set-ExecutionPolicy".
    At C:\Users\A\Desktop\Get-Link.PS1:14 char:41
    + ...  'Bypass') {Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy B ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException
        + FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyComman 
       d
    
    So I choose Get-Link.cmd. Thanks.

    One weird thing happened this time for both .ps1 and .cmd:

    http://fg.v4.sh.dl.ws.microsoft.com...3&P2=101&P3=1&P4=5cLXE9AlWy/YeJOXwIhQvNFDiYs=
    http://fg.v4.sh.dl.ws.microsoft.com...5&P2=101&P3=1&P4=euIdlMMkrSF9SX8JPJL6g4GH6wE=
    http://fg.v4.sh.dl.ws.microsoft.com...7&P2=101&P3=1&P4=PFOmJdd8JTCi/3aiLPUc3PqC0Q8=
    http://fg.v4.sh.dl.ws.microsoft.com...4&P2=101&P3=1&P4=bCm0tZ894uU/7tr1LMNjRaMCocU=
    http://bgPL.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientpro_ret_x64fre_en-us_5dd807515e4acfaf2302b96605522678cdcf3b4c.esd?P1=1434473258&P2=101&P3=1&P4=hlnvRzxDalCs3qAML88GHk%2fT9LI%3d
    http://fg.v4.sh.dl.ws.microsoft.com/dl/content/d/updt/2015/05/10130.0.150522-2224.fbl_impressive_clientpro_ret_x64fre_en-us_5dd807515e4acfaf2302b96605522678cdcf3b4c.esd?P1=1434473258&P2=101&P3=1&P4=hlnvRzxDalCs3qAML88GHk%2fT9LI%3d

    It generates two en-US with single click.

    I would believe the bgPL one was the first generated automatically when the system was installed.

    So I am still eager to know how to remove the left-over log.
     
  16. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,143
    543
    60
    That is wierd.. and both links work as well...:confused:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,526
    13,516
    340
    #17 xinso, Jun 16, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Superfly,

    For the question at #15

    I searched the web and found a way to remove the whole queue completely.

    Code:
    @echo off
    net stop BITS
    ipconfig /flushdns
    ren "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr0.dat" qmgr0.dat.old
    ren "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr1.dat" qmgr1.dat.old
    net start BITS
    [Note]
    It needs a restart for the Get-BitsTransfer to work.

    So I modify the script to suite my needs and run it once only, before restart to fetch the links.

    Code:
    @echo off
    net stop wuauserv >nul 2>&1
    net stop BITS >nul 2>&1
    rd /s /q "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader"
    rd /s /q "C:\Windows\SoftwareDistribution\Download"
    Thanks, Superfly.
     
  18. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,143
    543
    60
    #18 Superfly, Jun 16, 2015
    Last edited by a moderator: Apr 20, 2017
    Yes. That's a good idea ;)

    I tried using... Remove-BitsTransfer .. but it gives "access denied" even as admin (I need to research that one)... but your method is best.

    Also an alternative to Select-String - would be a Where-Object clause which is more flexible and can be manipulated with -and or -or matches.

    Code:
    Get-BitsTransfer -AllUsers | 
    Select-Object -ExpandProperty FileList | 
    Select-Object -ExpandProperty RemoteName |
    Where-Object {$_ -match '%UI%' -and $_ -match '.esd' }|
    Add-Content $env:userprofile\desktop\ESD-url.txt
    -- just another option in case you need to fine-tune it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,526
    13,516
    340
    #19 xinso, Jun 16, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Superfly,

    Am I right?

    Get-Link.cmd
    Code:
    @echo off
    pushd "%~dp0"
    
    for /f "tokens=7  delims=\" %%a in ('"reg query HKLM\SYSTEM\ControlSet001\Control\MUI\UILanguages" 2^>nul') do (set UI=%%a)
    
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-BitsTransfer -AllUsers | Select -ExpandProperty FileList | Select -ExpandProperty RemoteName | Where-Object {$_ -match '%UI%' -and $_ -match '.esd' } | Add-Content $env:userprofile\desktop\ESD-url.txt"
    
    CMD /c PowerShell.exe -ExecutionPolicy Bypass "Get-Content $env:userprofile\desktop\ESD-url.txt | Select-Object -Unique | Set-Content $env:userprofile\desktop\ESD-url.txt"
    
    net stop wuauserv >nul 2>&1
     
  20. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,143
    543
    60
    Yup - tested your script and works fine here...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...