Wednesday, May 18, 2022

How to download old versions of Mac OS X

I have a 27" sandybridge iMac; which is a perfectly capable machine; I could load and run the latest version of Windows, Linux just fine.  Apple however has decided to drop support for these machines; they are more then 10 years old but for 99% of what they are used for it is fine; I don't really see why apple hasn't included these in their code base besides wanting people to buy new vendor locked in hardware.  I digress; things are what they are.

On a computer with a browser you will want to copy the links and paste them in your URL bar.  It is highly recommended to be using some sort of mac for this.  The OS will download as InstallMacOSX.dmg or MacOS.dmg  I personally rename it to the version I have downloaded and adjust my script for making the USB boot disk.  I was the kind of guy to buy EVERY release of OS X and I do have from OS 9 to Snow Leopard (my favorite version).

The following links below require the apple apps store to download the DMG images for Mac OS 10.  The OS images affected are Mac OS High Sierra to Big Sur require the safari browser to accesses the Apple App Store on MacOS.  Safari finds the old installers in the App Store and allows you to download them. After you download the installer from the App Store, the installer opens automatically.

  • macOS Big Sur can upgrade Catalina, Mojave, High Sierra, Sierra, El Capitan, Yosemite, Mavericks
  • macOS Catalina can upgrade Mojave, High Sierra, Sierra, El Capitan, Yosemite, Mavericks
  • macOS Mojave can upgrade High Sierra, Sierra, El Capitan, Yosemite, Mavericks, Mountain Lion
  • macOS High Sierra can upgrade Sierra, El Capitan, Yosemite, Mavericks, Mountain Lion

Pre-High Sierra can be downloaded on any computer but you have to copy and paste the full link which I have below the bulleted version.  


The older installers allows other browsers to download them as a disk image named InstallOS.dmg or InstallMacOSX.dmg respectively. On a Mac the Open the disk image, then open the .pkg installer inside the disk image. It installs an app named Install [Version Name]. Open that app from your Applications folder to begin installing the operating system.


You can also get this info from Apple's Website here https://support.apple.com/en-us/HT211683

Powershell Script To Download and Convert Images to JPG

The following powershell script is for downloading and converting images from PNG and TIFF format to JPG.  The CSV file looks something like this.


The script is pretty simple, download files then convert them from TIF to PNG then to JPG



Here is the script

#This script downloads all the images converts them to JPG files for a website.

#first import the CSV File

$CSVFILE = Import-CSV -Path downloadImgs.csv

#Get the length of the url

$CSVFILE | ForEach-Object {$_.'Image'.length}

#Get the length of the url

$CSVFILE | ForEach-Object {$img = $_.'Image'.substring($_.'Image'.length, 5)}

#Get the file Ext

$CSVFILE | ForEach-Object {$_.'Image'.Substring(($_.'Image'.length-9), 4) }


#Save Image File List Replace the website URL with the URL you want to point to.  You can use this for having a list of items downloaded or if your importing them in a bulk process

$CSVFILE | ForEach-Object { "https://yourwebsite.com/images/$location"+,-join ($_.'Image')+,".jpg"} | Out-File imageURLs.txt


#Download Image and rename the image to the Name in the CSV file

$CSVFILE | ForEach-Object { Invoke-WebRequest -Uri $_.'Image' -OutFile (-join ($_.'Name'+, $_.'Image'.Substring(($_.'Image'.length-9), 4))) }


#Download if just a JPG image hosted on a website.  Name it by Name value and add jpg extension.

$CSVFILE | ForEach-Object { Invoke-WebRequest -Uri $_.'Image' -OutFile (-join ($_.'Name'+,".jpg")) }


  function ConvertTIF-To-PNG

{

    [cmdletbinding()]

    param([Parameter(Mandatory=$true, ValueFromPipeline = $true)] $Path)


    process{

        if ($Path -is [string])

        { $Path = get-childitem $Path }


        $Path | foreach {

            $image = [System.Drawing.Image]::FromFile($($_.FullName));

            $FilePath = [IO.Path]::ChangeExtension($_.FullName, '.png');

            $image.Save($FilePath, [System.Drawing.Imaging.ImageFormat]::PNG);

            $image.Dispose();

        }

    }

 }

 #Use function:

 #Cd to directory w/ TIF files

 cd .\

 #Run ConvertTIF-To-JPG function

 Get-ChildItem *.tif | ConvertTIF-To-PNG

 #Remove TIF Files once converted

 Remove-Item * -Include *.tif


#once all the tiff files are converted convert PNG to JPG

  function ConvertTo-Jpg

{

    [cmdletbinding()]

    param([Parameter(Mandatory=$true, ValueFromPipeline = $true)] $Path)


    process{

        if ($Path -is [string])

        { $Path = get-childitem $Path }

        $Path | foreach {

            $image = [System.Drawing.Image]::FromFile($($_.FullName));

            $FilePath = [IO.Path]::ChangeExtension($_.FullName, '.jpg');

            $image.Save($FilePath, [System.Drawing.Imaging.ImageFormat]::JPEG);

            $image.Dispose();

        }

    }

 }

 #Use function:

 #Cd to directory w/ png files

 cd .\


 #Run ConvertTo-JPG function

 Get-ChildItem *.png | ConvertTo-JPG

 #REMOVE PNG FILES

 Remove-Item * -Include *.png

Tuesday, May 03, 2022

How to logout of windows desktop from command line - (tsdiscon)

 How to logout of windows desktop from command line - (tsdiscon)

Background:  I had setup a windows machine that I setup to be used as a papercut print terminal.  I had removed all logout options on windows as you can see below on the start menu.


So for making changes such as adding things like scheduled tasks you have to login to the admin account, and to do that you use the tsdiscon command from a powershell or cmd window.


Which will then log you out of windows and you can login as any account you have active on the machine, in this case the admin account as shown below.


.






How to fix CURL call imporitng an RSS feed on a site blocking CURL calls

There is a 3rd party service provider that my organization uses called bibliocommons.  They have these nice book carousels.  However the car...