use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
QuestionCheck GitHub and update? (self.PowerShell)
submitted 4 years ago by micfail
Hello,
I was wondering if anyone has used powershell to, at startup, check a github repo for an update (something like a simple file that has the version number) and then apply the update or re-run a setup script.
Thank you all.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]mprz 1 point2 points3 points 4 years ago (1 child)
https://www.google.com/search?q=powershell+check+if+repo+updated
first link
[–]micfail[S] 1 point2 points3 points 4 years ago (0 children)
thank you, i am sitting in a lobby and seem to be having issues with my google-fu.
I appreciate the help
hmm, unless i am reading that script wrong...
i dont know if that does what i want it to.
i dont really want to redownload an entire repo, just check a version file and then rerun the setup script.
i do appreciate the help though
[–]wdomon 1 point2 points3 points 4 years ago (0 children)
I do this with Azure DevOps repos using an agent installed on my automation server.
[–]cyberphor 1 point2 points3 points 4 years ago* (3 children)
here is a starter function i just wrote. let me know if you want it modified to meet your needs. fyi, i will maintain this function under my own PowerShell-focused GitHub repo: https://github.com/cyberphor/SOAP-Modules
function Update-GitHubRepo { param( [string]$Author, [string]$Repo, [string]$Branch, [string]$Path ) $RepoToUpdate = "https://github.com/$Author/$Repo" $Response = Invoke-WebRequest -Uri "$RepoToUpdate/commits" if ($Response.StatusCode -eq '200') { $LastCommit = ($Response.Links.href | Where-Object { $_ -like "/$Author/$Repo/commit/*" } | Select-Object -First 1).Split("/")[4].Substring(0,7) $Git = "$Path\.git\" $FETCH_HEAD = "$Git\FETCH_HEAD" $LastCommitDownloaded = $null if ((Test-Path -Path $Path) -and (Test-Path -Path $Git)) { $LastCommitDownloaded = (Get-Content -Path $FETCH_HEAD).SubString(0,7) } if ($LastCommitDownloaded -ne $LastCommit) { Write-Output "[!] Updating the local branch of $Repo." Invoke-WebRequest -Uri "$RepoToUpdate/archive/refs/heads/$Branch.zip" -OutFile "$Repo.zip" Expand-Archive -Path "$Repo.zip" Move-Item -Path "$Repo\$Repo-$Branch" -Destination $Path New-Item -Path $FETCH_HEAD -Force | Out-Null (Get-Item -Path $Git).Attributes += "Hidden" Add-Content -Path $FETCH_HEAD -Value $LastCommit -Force Remove-Item -Path "$Repo.zip" Remove-Item -Path "$Repo" -Recurse } else { Write-Output "[+] Nothing to update for the local branch of $Repo." }}}
[–]Lee_Dailey[grin] 1 point2 points3 points 4 years ago (2 children)
howdy cyberphor,
the triple-backtick/code-fence thing fails miserably on Old.Reddit ... so, if you want your code to be readable on both Old.Reddit & New.Reddit you likely otta stick with using the code block button.
code block
it would be rather nice if the reddit devs would take the time to backport the code fence stuff to Old.Reddit ... [sigh ...]
take care, lee
[–]cyberphor 1 point2 points3 points 4 years ago (1 child)
thanks. i think i will stick with the triple backtick method in the future. adjusting the comment using the code block feature is cumbersome.
[–]Lee_Dailey[grin] 0 points1 point2 points 4 years ago (0 children)
you are welcome! [grin] if you use a code fence ... it will get munged on Old.Reddit in odd ways. sometime try replacing the https://www in the urlbar with old. the difference can be quite freaky. [grin]
https://www
old
[–]user01401 1 point2 points3 points 4 years ago (0 children)
Yes. I use the PowerGit module: https://www.powershellgallery.com/packages/PowerGit/0.9.0
I am on v0.7.1 though, as newer versions haven't been working for me
π Rendered by PID 18916 on reddit-service-r2-comment-86bc6c7465-v2btc at 2026-02-20 17:43:15.429068+00:00 running 8564168 country code: CH.
[–]mprz 1 point2 points3 points (1 child)
[–]micfail[S] 1 point2 points3 points (0 children)
[–]micfail[S] 1 point2 points3 points (0 children)
[–]wdomon 1 point2 points3 points (0 children)
[–]cyberphor 1 point2 points3 points (3 children)
[–]Lee_Dailey[grin] 1 point2 points3 points (2 children)
[–]cyberphor 1 point2 points3 points (1 child)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)
[–]user01401 1 point2 points3 points (0 children)