PowerShell: GoodSync Installer/Updater, Service Disabler and Cleanup

I use GoodSync for file synchronization a lot. While a awesome program, there are two major issues I find with it – the lack of a auto-update mechanism and the GoodSync Server service which is auto-enabled each time you update and I personally don’t use. So I created a PowerShell script to take care of all that. Downloading the msi, initiating the install/update, stopping and disabling the GoodSync Server services and cleaning up the temporary files and desktop icons. Enjoy!

GitHub

# GoodSync All
# This script is designed to install or update Goodsync, stop and disable services (GoodSync Server) and clean up desktop icons.
# Designed for GoodSync 10.x

# Checks for Administrator privileges and opens an elevated prompt is user has Administrator rights
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
}

# SSL Certificate Handling
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# All the variables
$sstat = Get-Service -Name GsServer
$sstart = Get-WmiObject -Query "Select StartMode From Win32_Service Where Name='GsServer'"
$dl = "https://www.goodsync.com/download/GoodSync-v10-Setup.msi"
$msi = "GoodSync-v10-Setup.msi"

# Downloads GoodSync .msi to system TEMP folder, installs and removes .msi
Invoke-WebRequest -uri $dl -OutFile $env:TEMP\$msi
Start-Process msiexec.exe -Wait -ArgumentList "/I $env:TEMP\$msi /quiet"
Remove-Item $env:TEMP\$msi

# Checks for Service Status
# Stops GoodSync Service if it's running, otherwise continues
if ($sstat.status -eq "running"){
    write-output "Stopping GoodSync Server"
    stop-service gsserver
    "Service is stopped"
    "Continuing....."
    ""
    }
elseif ($sstat.status -eq "stopped"){
    write-output "GoodSync Server is already Stopped"
    "Continuing....."
    ""
    }
if ($sstart.startmode -ne "disabled"){
    write-output "Setting GoodSync Server service to Disabled"
    set-service gsserver -startuptype disabled
    "Done"
    }
elseif ($sstart.startmode -eq "disabled"){
    write-output "GoodSync Server service is already Disabled"
    "Done"
    }

# Removes GoodSync desktop shortcuts
Remove-Item $env:public\Desktop\GoodSync*.lnk

 

HTTPS brought to you by Let’s Encrypt!

The site is now fully  (mostly anyways) running on HTTPS. Thanks to my new host, MDD Hosting, the entire site is now secured with a certificate from Let’s Encrypt. 1&1 couldn’t do that without a big bundle of cash and being locked into their service!

There’s still some bugs to be worked out but the lock is here to stay. Hopefully now that I’m done with fighting with 1&1 for the last 5 months I can get back to making some content.

PowerShell : Windows 10 Modern Application Removal Script

If you have Windows 10 you’ve not doubt seen the new modern apps and either love them, hate them or just don’t want to deal with them. Windows 10 does not provide an easy way to remove any of these applications or to keep them from running which can be a major issue for low RAM systems. The good news is they can quickly be removed via a few PowerShell commands or a script. The script below is one I’ve been using to manage them on my systems. You can also find a link to GitHub where I maintain this and several other PowerShell scripts I routinely use.

GitHub PowerShell Scripts | GitHub W10RemoveCoreApps Script
Read more of this post

Patching the vCenter 6.x Appliance

With the latest version of the vCenter Appliance (vCSA) there is a new process to patching the appliance. Gone is the old Web UI of the 5.x era. The new process isn’t anything to be scared about though and should be familiar to most Admins and techs. Instead of the old web interface the upgrade process is basically just to attach the patch ISO and run a few commands via the console or SSH.

While researching the proces to update my own server however I came across a few unclear instructions concerning the process. I worked out what I needed to do after a few searches and a couple KB’s. Most of this guide will be a rehash of others and the official instructions but I will be including a few clarifications as well as some visual representations of the process to help those that got a little confused by the regular instructions.

Read more of this post

Windows/Office Digital River and Azure Blob links removed

