PowerShell
Share your PowerShell scripts
112 topics in this forum
-
## Downloads latest PDQ from Company Dropbox and silently installs or updates if already installed # Path for the workdir $workdir = "c:\installer\" # Check if work directory exists if not create it If (Test-Path -Path $workdir -PathType Container) { Write-Host "$workdir already exists" -ForegroundColor Red} ELSE { New-Item -Path $workdir -ItemType directory } # Download the installer $url = "https://www.dropbox.com/PDQ13.exe?dl=1" # Put your Url with the file here..I use dropbox, you can use whatever file hosting service. $destination = "$workdir\pdq13.exe" # Check if Invoke-Webrequest exists otherwise execute WebClient if (Get-…
-
- 0 replies
- 5.1k views
-
-
I made a install script for CCleaner to do a Silent install and clean if needed. Improvements are welcome! When a new version of FireFox comes out, just change the firefox version or url to the new value. # Silent Install Firefox # Download URL: https://www.mozilla.org/en-US/firefox/all/ # Path for the workdir $workdir = "c:\installer\" # Check if work directory exists if not create it If (Test-Path -Path $workdir -PathType Container) { Write-Host "$workdir already exists" -ForegroundColor Red} ELSE { New-Item -Path $workdir -ItemType directory } # Download the installer $source = "https://download.mozilla.org/?product=firefox-51.0.1-SSL&os=win64&…
-
- 1 reply
- 38.3k views
-
-
I'm not sure this is the correct section to post in, but I am having issues with a sample script I wrote. In testing out the automation features of Pulseway, I wrote a script to start the PC Monitor service (because I am having issues with it not starting all of the time). Here is the script: Get-Service "PC Monitor" | Where {$_.status –eq 'Stopped'} | Start-Service Here is the error I get in return : At C:\Program Files\Pulseway\automation_a5487285_b624_4996_8bc3_3440ed567e5a.ps1:1 char:47 + ... ice "PC Monitor" | Where {$_.status Æ’?"eq 'Stopped'} | Start-Service + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The s…
-
- 2 replies
- 6.3k views
- 1 follower
-
-
I made a install script for Adobe Reader DC to do a Silent install. UPDATED VERSION 2 With auto detect if Invoke-WebRequest exists Improvements are welcome! Change the version if needed in the Source URL: http://ardownload.adobe.com/pub/adobe/reader/win/AcrobatDC/1502320053/AcroRdrDC1502320053_en_US.exe # Silent install Adobe Reader DC # https://get.adobe.com/nl/reader/enterprise/ # Path for the workdir $workdir = "c:\installer\" # Check if work directory exists if not create it If (Test-Path -Path $workdir -PathType Container) { Write-Host "$workdir already exists" -ForegroundColor Red} ELSE { New-Item -Path $workdir -ItemType directory …
- 5 replies
- 40.9k views
- 1 follower
-
I made a install script for CCleaner to do a Silent install and clean if needed. UPDATED VERSION 3 With auto detect if Invoke-WebRequest exists Improvements are welcome! When a new version of CCleaner comes out, just change the ccsetup526 to the new value. # CCleaner Download / Update Location # http://www.piriform.com/ccleaner/download mkdir C:\CCleanerInstall Invoke-WebRequest http://download.piriform.com/ccsetup526.exe -OutFile C:\CCleanerInstall\ccsetup526.exe Start-Process -FilePath "c:\CCleanerInstall\ccsetup526.exe" -ArgumentList "/S" Start-Sleep -s 20 rm-R -Force C:\CCleanerInstall If you want you can also add: Start-Process -FilePath "C…
-
- 2 replies
- 11.3k views
-
-
I made a install script for Calibre to do a Silent install. UPDATED VERSION 2 With auto detect if Invoke-WebRequest exists Improvements are welcome! # Silent Install Calibre # https://calibre-ebook.com/download # Path for the workdir $workdir = "c:\installer\" # Check if work directory exists if not create it If (Test-Path -Path $workdir -PathType Container) { Write-Host "$workdir already exists" -ForegroundColor Red} ELSE { New-Item -Path $workdir -ItemType directory } # Download the installer $source = "https://calibre-ebook.com/dist/win32" $destination = "$workdir\calibre.msi" Invoke-WebRequest $source -OutFile $destination # Start the inst…
-
- 1 reply
- 5k views
-
-
I made a install script for Skype to do a Silent install. UPDATED VERSION 2 With auto detect if Invoke-WebRequest exists Improvements are welcome! # Silent Install Skype # https://www.skype.com/en/download-skype/skype-for-windows/ # Path for the workdir $workdir = "c:\installer\" # Check if work directory exists if not create it If (Test-Path -Path $workdir -PathType Container) { Write-Host "$workdir already exists" -ForegroundColor Red} ELSE { New-Item -Path $workdir -ItemType directory } # Download the installer $source = "http://www.skype.com/go/getskype-full" $destination = "$workdir\skype.exe" Invoke-WebRequest $source -OutFile $destination # Sta…
-
- 1 reply
- 15.8k views
-
-
I made a install script for Google Chrome to do a Silent install. UPDATED VERSION 2 With auto detect if Invoke-WebRequest exists Improvements are welcome! When a new version of Google Chrome comes out follow this url: https://enterprise.google.com/chrome/chrome-browser/ Next find the download button -> Right click on the download button and choose Copy Download Location paste it in the script and it will download the latest version. # Silent Install Chrome # https://enterprise.google.com/chrome/chrome-browser/ # Path for the workdir $workdir = "c:\installer\" # Check if work directory exists if not create it If (Test-Path -Path $wor…
-
- 1 reply
- 23.2k views
-
-
I made a install script for Winrar to do a Silent install. UPDATED VERSION 2 With auto detect if Invoke-WebRequest exists Improvements are welcome! When a new version of Winrar comes out, just change the winrar-x64-540.exe to the new value. # Silent Install Winrar # http://www.winrar.com # Path for the workdir $workdir = "c:\installer\" # Check if work directory exists if not create it If (Test-Path -Path $workdir -PathType Container) { Write-Host "$workdir already exists" -ForegroundColor Red} ELSE { New-Item -Path $workdir -ItemType directory } # Download the installer $source = "http://rarlab.com/rar/winrar-x64-540.exe" $destination …
-
- 10 replies
- 23.3k views
- 1 follower
-
-
Windows will sometimes refuse to start non-critical services on boot (eg. Pulseway), when resources are low. I've noticed a few Win7 machines have run for weeks without Pulseway being allowed to start. As the powershell cmdlet "Set-Service –Name –Computer -StartupType" doesn't seem to allow delayed-start, I'm using this script as a work-around. You'll need to manually stop the service before running this script and then manually re-start it afterwards. I have NOT thoroughly tested this script and I take no credit or responsibility for it - it is something that I poached and re-factored and I'm not experienced in PowerShell. Regards, Delay PC Monitor service s…
-
- 0 replies
- 3.6k views
-
-
The Pulseway Automation contains the Builtin "Cleanup Temporary Files" powershell. I thought it might be worth a conversation. Here's the current code: $folders = @("C:\Windows\Temp\*", "C:\Documents and Settings\*\Local Settings\temp\*", "C:\Users\*\Appdata\Local\Temp\*", "C:\Users\*\Appdata\Local\Microsoft\Windows\Temporary Internet Files\*", "C:\Windows\SoftwareDistribution\Download", "C:\Windows\System32\FNTCACHE.DAT") foreach ($folder in $folders) {Remove-Item $folder -force -recurse -ErrorAction SilentlyContinue} exit 0 I'm not sure it is worth removing the SoftwareDistribution\Download files? From what I understand in Windows 10 you have to run, net stop…
-
- 0 replies
- 9.3k views
-
-
Hi, I am trying to automate the run of disk clean-up tool (cleanmgr) on my managed computers. I have created a script that prepares the "sageset" on computers and that seems to be working OK. The problem I am running into is that when I remotely launch the script/1-liner that executes the cleanmgr to effectively run the created sageset, it just hangs while using a certain percentage of CPU. Do you have any idea what I'm doing wrong? prepare.sageset.ps1: this prepares the "sageset" in registry. I'm using sageset 0x0100. run.cleanup.ps1: this starts the "sagerun". It works just fine when executed manually from powershell but I'm running into the above-descrip…
-
- 2 replies
- 5.2k views
- 1 follower
-