For someone who has been using bash for years, what's the quickest way to get productive with Microsoft's PowerShell? I've noticed my old friends ls and ps work, but sadly grep didn't. I could just man up and read through the piles of documentation, but I'm guessing there is a quicker path to productivity for someone with a long histor...
I'd like to do something like this:
if (Ping-Host server1) { blah }
Anyone know of a simple way?
...
What is the best way to convert a List to a Hashtable.
Say I have a list like
("Key",$value,"Key2",$value2)
What is the shortest syntax to convert it into a Hashtable?
...
I often want to process a file resulting in a modified output file. I can't seem to find the PowerShell way to do this - it always ends up looking like code in a one-liner, IYSWIM. This is an example.
I have an LMHOSTS file. Don't ask why! I want to get a new LMHOSTS file that only contains servers that respond to pings. I also wan...
I need to use PerfMon to collect data from several machines, and I need to be able to turn collection on/off at certain times. I've got all the data points configured on each machine; I just need to start/stop PerfMon, and to start/stop collection of a set of data points.
For reasons I won't go into, I can't simply configure all collec...
Hi,
I would like to store a variable to disk or registry so I can use it the next time I run the scheduled script? Preferably an one-liner or two...
Cheers,
Roy
...
After looking around (for not terribly long I have to admit) I wonder if anyone can point me to a Powershell script that checks if 'IIS Management Scripts and Tools' is enabled and if its not then it enables it like you would from Add Windows features.
I checked poshcode.org and powershell.com and couldnt find one
I never touched Power...
I am trying to open a SQL data connection using powershell script and my password contains a $ sign:
$cn = new-object system.data.SqlClient.SqlConnection("Data Source=DBNAME;Initial Catalog=Catagory;User ID=User;Password=pass$word;")
When I try to open a connection it says Login failed.
...
I am trying to have PowerShell unblock a file in Win2K8 R2.
Does anyone have a pointer as to syntax?
Thanks in advance,
Dan
...
Hi,
Does anybody know or have a link to how I set up psake to run through powershell?
I have absolutely no idea and I can find nothing to tell me.
Cheers
Paul
...
I have tried to call "Get-Credential" CMDlet without luck. Reading Powershell SDK i find the abstract method "PSHostUserInterface.PromptForCredential Method (String, String, String, String) ". is there any object whitch implement this method?
Any other solution?
Regards
Hans-Arne sandem
...
Is there some svn or svnadmin command that will display the revision of a local repo? I'd like to be able to have a Windows batch or PowerShell script that would let me zip up the repo and name it with the rev to email.
The best I can figure out is just to find the highest file in [reporoot]\db\revs\0, but it seems kind of clunky and I...
When writing Powershell cmdlets, what is the difference between EndProcessing and StopProcessing? They sound the same, their descriptions are just about the same, and latter doesn't appear in the cmdlet lifecycle documentation.
...
I would like to retrieve the contents of a file, filter and modify them and write the result back to a file. I do this:
PS C:\code> "test1" >> test.txt
PS C:\code> "test2" >> test.txt
PS C:\code> $testContents = Get-Content test.txt
PS C:\code> $newTestContents = $testContents | Select-Object {"abc -" + $_}
PS C:\code> $newTestContents...
I would like to execute a stored procedure from Powershell (v2) against a SQL Server 2008 database. Coming from using C# as my primary language, I'm doing it in that fashion. For example, when I need to run a sproc that doesn't return results, here is what I'm doing now:
$con = new-object System.Data.SqlClient.SqlConnection($connectionS...
Using Powershell 1.0 under Windows Server 2003 with IIS 6.
I have about 200 sites that I would like to change the IP address for (as listed in the website properties on the "website" tab in the "Web site identification" section "IP address" field.
I found this code:
$site = [adsi]"IIS://localhost/w3svc/$siteid"
$site.ServerBindings.In...
My team and I are designing a diagnostic test tool as part of our next product. The test tool will exercise a request/response API and display asynchronous events. As part of the diagnostic tool suite, we will also be providing cmdlets for the entire product API.
Is it worth embedding PowerShell execution into the tool UI ? What are ...
I have the following code in C# which I try to port to PowerShell.
But I don't know how to port this cast:
((_ISkypeEvents_Event)skype).CallStatus += CallStatusHandler;
If I just type [Skype4COM.ISkypeEvents_Event] in my PowerShell console I get:
Unable to find type [Skype4COM.ISkypeEvents_Event]: make sure that the assembly conta...
I run the following code using powershell to get a list of add/remove programs from the registry:
gci -path hklm:\software\microsoft\windows\currentversion\uninstall | ForEach-Object -Process { write-output $_.GetValue("DisplayName") } | out-file addrem.txt
I want the list to be separated by newlines per each program. I've tried:
gci...
I've create a basic C# class that implements Microsoft.Data.Schema.ScriptDom and Microsoft.Data.Schema.ScriptDom.Sql interface. These two assemblies are part of Visual Studio Database Edition (VSDB) and are the parsing/scripting API's. You can parse SQL text and output a format SQL script. For more information about VSDB assemblies, see ...