Archive

Archive for the ‘PowerShell’ Category

PowerShell: About SessionConfiguration and how to change them

April 24th, 2010 christian No comments

Remote Access Without Admin Privileges

In PowerShell v.2, remote access is available only to users who hold local administrator privileges. So, even if you do have appropriate remote access to a machine, , you cannot remotely access the system if you are not an Admin. This is not a technical limitation, though, just a safe default. You should use this line to change it :

Set-PSSessionConfiguration -Name Microsoft.PowerShell -showSecurityDescriptorUI

Categories: PowerShell Tags: PowerShell

PowerShell: Generate PC Lists using Foreach-Object and -f Operator

April 24th, 2010 christian No comments

Generate PC Lists

One easy way of creating lists of PC names or IP address ranges etc is a simple pipeline like this:

1..40 | Foreach-Object { ‘PC-W7-A{0:000}’ -f $_ }

Use the -f operator to format the number. In this example, it will always be three-digit.

Categories: PowerShell Tags: PowerShell

PowerShell: Sort-Object

April 24th, 2010 christian No comments

You can use Sort-Object to sort simple variable types. Have a look at the following:

‘Tom’, ‘Chris’, ‘Judy’, ‘Alan’ | Sort-Object

Input can come from a different command. If you’d like to get seven random lottery numbers, you should try this:

1..49 | Get-Random -Count 7 | Sort-Object

You’ll find that when you feed complex objects into Sort-Object, you should specify the object property you want to sort on (or else Sort-Object will pick one by itself):

Get-ChildItem $env:windir | Sort-Object Length

Here are some more examples:

Get-HotFix | Sort-Object InstalledOn

Get-ComputerRestorePoint | Sort-Object Description

Categories: PowerShell Tags: PowerShell

Microsoft Exchange 2007 / 2010 – Statistics using Exchange Management Shell (EMS)

March 14th, 2010 christian No comments
Using Microsoft Exchange 2007 / 2010 Management Shell (PowerShell with extensions), you can pull out some very exciting statistics. That was never that easy in the pre Exchange 2007 era. Logo_ExchangeSvr

Read more…

PowerShell: Creating large dummy files with .NET

March 13th, 2010 christian No comments
Ok, this one’s is cool i think. Whenever i needed a large dummy file, i opened up notepad, write ASDFASDFASDFA CTRL-A, CTRL-C, CTRL-V,CTRL-V,CTRL-V,CTRL-V. CTRL-A, CTRL-C, CTRL-V,CTRL-V,CTRL-V,CTRL-V,CTRL-V.. Then i saved the file, opened up a CMD-Shell and wrote copy dummyFile.txt+dummyFile.txt+dummyFile.txt until the file was large enough.. ok, there’s fsutil.exe which does the same in a much more efficient manner.. OR, unleash the Power of .NET – no, you don’t have to start programming using Visual Studio, just open up PowerShell.. Logo_PowerShell

Read more…

Categories: PowerShell Tags: PowerShell

PowerShell: Running PowerShell Scripts as Scheduled Task

March 10th, 2010 christian No comments
Schtasks.exe – Enables an administrator to create, delete, query, change, run, and end scheduled tasks on a local or remote computer. Running Schtasks.exe without arguments displays the status and next run time for each registered task.

If you have jobs that need to execute regularly, you can manage them with a PowerShell script and make it a scheduled task:

Logo_PowerShell

Read more…

Categories: PowerShell Tags: PowerShell, Scheduled Task

PowerShell: Delete specific files recursively / recursive

February 19th, 2010 christian No comments
Okay, this post I’m going to write down for my personal notes but also for you..
Ever needed to delete a specific file, in my case in need to delete (remove-item) all *.pdb files in one of my Visual Studio Solution.. recursive of course.
To get a list of Files use the Get-ChildItem CmdLet. Extend that command using the –rec or –recurse parameter – so you’ll get all the files recursively, starting from the current path / directory.
Logo_PowerShell

Read more…

PowerShell: Remote Access Without Admin Privileges

January 29th, 2010 christian No comments
In PowerShell v.2, remote access is available only to users who hold local administrator privileges. So, even if you do have appropriate remote access to a machine, , you cannot remotely access the system if you are not an Admin. This is not a technical limitation, though, just a safe default. Logo_PowerShell

Read more…

Categories: Microsoft, PowerShell Tags:

PowerShell: Enabling PowerShell v2 Remotely

November 20th, 2009 christian No comments
Looking for how to configure the local computer for remote management using Microsoft PowerShell?
Set-WSManQuickConfig

This command sets the required configuration to enable remote management of the local computer. By default, this command creates a WS-Management listener on HTTP.

Logo_PowerShell

Read more…

Categories: Microsoft, PowerShell, Windows 7 Tags:

Accessing Individual WMI Instances

October 28th, 2009 christian No comments

Did you know, accessing individual WMI Instances and their Namespaces is pretty easy as 1-2-3..


You always get back all instances of a given WMI class when using Get-WMIObject. However, what if you just wanted to get a specific instance? Or you just wanted to find out how much space is left on drive C:? The next line gives you all drives:

Logo_PowerShell

Read more…

Categories: Microsoft, PowerShell Tags:
WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera