Skip to content

Monthly Archives: February 2007

PowerShell and web services without the hassle

28-Feb-07

I wrote about using the SharePoint web services from PowerShell before. In order to consume the web service, you needed wsdl.exe to generate a proxy class and csc.exe to generate an assembly. As Lee Holmes points out, those requirements make such PowerShell scripts not very portable because wsdl.exe is not part of the .NET Framework. […]

PowerShell Remoting

28-Feb-07

If you want to run PowerShell on remote machines, you can try PowerShell Remoting. It remotes the user interface with a couple of restrictions. For example, you cannot use command completion (<TAB>) and you cannot execute ‘external’ programs (.exe). Installation is simple: install a server component and a client component and you are done. With […]

PowerShell and registry access

28-Feb-07

PowerShell can access the registry like any PowerShell drive. Two drives are available: HKCU (HKEY_CURRENT_USER) and HKLM (HKEY_LOCAL_MACHINE). Navigate to HKLM or HKCU like so:
cd hklm:cd hkcu:

Isn’t that simple? Now you can use the dir or ls command (aliases for get-childitem) to list the content. The result:

I usually create another PS drive that maps to […]

SharePoint, PowerShell and web services

27-Feb-07

SharePoint comes with many web services that allow you to do many things from working with users to working with SharePoint sites and much more. In the past, if an administrator wanted to work with these web services from a scripting language, it was not that easy. Sure, you could create something with Visual Studio […]

SharePoint, PowerShell and XML

27-Feb-07

In PowerShell, it is quite easy to work with XML, even if you are not very familiar with it. Because a lot of applications come with XML configuration files or output XML administrators should know how to work with XML from a scripting language. Since XML is just text, any scripting language can be used […]

Working with the file system and PS drives

25-Feb-07

Working with the file system in PowerShell is not that different from the good old Windows command prompt. Because of aliases and functions you have all the familiar commands at your fingertips: cd, del, copy, mkdir, rmdir, move, … To know the actual PowerShell cmdlet behind one of these aliases, for example copy, use alias […]

Customizing PowerShell with a profile

25-Feb-07

Windows PowerShell can be customized with a profile. A profile is just a PowerShell script that you have to save in a specific location. For detailed information about profiles, you should check out msdn.microsoft.com.
Basically, there are four different profiles:

profile.ps1 in %windir%\system32\WindowsPowerShell\v1.0: this profile applies to all users and all shells.
Microsoft.PowerShell_profile.ps1 in the same directory: this […]

Functions

24-Feb-07

This page contains PowerShell functions you might find useful.
Windows Administration
- Enable remote desktop (source: PowerShell blog and here). Does not work for Vista :-).
Function Enable-RDP ($Server)
{
$Terminal = Get-WmiObject Win32_Terminal –Computer $Server
$Terminal.Enable($True)
}
- Run as
Function Run-as
{
$cred = get-credential
[System.Diagnostics.Process]::start($args[0], $null, $cred.UserName, $cred.password, $null)
}
- Convert a SecureString to cleartext. Useful if you need to pass the cleartext password to […]

Use Console 2.0 to run PowerShell

24-Feb-07

Normally, PowerShell runs in a normal Windows console window. Console, now at version 2.0, enhances the console experience with multiple tabs, better text selection, different backgrounds, transparency and so on. Download the application from sourceforge.net and install it. I downloaded this file. There is no installer in the package so just copy the console folder […]

Add-ons

24-Feb-07

PowerShell Community Extensions
The PowerShell Community Extensions can be found on CodePlex. These extensions add a lot of functionality to PowerShell, just take a look at the features (1.1). To install, just grab the msi from CodePlex and run it.
From version 1.1, the installation works fine on Windows Vista. Uninstall previous versions if you are upgrading.
If […]