Contents tagged with powershell
-
Get the currently logged in user identity via PowerShell
Sometimes we need to know exactly our identity. For instance, if we want to set an application pool's identity in IIS, then we need to know exactly how to write our current user identity. This is how. … more
-
7zip - Extract an archive to a specific directory from the command line.
Command Line 7z e foobar.zip -oFoobar Yes. A space does not separate the -o switch from the destination directory. PowerShell & 7z e foobar.zip -oFoobar Without an ampersand, PoSH will bark: … more
-
Daily Office PowerShell
Get-History history | group { $_.CommandLine } history | where { $_.CommandLine - like "*foobar*" } history | group { $_.CommandLine } | select count, name history | group { $_.CommandLine } | … more
-
Filter PowerShell History
history | where { $_.CommandLine -like "*some-term*" } See also Where-Object http://technet.microsoft.com/en-us/library/ee177028.aspx Get-History http://technet.microsoft.com/en-us/library/hh84969 … more
-
Rename all files in a directory, and add a counter to each name.
Without AliasesGet-ChildItem | ForEach-Object -Begin { $i = 0 } -Process { Rename-Item -Path $_ -NewName ("someNewName-" + $i + $.Extension); $i++; } With Aliasesdir | % -b { $i = 0 } { rni $ … more
-
Work with the PowerShell location stack
If you navigate among directories a lot, the following will be useful. Here is an example workflow. Save your current directory with push-location Go to another directory with cd <path> … more
-
Generate a new SSH Key and add it to GitHub with OpenBSD and PowerShell
First Steps, in PowerShell (or another shell) Generate a new SSH key, of type RSA, with your email as a comment ssh-keygen -t rsa -C "[email protected]" Generating public/private rsa key pair. … more
-
Using SSH in Git for Windows with PowerShell
This is a brain dump after having configured SSH in PowerShell with Git and GitHub. Use the githubrsa SSH key outside of Git Shell Install GitHub for Windows. This will add two files to your ~. … more
-
Posh-Git: Avoid having to input your username and password for each push
Phil Haack gives the steps here: http://haacked.com/archive/2011/12/19/get-git-for-windows.aspx/ Install msysgit (aka Git for Windows). Update Posh-Git Add the ssh-agent to your PATH. This worked … more
-
Installing PsGet: No Valid Module File Was Found in Any Module Directory
The instructions at PsGet.Net failed for me at step 3. Download PsGet.psm1 from https://github.com/psget/psget/ Copy PsGet.psm1 to your modules folder (e.g. Modules\PsGet\ ) Execute Import-Module … more