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

    PS to download latest microsip version

    IT Discussion
    4
    9
    510
    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

      I wanted a way to keep microSIP updated to the latest version automatically.

      I wrote this script and have a couple of questions.

      # Create a WebClient object
      $webClient = New-Object System.Net.WebClient
      
      # URL for the MicroSIP download page
      $url = "https://microsip.org/downloads"
      
      # Download the HTML content of the MicroSIP download page
      $html = $webClient.DownloadString($url)
      #write-output $html
      
      # Use regular expression to extract the download link for the most recent version of MicroSIP Zip
      $newversion = Select-String "(MicroSIP-.......zip)" -InputObject $html
      
      # create full download url
      $downloadurl = "https://microsip.org/download/" + $newversion.matches.value 
      #Write-Output $downloadurl
      
      # check if destination folder exists
      $folderPath = $env:HOMEDRIVE + $env:HOMEPATH + "\appdata\local\temp\microsip"
      if (!(Test-Path -Path $folderPath -PathType Container))
      {
          New-Item -ItemType Directory -Path $folderPath
      }
      
      # set download destination path and name
      $dest = $env:HOMEDRIVE + $env:HOMEPATH + "\appdata\local\temp\microsip\microsip.zip"
      #Write-Output $dest
      
      # download file from URL
      Invoke-WebRequest -Uri $downloadurl -OutFile $dest
      
      # set user's microsip path
      $destuserfolder = $env:HOMEDRIVE + $env:HOMEPATH + "\appdata\MicroSIP"
      
      # extract zip to current user's microsip file
      Expand-Archive -LiteralPath $dest -DestinationPath $destuserfolder -Force
      
      # set user's microsip contact path and name
      $contact = $env:HOMEDRIVE + $env:HOMEPATH + "\appdata\MicroSIP\Contacts.xml"
      
      # set user's document directory path
      $mydocuments = [environment]::getfolderpath("mydocuments")
      
      # backup contacts to user's documents
      Copy-Item -Path $contact -Destination $mydocuments -Force
      
      

      This does the job I want just fine - finds the first entry of MicroSIP.........zip then downloads it, extracts it to the user's microsip folder, then backs up their contacts to their documents folder.

      The problems I forsee:

      • If microsip changes their page layout, it's possible the link won't be the first zip on the page

      • If microsip changes the length of their version numbers, the script will break

      Any thoughts on how I can fix these?

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

        @Dashrender said in PS to download latest microsip version:

        Any thoughts on how I can fix these?

        Chocolatey

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

          @Obsolesce said in PS to download latest microsip version:

          @Dashrender said in PS to download latest microsip version:

          Any thoughts on how I can fix these?

          Chocolatey

          I have to dig into that again - there was a reason I didn't go that route - something didn't work as desired...can't recall what.

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

            I just installed it on a test machine with chocolatey - it installed it into the local admin profile - so any normal non admin user can't use it.

            ObsolesceO JaredBuschJ 2 Replies Last reply Reply Quote 0
            • ObsolesceO
              Obsolesce @Dashrender
              last edited by

              @Dashrender said in PS to download latest microsip version:

              I just installed it on a test machine with chocolatey - it installed it into the local admin profile - so any normal non admin user can't use it.

              You can use chocolatey to get the current version and download url. I don't install apps from chocolatey corporately, but I use it to obtain current versions of software and/or download links.

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

                @Obsolesce said in PS to download latest microsip version:

                @Dashrender said in PS to download latest microsip version:

                Any thoughts on how I can fix these?

                Chocolatey

                That's what we use.

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

                  @Dashrender said in PS to download latest microsip version:

                  I just installed it on a test machine with chocolatey - it installed it into the local admin profile - so any normal non admin user can't use it.

                  You can run chocolatey without admin rights just fine.

                  It warns you, but that is because most software is designed to be installed with admin rights in the windows world.

                  It seems that Microsip does not require that, so run chocolatey as the user itself.

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

                    @JaredBusch said in PS to download latest microsip version:

                    @Dashrender said in PS to download latest microsip version:

                    I just installed it on a test machine with chocolatey - it installed it into the local admin profile - so any normal non admin user can't use it.

                    You can run chocolatey without admin rights just fine.

                    It warns you, but that is because most software is designed to be installed with admin rights in the windows world.

                    It seems that Microsip does not require that, so run chocolatey as the user itself.

                    interesting - something else to test then.

                    will the choco update scripts catch both admin and non admin installed items?

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

                      @Dashrender said in PS to download latest microsip version:

                      @JaredBusch said in PS to download latest microsip version:

                      @Dashrender said in PS to download latest microsip version:

                      I just installed it on a test machine with chocolatey - it installed it into the local admin profile - so any normal non admin user can't use it.

                      You can run chocolatey without admin rights just fine.

                      It warns you, but that is because most software is designed to be installed with admin rights in the windows world.

                      It seems that Microsip does not require that, so run chocolatey as the user itself.

                      interesting - something else to test then.

                      will the choco update scripts catch both admin and non admin installed items?

                      It depends on whether or not it was installed with elevated privileges and whether or not a given software is installed to a location that requires elevated privileges to modify.

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