ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    script to download and extract MicroSip portable

    IT Discussion
    dashrender scripts
    6
    15
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DashrenderD
      Dashrender
      last edited by Dashrender

      I've been wanting a way to download the latest version of MicroSip portable.

      $Save_Path = 'C:\ESD\'
      $Expand_Path = 'C:\ESD\expand\'
      $Web_URI = 'https://microsip.org/downloads'
      $Web_URI_Root = 'https://microsip.org'
      $DL_list = (Invoke-WebRequest -Uri $Web_URI -Method GET)
      $Link = $DL_list.Links | Where-Object {$_.outerText -eq 'portable'} | Select-Object href -First 1
      Invoke-WebRequest -Uri ($Web_URI_Root + $Link.href) -OutFile ($Save_Path + (Split-Path $Link.href -Leaf) )
      Expand-Archive ($Save_Path + (Split-Path $Link.href -Leaf)) -DestinationPath $Expand_Path
      
      

      I realize this doesn't ensure I'm getting the latest version of MicroSip - I'm relying on the lastest being the first listed item that's a portable version, but it's a start.

      If you can offer suggestions on how to do a comparison of the list of /downloads/MICROSIP-x.xx.xx.zip I'd appreciate it.

      DustinB3403D ObsolesceO 1 3 Replies Last reply Reply Quote 0
      • DustinB3403D
        DustinB3403 @Dashrender
        last edited by DustinB3403

        @dashrender why not pick up maintenance of the chocolatey package and save* yourself some effort?

        https://community.chocolatey.org/packages/microsip#virus

        DashrenderD 1 Reply Last reply Reply Quote 0
        • DashrenderD
          Dashrender @DustinB3403
          last edited by

          @dustinb3403 said in script to download and extract MicroSip portable:

          @dashrender why not pick up maintenance of the chocolatey package and save* yourself some effort?

          https://community.chocolatey.org/packages/microsip#virus

          It's not being maintained for one.

          And installing it in an admin PS doesn't install it for the desired user. So it does me no good. A non admin user can't use it - because MicroSIP saves it's data in a protected area when installed from Choco.

          DustinB3403D 1 Reply Last reply Reply Quote 0
          • ObsolesceO
            Obsolesce @Dashrender
            last edited by

            @dashrender said in script to download and extract MicroSip portable:

            I've been wanting a way to download the latest version of MicroSip portable.

            $Save_Path = 'C:\ESD\'
            $Expand_Path = 'C:\ESD\expand\'
            $Web_URI = 'https://microsip.org/downloads'
            $Web_URI_Root = 'https://microsip.org'
            $DL_list = (Invoke-WebRequest -Uri $Web_URI -Method GET)
            $Link = $DL_list.Links | Where-Object {$_.outerText -eq 'portable'} | Select-Object href -First 1
            Invoke-WebRequest -Uri ($Web_URI_Root + $Link.href) -OutFile ($Save_Path + (Split-Path $Link.href -Leaf) )
            Expand-Archive ($Save_Path + (Split-Path $Link.href -Leaf)) -DestinationPath $Expand_Path
            
            

            I realize this doesn't ensure I'm getting the latest version of MicroSip - I'm relying on the lastest being the first listed item that's a portable version, but it's a start.

            If you can offer suggestions on how to do a comparison of the list of /downloads/MICROSIP-x.xx.xx.zip I'd appreciate it.

            I didn't feel like getting into any regex atm, and wanted to keep it as close as I could to what you already have and work with that. Here's the end result I came up with that takes all the version numbers, sorts them, then finds the link matching the latest version, and downloads using that link. I also filtered for links that do not cointain "Lite", but you can change the notmatch to a match if Lite was the one you wanted. ( I assumed you were not interested in the Lite versions )

            $Save_Path = 'C:\ESD\'
            $Expand_Path = 'C:\ESD\expand\'
            $Web_URI = 'https://microsip.org/downloads'
            $Web_URI_Root = 'https://microsip.org'
            $DL_list = (Invoke-WebRequest -Uri $Web_URI -Method GET)
            
            $Link = $DL_list.Links | Where-Object {$_.outerText -eq 'portable' -and $_.href -notmatch "Lite"} | Select-Object -Property href
            
            $zipVer = foreach ($zip in $Link) {
                [version](($zip -split '-') -split '.zip')[1]
            }
            
            $latestVer = [string]($zipVer | Sort-Object -Descending | Select-Object -First 1)
            
            $latestLink = $Link | Where-Object {$_ -match $latestVer}
            
            Invoke-WebRequest -Uri ($Web_URI_Root + $latestLink.href) -OutFile ($Save_Path + (Split-Path $Link.href -Leaf))
            
            Expand-Archive ($Save_Path + (Split-Path $Link.href -Leaf)) -DestinationPath $Expand_Path
            
            DashrenderD 1 Reply Last reply Reply Quote 0
            • 1
              1337 @Dashrender
              last edited by 1337

              @dashrender said in script to download and extract MicroSip portable:

              I've been wanting a way to download the latest version of MicroSip portable.

              I realize this doesn't ensure I'm getting the latest version of MicroSip - I'm relying on the lastest being the first listed item that's a portable version, but it's a start.

              If you can offer suggestions on how to do a comparison of the list of /downloads/MICROSIP-x.xx.xx.zip I'd appreciate it.

              I suggest scraping the source file list instead. https://www.microsip.org/source

              From that take the highest version and download the zip version based on the version number.

              I would also send the programmer(s) an email and ask if he/she has another way to determine what the latest version is. Perhaps without scraping html. Maybe there is a list of versions or files somewhere that is maintained.

              ObsolesceO 1 Reply Last reply Reply Quote 0
              • ObsolesceO
                Obsolesce @1337
                last edited by

                @pete-s said in script to download and extract MicroSip portable:

                @dashrender said in script to download and extract MicroSip portable:

                I've been wanting a way to download the latest version of MicroSip portable.

                I realize this doesn't ensure I'm getting the latest version of MicroSip - I'm relying on the lastest being the first listed item that's a portable version, but it's a start.

                If you can offer suggestions on how to do a comparison of the list of /downloads/MICROSIP-x.xx.xx.zip I'd appreciate it.

                I suggest scraping the source file list instead. https://www.microsip.org/source

                From that take the highest version and download the zip version based on the version number.

                I would also send the programmer(s) an email and ask if he/she has another way to determine what the latest version is. Perhaps without scraping html. Maybe there is a list of versions or files somewhere that is maintained.

                Yeah that source page looks like a better place to do it. Same basic code will work with a few changes. Scraping HTML sucks but if that's what ya gotta do... until you find a better option it should work fine. Perhaps the sources page will be more reliable.

                DashrenderD 1 Reply Last reply Reply Quote 0
                • DustinB3403D
                  DustinB3403 @Dashrender
                  last edited by

                  @dashrender said in script to download and extract MicroSip portable:

                  @dustinb3403 said in script to download and extract MicroSip portable:

                  @dashrender why not pick up maintenance of the chocolatey package and save* yourself some effort?

                  https://community.chocolatey.org/packages/microsip#virus

                  It's not being maintained for one.

                  And installing it in an admin PS doesn't install it for the desired user. So it does me no good. A non admin user can't use it - because MicroSIP saves it's data in a protected area when installed from Choco.

                  I don't think you understood what I was saying, why don't you become the maintenaner of the choco package.

                  Two birds one stone. As for the installation option are you saying you can't install programs without admin rights?

                  DashrenderD 2 Replies Last reply Reply Quote 2
                  • DashrenderD
                    Dashrender @DustinB3403
                    last edited by

                    @dustinb3403 said in script to download and extract MicroSip portable:

                    I don't think you understood what I was saying, why don't you become the maintenaner of the choco package.

                    It's something I've considered because it will force me to learn the parts needed to make it work - which would be good.

                    But I don't the time time right now to do that. Perhaps in 3 months.

                    1 Reply Last reply Reply Quote 1
                    • DashrenderD
                      Dashrender @DustinB3403
                      last edited by

                      @dustinb3403 said in script to download and extract MicroSip portable:

                      Two birds one stone. As for the installation option are you saying you can't install programs without admin rights?

                      Choco complains very vocally when you run it as a non admin. That said, I have no idea if the admin running solution will find anything installed locally at the user level.

                      Example.

                      If chrome is installed as an admin - the application is installed c:\program files, but if chrome is installed as a local user it's installed in c:\users%username%.

                      If I run an update script at the admin level - will it update the chromes in all of the user's profiles - probably not.

                      It would be awesome if MicroSIP truly recognized a multi-user environment and enabled us to have the microsip.ini in the c:\users%username%\appdata\microsip directory - but I haven't dug enough yet to know if I can make that happen myself or not.

                      By default Microsip.exe looks to the local directory and if there is no Microsip.ini, it creates one - but if the microsip.exe is in c:\program files\microsip - a normal user doesn't have write permission - so they have a problem.

                      JaredBuschJ 1 Reply Last reply Reply Quote 0
                      • DashrenderD
                        Dashrender @Obsolesce
                        last edited by

                        @obsolesce said in script to download and extract MicroSip portable:

                        @dashrender said in script to download and extract MicroSip portable:

                        I've been wanting a way to download the latest version of MicroSip portable.

                        $Save_Path = 'C:\ESD\'
                        $Expand_Path = 'C:\ESD\expand\'
                        $Web_URI = 'https://microsip.org/downloads'
                        $Web_URI_Root = 'https://microsip.org'
                        $DL_list = (Invoke-WebRequest -Uri $Web_URI -Method GET)
                        $Link = $DL_list.Links | Where-Object {$_.outerText -eq 'portable'} | Select-Object href -First 1
                        Invoke-WebRequest -Uri ($Web_URI_Root + $Link.href) -OutFile ($Save_Path + (Split-Path $Link.href -Leaf) )
                        Expand-Archive ($Save_Path + (Split-Path $Link.href -Leaf)) -DestinationPath $Expand_Path
                        
                        

                        I realize this doesn't ensure I'm getting the latest version of MicroSip - I'm relying on the lastest being the first listed item that's a portable version, but it's a start.

                        If you can offer suggestions on how to do a comparison of the list of /downloads/MICROSIP-x.xx.xx.zip I'd appreciate it.

                        I didn't feel like getting into any regex atm, and wanted to keep it as close as I could to what you already have and work with that. Here's the end result I came up with that takes all the version numbers, sorts them, then finds the link matching the latest version, and downloads using that link. I also filtered for links that do not cointain "Lite", but you can change the notmatch to a match if Lite was the one you wanted. ( I assumed you were not interested in the Lite versions )

                        $Save_Path = 'C:\ESD\'
                        $Expand_Path = 'C:\ESD\expand\'
                        $Web_URI = 'https://microsip.org/downloads'
                        $Web_URI_Root = 'https://microsip.org'
                        $DL_list = (Invoke-WebRequest -Uri $Web_URI -Method GET)
                        
                        $Link = $DL_list.Links | Where-Object {$_.outerText -eq 'portable' -and $_.href -notmatch "Lite"} | Select-Object -Property href
                        
                        $zipVer = foreach ($zip in $Link) {
                            [version](($zip -split '-') -split '.zip')[1]
                        }
                        
                        $latestVer = [string]($zipVer | Sort-Object -Descending | Select-Object -First 1)
                        
                        $latestLink = $Link | Where-Object {$_ -match $latestVer}
                        
                        Invoke-WebRequest -Uri ($Web_URI_Root + $latestLink.href) -OutFile ($Save_Path + (Split-Path $Link.href -Leaf))
                        
                        Expand-Archive ($Save_Path + (Split-Path $Link.href -Leaf)) -DestinationPath $Expand_Path
                        

                        Fantastic - THANKS!

                        1 Reply Last reply Reply Quote 0
                        • DashrenderD
                          Dashrender @Obsolesce
                          last edited by

                          @obsolesce said in script to download and extract MicroSip portable:

                          @pete-s said in script to download and extract MicroSip portable:

                          @dashrender said in script to download and extract MicroSip portable:

                          I've been wanting a way to download the latest version of MicroSip portable.

                          I realize this doesn't ensure I'm getting the latest version of MicroSip - I'm relying on the lastest being the first listed item that's a portable version, but it's a start.

                          If you can offer suggestions on how to do a comparison of the list of /downloads/MICROSIP-x.xx.xx.zip I'd appreciate it.

                          I suggest scraping the source file list instead. https://www.microsip.org/source

                          From that take the highest version and download the zip version based on the version number.

                          I would also send the programmer(s) an email and ask if he/she has another way to determine what the latest version is. Perhaps without scraping html. Maybe there is a list of versions or files somewhere that is maintained.

                          Yeah that source page looks like a better place to do it. Same basic code will work with a few changes. Scraping HTML sucks but if that's what ya gotta do... until you find a better option it should work fine. Perhaps the sources page will be more reliable.

                          Why do you (and Peter) think the source page is better than the downloads page? I assume the maintainer has to maintain both of these locations and either could be behind/missed when an update occurs, right?

                          What would be nice is the ability to read the download directory itself, know the exact filenames that are there, and pull from that. Assuming they left old ones behind, I'd still have to pull in a list, sort it, etc.. but at least I'd know the file was real.

                          scottalanmillerS 1 Reply Last reply Reply Quote 0
                          • scottalanmillerS
                            scottalanmiller @Dashrender
                            last edited by

                            @dashrender said in script to download and extract MicroSip portable:

                            Why do you (and Peter) think the source page is better than the downloads page?

                            Because one officially states what the latest version is. The other you are just hoping that the latest version is listed in a certain, likely, but non-determinant way.

                            DashrenderD 1 Reply Last reply Reply Quote 0
                            • DashrenderD
                              Dashrender @scottalanmiller
                              last edited by

                              @scottalanmiller said in script to download and extract MicroSip portable:

                              @dashrender said in script to download and extract MicroSip portable:

                              Why do you (and Peter) think the source page is better than the downloads page?

                              Because one officially states what the latest version is. The other you are just hoping that the latest version is listed in a certain, likely, but non-determinant way.

                              Thanks - makes sense.

                              1 Reply Last reply Reply Quote 0
                              • JaredBuschJ
                                JaredBusch @Dashrender
                                last edited by

                                @dashrender chocolatey can easily run as non-admin. The question is whether or not the application installs can handle that. Of course your centralized scrips for keeping things up-to-date would not get that use your space one you have to have a script to keep the user space chocolatey package up-to-date also

                                DashrenderD 1 Reply Last reply Reply Quote 0
                                • DashrenderD
                                  Dashrender @JaredBusch
                                  last edited by

                                  @jaredbusch said in script to download and extract MicroSip portable:

                                  @dashrender chocolatey can easily run as non-admin. The question is whether or not the application installs can handle that. Of course your centralized scrips for keeping things up-to-date would not get that use your space one you have to have a script to keep the user space chocolatey package up-to-date also

                                  Yeah, I'll have to look at it - but only after someone else actually picks ownership of the package back up. The current maintainer has stated he's no longer maintaining it.

                                  1 Reply Last reply Reply Quote 0
                                  • 1 / 1
                                  • First post
                                    Last post