Extremely Serious

Category: Tool (Page 4 of 4)

Chocolatey Package Manager

Introduction

If you are familiar with package manager of linux (e.g. rpm, apt-get, yum, dpkg, …) or mac (i.e. brew) here is the windows version.

Powershell Behind Proxy (if necessary)
Setting default Powershell TLS Protocol (if necessary)

Requirements

• Windows 7+ / Windows Server 2003+
• PowerShell v2+
• .NET Framework 4+ (the installation will attempt to install .NET 4.0 if you do not have it installed)

Installation using Powershell

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Proxy configuration (if necessary)

choco config set proxy <locationandport>
choco config set proxyUser <username> #optional
choco config set proxyPassword <passwordThatGetsEncryptedInFile> # optional
choco config set proxyBypassList "'<bypasslist, comma separated>'" # optional, Chocolatey v0.10.4 required
choco config set proxyBypassOnLocal true # optional, Chocolatey v0.10.4 required

Example

choco config set proxy http://localhost:8888
choco config set proxyUser bob
choco config set proxyPassword 123Sup#rSecur3
choco config set proxyBypassList "'http://localhost,http://this.location/'" #0.10.4 required
choco config set proxyBypassOnLocal true #0.10.4 required

Usage

Displaying the tool capabilities

choco -?

Useful Commands

CommandDescription
installInstalls a particular package.
list --local-onlyLists installed packages using chocolatey on local machine.
searchSearches a package availability.
uninstallUninstalls a package.
upgradeUpgrades a package.

Alternative to CLI search command

https://chocolatey.org/packages

Reference

https://chocolatey.org/

Make the Target Folder always in-sync from the Source Folder using Beyond Compare

  1. Create a folder compare session with beyond compare like the following:
  2. Save the session with a file name without any special characters (e.g. < or >) or spaces (i.e. necessary not to confuse the scheduler).
  3. Save the following beyond compare script to right-updater.bc file.
    #Write to right-updater.log
    log normal "right-updater.log"
    
    #Load a folder compare session.
    load "%1"
    
    #Confirmation will be set to yes by default. 
    option confirm:yes-to-all
    
    #Make the right equals to the left of the loaded folder from the session.
    sync mirror:left->right
  4. Save the following powershell script to bcrunner.ps1 file along the side right-updater.bc file.
    #expects 2 command line parameters
    param([string]$script, [string]$session)
    
    #The beyond compare command to be used.
    $cmd="C:\Program Files\Beyond Compare 4\BComp.com"
    
    #Holds the session argument for the beyond compare command.
    $args="""$session"""
    
    #Write on screen the actual command to be executed.
    write-output "$cmd /silent @$script $args"
    
    #Perform the command.
    &$cmd /silent @$script $args
  5. Schedule using windows task scheduler and on the actions tab fill in the following fields like:
    Action Start a program
    Program/script powershell
    Add arguments(optional) ./bcrunner.ps1 right-updater.bc <SAVED_SESSION_FROM_STEP_2>
    Start in (optional) <DIRECTORY_OF_BCRUNNER.PS1_FILE_FROM_STEP_4>

    Note: Fill-in the other tabs of the scheduler accordingly.

Install Jabba in Powershell behind proxy

Jabba is a java version manager (see https://github.com/shyiko/jabbathat simplifies the installation and switching of/to different JDK.

If your powershell is behind the firewall follow the procedure here.

Install Jabba using the following cmdlet:

Note: If you encountered something like jabba.ps1 cannot be loaded because running scripts is disabled on this system. For
more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170 see running unsigned script.

Invoke-Expression (
        wget https://github.com/shyiko/jabba/raw/master/install.ps1 -UseBasicParsing
    ).Content
Newer posts »