Introducing PsUrl and PsGet
For about three weeks I am sick with PowerShell. Of course, I used it for few years now, but now everything is different. I am automating stuff that I never though about. And this automation requires some helpers for comfortable work. This post is all about such utilities. ## PsUrl This story started from simple task, I needed download stuff and I have list of URLs. So the idea is `Get-Content Urls.txt | ... `. The problem with `...`, there is more or less nothing to download stuff from the web in PS. Of course we can use [WebClient](http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadstring.aspx) from .NET. (New-Object Net.WebClient).DownloadString($Url) Well, this works, but not really super native, for example you cannot pipe URL directly from Get-Content. So I decided to implement simple wrapper and package it as a module. This is how [PsUrl](https://github.com/chaliy/psurl/) micro project started. After installing PsUrl.psm1 module, you will get few commands. Most interesting is Get-Url. Get-Url http://example.com This will basically download stuff from example.com and return it as a string. Of course you can pipe in and pipe out. Get-Content Urls.txt | Get-Url $_ Get-Url http://example.com | Set-Content example.html Easy. The most visible problem here, is that you need install it. This is not super tricky, but rather annoying. This is how [PsGet](https://github.com/chaliy/psget/) micro project started. ## PsGet Inspired by [NuGet](http://nuget.org/), I started to think how to simplify module installation in PS. I found [Install-Module](http://poshcode.org/1875) script by Joel Bennett. It takes any single file module and install it to user modules or for global use. Do you see what I see? If you combine it with download stuff I already have, installation of the modules can became simple as Import-Module PsGet Install-Module https://github.com/chaliy/psurl/raw/master/PsUrl/PsUrl.psm1 Nice? Last command actually installs previous PsUrl module. I have huge plans (and hopes) about this project. Right now it supports installing multi file modules, zipped packages from web or local file. Will support NuGet, possible registry of modules. And btw, it has single line installer. (new-object System.Net.WebClient).DownloadString("https://github.com/chaliy/psget/raw/master/GetPsGet.ps1") | invoke-expression Downloads and installs PsGet for your user account. That is all for now, in few days I will describe how remotely install and fully configure web server without RDP. Enjoy!












