Top "Powershell-2.0" questions

For topics and problems related specifically to Windows PowerShell 2.0. PowerShell 2.0 shipped with the releases of Windows 7 and Windows Server 2008 R2.

How to get all groups that a user is a member of?

PowerShell's Get-ADGroupMember cmdlet returns members of a specific group. Is there a cmdlet or property to get all the groups …

powershell active-directory powershell-2.0
How do you comment out code in PowerShell?

How do you comment out code in PowerShell (1.0 or 2.0)?

powershell syntax powershell-2.0 comments
How to get disk capacity and free space of remote computer

I have this one-liner: get-WmiObject win32_logicaldisk -Computername remotecomputer and the output is this: DeviceID : A: DriveType : 2 ProviderName : FreeSpace : Size : …

powershell scripting powershell-2.0
What's the best way to determine the location of the current PowerShell script?

Whenever I need to reference a common module or script, I like to use paths relative to the current script …

powershell powershell-2.0
How do I convert an array object to a string in PowerShell?

How can I convert an array object to string? I tried: $a = "This", "Is", "a", "cat" [system.String]::Join(" ", $a) …

powershell powershell-2.0
How do I get only directories using Get-ChildItem?

I'm using PowerShell 2.0 and I want to pipe out all the subdirectories of a certain path. The following command outputs …

powershell powershell-2.0
How to find the Windows version from the PowerShell command line

How do I find which Windows version I'm using? I'm using PowerShell 2.0 and tried: PS C:\> ver The term …

windows powershell powershell-2.0
Get full path of the files in PowerShell

I need to get all the files including the files present in the subfolders that belong to a particular type. …

powershell powershell-2.0
How to run a Powershell script from the command line and pass a directory as a parameter

PowerShell -Command .\Foo.ps1 Foo.ps1: Function Foo($directory) { echo $directory } if ($args.Length -eq 0) { echo "Usage: Foo <directory&…

powershell powershell-2.0
Delete files older than 15 days using PowerShell

I would like to delete only the files that were created more than 15 days ago in a particular folder. How …

powershell powershell-2.0 powershell-3.0