I’ve removed the Windows/Office download links as Microsoft has retired their Digital River/Azure Blob service (or at least removed Windows and Office from it). Since all the links now 302 and no longer work there is no point in keeping them up. I will continue looking for a new, safe source for ISO’s and Images for Windows and Office and update the page at that time. Until then it’s back to the old ways to getting them.

ESXi / vSphere 6.0 General Availability Offline Depot

VMware released vSphere 6.0 to GA (General Availability) on 3/12/15. If you want to upgrade you can pretty easily go to the VMware site and download the appropriate files. What is missing however is a Offline Depot for that who want to perform a in-place upgrade. It seems that VMware has chosen to only make the Depot available to those that have purchased a license for vSphere 6.0. I’m sure in time they will change this but until then I’ll be making the Offline Depot available for download here.

Offline Depot via Mega [Resumable]

Name: VMware-ESXi-6.0.0-2494585-depot.zip
Release Date: 2015-03-12
Build Number: 2494585

MD5SUM: bebc48450b9743c56073602931d63600
SHA1SUM: 79bf372bb7cd70bbbf2dd5f5819a7830468e2b7e

Otherwise, head to My VMware and get upgraded. You can see my previous post on upgrading with a Offline Depot here.

Don’t let your hard work put money in someone else’s pocket.

Don’t let your hard work put money in someone else’s pocket.

Windows/Office Digital River Links Updates [11/23/14]

I’ve  made some updates to the Windows/Office Digital River Links page to correct some broken links. Microsoft is currently in the process of migrating from their old Digital River servers to Azure. Due to that change many of the links are being changed in addition to some products being phased out. I’ll try to keep up with the changes but if I miss something just let me know. I will also be looking into a cleaner download interface so you’re not assaulted with a page full of links. The goal is a dropdown interface where you can just select your product and language and get your links. Going forward, this post will serve as the page for updates and contact for the Microsoft links.

Now as for the links themselves, I’ve made a few changes to how they are presented. For the most part they will remain the same but with the addition of alternative version and download links. For most people you can just download the latest version link but I’ll keep old versions linked for those who need them. Since this page is the second most popular page on the site I’m going to give it a little more attention and spruce it up.

Finally, a thanks to heidoc.net who figured out the change to the link structure and serve as the base source for links.

Windows/Office Digital River Links

Todo [11/23/14]:

  • Fix Broken links – Ongoing
  • Add additional alternative links
  • Clean up link presentation

Weekend Project: Process Explorer Auto Install

I was bored this weekend and decided to try my hand at making a PowerShell script to automate the install of Sysinternals Process Explorer. It’s pretty rough product of about 3 hours of work. I’ll make improvements in the future as I get time. In any case, it’s available below.

#### Downloads Process explorer from download.sysinternals.com,
#### unzips it into Program Files and then cleans up.
####
#### Sources:
####	s1: http://nyquist212.wordpress.com/2013/09/23/powershell-webclient-example/
####	s2: http://sharepoint.smayes.com/2012/07/extracting-zip-files-using-powershell/

#Checks for Administrator privileges and opens an elevated prompt is user has Administrator rights
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
}

# s1 
Function Get-Webclient ($urla, $out) {
    $proxy = [System.Net.WebRequest]::GetSystemWebProxy()
    $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
    $request = New-Object System.Net.WebClient
    $request.UseDefaultCredentials = $true ## Proxy credentials only
    $request.Proxy.Credentials = $request.Credentials
    $request.DownloadFile($urla, $out)
}

# s2 

