I want to display the content of an RTF file in a Powershell RichTextBox.
I am trying to make a kind of custom EULA, and the easiest way to do it would be to write the content in an RTF file and then have it display in a RichTextBox on my form, so the user has to click a checkbox to accept it.
(I'm sure this sits between ServerFault an...
I have an assembly that contains cmdlets. Can Powershell enumerate the cmdlets available in that assembly, without relying on reflection?
It seems that I should be able to do this with Get-Module, which returns a PSModuleInfo object that has an ExportedCmdlets property, but I can't seem to get results from it with my assembly, though I...
I'm writing a script to take a string of letters and convert them to phonetic values. The problem I'm having is that I am unable to reference a value in a hashtable (see error below). I'm not sure why as the code looks fine to me.
Index operation failed; the array index evaluated to null.
At C:\Scripts\test.ps1:8 char:23
+ write-hos...
Can PowerShell on Windows by itself or using simple shell script, list files and directory this way: (or using Mac OS X or Ubuntu's shell script)
audio
mp3
song1.mp3
some other song.mp3
audio books
7 habits.mp3
video
samples
up.mov
cars.mov
Unix's ls -R or ls -lR can't seem to list it in a tree structure unf...
I have a main script that is calling on several others scripts and I need to load the variables from the other scripts into the main script so that I can dump them into a html file. I tried dot sourcing the scripts I am calling on but that did not work or I am doing something wrong. Any help would be appreciated.
Example section of sc...
Hi,
In an Excel worksheet, I have a range name "LOOPBACK_IP".
I want to programmatically find the starting row of this range name.
With Powershell, if I want to find the value of this range, I use (after assigning $ws variable a worksheet):
write-host $ws.Range("LOOPBACK_IP").Value2
But to find the location (i.e. row, column) of a r...
Let's say I have the string "blah blah F12 blah blah F32 blah blah blah" and I want to match the F12 and F32, how would I go about capturing both to the Powershell magic variable $matches?
If I run the following code in Powershell:
$string = "blah blah F12 blah blah F32 blah blah blah"
$string -match "F\d\d"
The $matches variable onl...
I have some signed .ps1 script, I need to verify they are properly signed from a C# project, is there any algorithm or library to do this?
Thanks!
...
Hi All,
I'm a powershell newbie, but I often find myself starting and stopping a small group of services when I'm debugging some code. In Powershell I can easily stop the processes using a wildcard but it makes me confirm. There is a -confirm parameter, but I must not be using it correctly?
`Stop-Process -ProcessName alcore.* -Confirm`
...
Imagine I have a directory structure like so:
parentDir\dirA\foo\
parentDir\dirB\foo\
parentDir\dirC\
parentDir\dirD\bar\foo\
parentDir\dirE\foo\
parentDir\dirF\
I want to select only the directories that a) are immediate children of parentDir, and b) have a foo directory as an immediate child.
So dirs A, B, and E qualify, whilst C, ...
Hi All,
I'm pretty new to Powershell. I have 2 different scripts I'm running that I would like to combine into one script.
Script 1 has 1 line
Stop-Process -ProcessName alcore.* -force
It's purpose is to end any process that begines with "alcore."
Script 2 has 1 line as well
Start-Service -displayname crk*
It starts any service ...
I need to grant a specific account SERVICE_START permissions for a given Windows service.
There seems to be some methods for doing so here, but would prefer a method that's native to PowerShell and doesn't require external tools, for ex. by using Get/Set-ACL cmdlets, or calling some .NET API.
Does someone know how to do it in that fash...
I have a several scripts that are using PowerCLI to pull info from all of our virtual center servers and dumping into an HMTL file. At this time I have one script setup for each virtual center server, howerver I want to modify it so that I have one main script that will loop through each virtual center and create a HTML for each one inst...
Hi everyone,
can anybody tell me where I could possibly find the PowerShell snap-ins for Microsoft Exchange 2010.
Of course I could just install Exchange 2010 management tools on my machine but I'd rather not for the sake of a smaller footprint etc. ;-)
Regards,
Kevin
...
I'm trying to write a cmdlet that accesses one of my wcf webservices.
I've been looking at the new cmdlet : New-WebServiceProxy, but it only really seems capable of consuming ASMX webservices.
I've seen this article; which is focussed around Powershell v1.0
I'd rather use a better method (if one exists).
http://keithhill.spaces.live.co...
I am converting an old cmd command to Powershell, and currently use:
START "My Title" Path/To/ConsoleApp.exe
This works as expected to launch ConsoleApp with My Title as it's window title. This has been replaced with Start-Process which works correctly, but does not provide a mechanism to change the title.
Is there another way to do ...
I have lots of text output from a tool that I want to parse in Powershell 2.0. The output is nicely formatted so I can construct a regex to pull out the data I want using select-string. However getting the subsequent matches out of select-string seems long-winded. There has to be a shorter way?
This works:
p4 users | select-string "...
Hi everyone,
I'm trying to create simple reports on Exchange 2010 mailbox size.
While this works:
Get-MailboxStatistics -server <serverfqdn> |ft displayname, TotalItemSize
this doesn't (second column stays empty):
Get-MailboxStatistics -server <serverfqdn> |ft displayname, {$_.TotalItemSize.Value.ToBytes()}
The problem is that ...
The following script spits out all UserProfile properties for users on Sharepoint 2007:
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.UserProfiles")
# Function: Get-UserProfiles
# Description: return a Use...
Hi,
I would like to create an advancedmodule with a cmdlet function which performs some logic and adds some pssnapins. This is the code:
function Add-DefaultSnapIns
{
[CmdletBinding()]
param()
begin {}
process{
# ...
Add-PsSnapIn SnapInName
}
end {}
}
export-module -function Add-DefaultSnapIns
If I invoke the function from an...