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. For general PowerShell topics, use the `PowerShell` tag.

learn more… | top users | synonyms

6
votes
2answers
3k views

What security setting is preventing Remote PowerShell 2.0 from accessing UNC paths

This is just crazy, I am starting on PowerShell. And of course I need to do Admin work remotely. A simple dir \\server\share\folder Just refuses to work, I get this error Get-ChildItem : Cannot ...
3
votes
2answers
3k views

How can I get PowerShell Added-Types to use Added Types

I'm working on a PoSh project that generates CSharp code, and then Add-Types it into memory. The new types use existing types in an on disk DLL, which is loaded via Add-Type. All is well and good ...
27
votes
5answers
27k views

What can I do with C# and Powershell?

I have a decent understanding of C# and a very basic understanding of powershell. I'm using Windows PowerShell CTP 3, which has been really fun. But I want to go beyond writing scripts/functions. Is ...
7
votes
1answer
5k views

PowerShell - How to Import-Module in a Runspace

I am trying to create a cmdlet in C#. The code looks something like this: [Cmdlet(VerbsCommon.Get, "HeapSummary")] public class Get_HeapSummary : Cmdlet { protected override void ProcessRecord() ...
16
votes
5answers
7k views

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 file, that way, my script can always find other scripts in the library. So, what is the ...
8
votes
2answers
4k views

How to speed up Powershell Get-Childitem over UNC

DIR or GCI is slow in Powershell, but fast in CMD. Is there any way to speed this up? In CMD.exe, after a sub-second delay, this responds as fast as the CMD window can keep up dir ...
11
votes
5answers
6k views

Unblock a file with PowerShell?

I am trying to have PowerShell unblock a file in Win2K8 R2. Does anyone have a pointer as to the syntax?
5
votes
1answer
2k views

powershell 2.0 redirection file handle exception

I'm looking for a solution to the The OS handle's position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 code or another FileStream. exception that ...
4
votes
2answers
6k views

Redirection of standard and error output appending to the same log-file

I need to collect the standard output and error log from several processes into one single logfile. So every output must append to this logfile. I want to call all the jobs with lines like this: ...
4
votes
3answers
12k views

How to retrieve a recursive directory and file list from powershell excluding some files and folders?

I want to write a powershell script that will recursively search a directory, but exclude specified files (e.g. *.log, myFile.txt), and also exclude specified directories, and their contents (e.g. ...
3
votes
2answers
3k views

Comparing array variables in PowerShell

I have this script to compare two folders. $firstfolder = Get-ChildItem C:\firstfolder $secondfolder = Get-ChildItem C:\firstfolder if ($firstfolder -eq $secondfolder) { Write-Host "Folders are the ...
2
votes
1answer
273 views

Powershell: Installing Modules on Target System

When I do this - PS C:\> $env:psmodulePath.split(";") I get two folders - i.e. User Module Folder and System Module Folder. User Module Folder ...
7
votes
3answers
6k views

Using Invoke-Command -ScriptBlock on a function with arguments

I'm writing a PowerShell script that will execute commands on a remote host using Invoke-Command and its -ScriptBlock parameter. E.g., function Foo { ... return "foo" } $rv = Invoke-Command ...
2
votes
3answers
8k views

How to execute powershell commands from a batch file?

I have a PowerShell script to add a website to a Trusted Sites in Internet Explorer: set-location "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" set-location ZoneMap\Domains ...
1
vote
2answers
457 views

How can I t4 scaffold from powershell.exe?

NuGet's PM console is great and all but you have to be in Visual Studio to use it. I have asked this question before without any ansewr and I find it hard to believe there is no documentation on the ...

1 2 3 4 5 7
15 30 50 per page