Close

# PowerShell – nslookup

If you want to check if machines fqdn is mapped to a ip address in dns, then on a windows machine you do: start->enter “nslookup” then type domain name, and hit enter, e.g.: You should get an output like this: > google.com Non-authoritative answer: Name: google.com Addresses: 2a00:1450:4009:800::200e 216.58.210.46 >

April 29, 2015

# PowerShell – Active Directory

Active Directory is a type of LDAP. You can query active directory using set of powershell commands. To do this you need to first turn on the AD windows feature. You do this on windows like this: start -> control panel -> programs -> Program and Features -> Turn windows […]

February 10, 2015

# PowerShell – Using WinSCP to copy files to/from Linux machines

It is possible to copy files to/from a linux machine using Powershell. This can be done using a free tool called winscp. Winscp is actually a gui based tool, but you can use it from # I created this script using the following as an inspiration: # http://winscp.net/eng/docs/library_powershell#installing_the_assembly # Load […]

February 9, 2015

# Powershell – Make a permanent change to the “path” environment variable

A common task you often need to do is append a new path to the path environment variable: $ENV:PATH The first way is simply to do:$ENV:PATH=”$ENV:PATH;c:\path\to\folder” But this change isn’t permenantly,$env:path will default back to what it was before as soon as you close your powershell terminal and […]

October 18, 2014

# PowerShell – Working with providers

Chapter 5 – Working with providers WordPress has things called plugins, which can extend wordpress’s features. Powershell has similar features which are called snapins and modules. In PS, we have things called “PSDrives”. These are a bit like virtual hard drives (vhdds). Some of these virtual hdds stores a normal […]

July 27, 2014

# Enable-psremoting while Virtualbox is installed

If you have virtualbox installed on your machine, then as a side effect, you’ll discover that the enable-psremoting no longer works. That’s because as part of the vb install, it created a “public network” adapter as a byproduct, which blocks enable-psremoting from working. This is actually a bug relating to […]

July 27, 2014

# PowerShell – IIS automation

You can view the IIS gui conole by running “Inetmgr” on the commandline.     To automate IIS you first need to ensure you have the “webadministration”:   [powershell] PS C:\Windows\system32> Get-Module -ListAvailable Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules ModuleType Version Name ExportedCommands ———- ——- —- —————- Manifest 1.0.0.0 ADRMS {Update-ADRMS, Uninstall-ADRMS, Install-ADRMS} Manifest […]

July 16, 2014

# PowerShell – Detect what version of .NET is installed

http://stackoverflow.com/questions/199080/how-to-detect-what-net-framework-versions-and-service-packs-are-installed   The tale given in the first answer in the above stackoverflow questions shows what to look for. Then do:   [powershell] cd HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP ls [/powershell] This should give output that looks like: cd HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP ls SKC VC Name Property — — —- ——– 1 […]

July 1, 2014

# Powershell – Accessing the registry

There are 2 main cmdlets you use to identify and navigate the registry (instead of using regedit). First of you navigate the registry in the same style as navigating a folder structure, i.e. you navigate it using cd and get-childitem. But the registry doesn’t reside inside the c:\ drive, instead […]

July 1, 2014

# PowerShell – Using psexec to automate UI tasks on remote machines

When you use PowerShell native remoting commands, e.g. invoke-command, the remote server acts as a terminal server, and doesn’t have an active UI session. This means that you can’t do something like this: [powershell] powershell -computername {name} -scriptblock {notepad.exe} [/powershell] Officially there are no powershell cmdlets that you can use […]

June 10, 2014