# Expands the entire contents of a zip file to a folder
# MSDN References
# - Shell Object:   http://msdn.microsoft.com/en-us/library/windows/desktop/bb774094(v=vs.85).aspx
# - SHFILEOPSTRUCT: http://msdn.microsoft.com/en-us/library/windows/desktop/bb759795(v=vs.85).aspx
function Expand-Zip (
    [ValidateNotNullOrEmpty()][string]$ZipFilePath,
    [ValidateNotNullOrEmpty()][string]$DestinationFolderPath,
    [switch]$HideProgressDialog,
    [switch]$OverwriteExistingFiles
    ) {
    # Ensure that the zip file exists, the destination path is a folder, and the destination folder
    # exists. The code to expand the zip file will *only* execute if the three conditions above are
    # true.
    if ((Test-Path $ZipFilePath) -and (Test-Path $DestinationFolderPath) -and ((Get-Item $DestinationFolderPath).PSIsContainer)) {
        try {
            # Configure the flags for the copy operation based on the switches passed to this
            # function. The flags for the CopyHere method are based on the SHFILEOPSTRUCT
            # structure's fFlags field. Two of the flags are leveraged by this function.
            # 0x04 --- Do not display a progress dialog box.
            # 0x10 --- Click "Yes to All" in any dialog box displayed. Functionally overwrites any
            #          existing files.
            $copyFlags = 0x00
            if ($HideProgressDialog) {
                $copyFlags += 0x04
            }
            if ($OverwriteExistingFiles) {
                $copyFlags += 0x10
            }
            
            # Create the Shell COM object
            $shell = New-Object -ComObject Shell.Application
            
            # Get references to the zip file and the destination folder as Shell Folder COM objects
            $zipFile = $shell.NameSpace($ZipFilePath)
            $destinationFolder = $shell.NameSpace($DestinationFolderPath)
            
            # Execute a file copy from the zip file to the destination folder; which effectively
            # extracts the zip file's contents to the destination folder
            $destinationFolder.CopyHere($zipFile.Items(), $copyFlags)
        } finally {
            # Release the COM objects
            if ($zipFile -ne $null) {
                [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject($zipFile)
            }
            if ($destinationFolder -ne $null) {
                [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject($destinationFolder)
            }
            if ($shell -ne $null) {                
                [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject($shell)
            }
        }
    }
}

function mkdirs {
    mkdir $sDir\temp\ -force > $null
    mkdir $sDir\ProcessExplorer\ -force > $null
    mkdir "$start\Process Explorer" -force > $null
}

function shortcuts ($target, $link) {
    # Create a Shortcut with Windows PowerShell
    $TargetFile = $target
    $ShortcutFile = $link
    $WScriptShell = New-Object -ComObject WScript.Shell
    $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
    $Shortcut.TargetPath = $TargetFile
    $Shortcut.Save()
    }

# Variables
$sDir = $env:programfiles
#$uDir = $env:allusersprofile
$start = [Environment]::GetFolderPath('CommonStartMenu') + "\Programs"
$url = "http://download.sysinternals.com/files/ProcessExplorer.zip"
$file = $sDir + "\temp\ProcessExplorer.zip"

# Makes directories:
# ProcessExplorer directory in Program Files according to Environment variable\
# temp directory in Program Files for download
mkdirs
Get-Webclient $url $file
Start-Sleep -s 2
# Closes Process Explorer if running
Get-Process procexp* | stop-process –force
Expand-Zip $file "$sDir\ProcessExplorer\" -HideProgressDialog -OverwriteExistingFiles
Remove-Item "$sDir\temp\" -recurse
# Creates Start Menu shorcuts
shortcuts "$sDir\ProcessExplorer\Eula.txt" "$start\Process Explorer\EULA.lnk"
shortcuts "$sDir\ProcessExplorer\procexp.chm" "$start\Process Explorer\Process Explorer Help.lnk"
shortcuts "$sDir\ProcessExplorer\procexp.exe" "$start\Process Explorer\Process Explorer.lnk"
# Accepts EULA and starts minimized
start-process $sDir\ProcessExplorer\procexp.exe -ArgumentList "/AcceptEula /t"

 

Download ProcessExplorerInstaller.ps1 from Github
GitHub | PowerShell-Scripts / ProcessExplorerInstaller.ps1

Quick Fix: Fixing a loose Micro USB Cable

Almost everyone has a smartphone or another device that connects with a Micro USB cable. And almost everyone has had a cable become loose over time and not fit securely. It can be infuriating to have the cable drop out a the slightest movement or to head endless pings from your computer telling you the cable disconnected. Rather than throw out a cable and get a new one, here’s a simple 5-min fix that can restore your cable back to new (or at least make it stay put).

Read more of this post

Verified by MonsterInsights