Is there an easy way to verify all files were copied correctly when calling copy-item? I thought about using the checksum on all files, but I would imagine powershell (v2) would already have something, and I can't find it.
...
Hi Folks,
I am writing a powershell script that will act as a build compliance test for our servers. One of the things I need to do is detect if IPv6 networking has been disabled.
WMI indicates that this information can be found in the IPAddress Property of Win32_NetworkAdapterConfiguration but can be both IPv6 or IPv4. This does not g...
How could I make a List in PowerShell 2?
I've tried these:
[activator]::createinstance(([type]'system.collections.generic.list`1').makegenerictype([string]))
and
[activator]::createinstance(([type]'system.collections.generic.list`1').makegenerictype([string]))
and all I get is just nothing. What's going wrong?
I'm running XP SP3,...
Hi,
I need to retrieve the details of all deployed SharePoint solutions, as are displayed in the Central Administration > Operations > Solution Management (AKA the Solution Store), using a PowerShell script (v2.0). Can anyone offer any guidance on how to retrieve this information from the SharePoint solution store via the SharePoint AP...
Hi,
This might sound silly but I have been trying to execute a NUnit test using powershell script, had several attempts but no hope. is there different format or do I need to add a plugin?
Any help would be appriciated...
Command = "c:\Program Files\NUnit 2.4.8\bin\nunit-console.exe" /config=Release "C:\projects\IntegrationTests\In...
filter CountFilter($StartAt = 0)
{
Write-Output ($StartAt++)
}
function CountFunction
{
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline=$true, Mandatory=$true)]
$InputObject,
[Parameter(Position=0)]
$StartAt = 0
)
process
{
Write-Output ($StartAt++)
}
}
$...
Say I've got two cmdlets, 'new-foo' and 'do-bar'. Both cmdlets need to authenticate to a service in order to perform their action, and 'do-bar' takes a foo. Today, I can do:
new-foo -host localhost -username user -password password -whateverOtherArgs
And I can do:
do-bar -host localhost -username user -password password -foo myFoo
...
Is it possible to register a new PowerShell module just by defining a new module manifest and putting it in the specified directory?
E.g. a a new module named SampleModule should be created. I put the empty manifest file SampleModule.psd1 in the directory <%PSModulePath%>\SampleModule. (It doesn't matter which (user or global) module pa...
Hi,
I regularly have to convert an existing C# code snippet/.CS file to a PowerShell script. Can anyone offer any tools or methods that would allow some automation of this?
Note, while I am aware that there are methods that can convert a .cs file to a cmdlet, I'm only interested in converting the C# code to a script or module.
Than...
Hi,
I came across a request on LinkedIn for a PowerShell script that was required to:
Retrieve all users from the given SharePoint site-collection
For each user, the script must retrieve the properties are common between "User Profile" and "User Information List"
If any of the common fields between the two are different, the user name...
Is there a direct link to download Windows PowerShell v2 (2.0) RTM?
Google's first page of search results isn't helping, and I don't want to download the entire Windows Management Framework.
...
I am making my first attempts at using PowerShell remoting features. I've set up the "destination" server using the instructions in the help docs. But when I attempt to start a remote session (by executing an "Enter-PSSession servername1" command), it sits there for a long time, and eventually gives this error:
Enter-PSSession : Conne...
Here's a sample script that attempts to create a remote session on a server, then use WMI to get a list of the server's IIS application pools, and list their names:
function Test-Remoting
{
[CmdletBinding()]
param
(
)
begin
{
Enter-PSSession TestServer
$...
I am trying to replace a sentence in .config file using powershell.
${c:Web.config} = ${c:Web.config} -replace
'$BASE_PATH$\Test\bin`$Test_TYPE`$\WebTest.dll' , 'c:\program Files\example\webtest.dll'
Everytime I try to run the above code I get
"Invalid regular expression pattern:
$BASE_PATH$\Test\bin\$Test_TYPE$\WebTest.dll"
...
Is there a way to specify a working directory to the Start-Job command?
Use-case:
I'm in a directory, and I want to open a file using Emacs for editing. If I do this directly, it will block PowerShell until I close Emacs. But using Start-Job attempts to run Emacs from my home directory, thus having Emacs open a new file instead of the ...
#loan calculator...just messing around for practice
cls
$choice = 0
while ($choice -ne 1){
[string]$name = read-host "Enter name"
[double]$amount = read-host "Enter loan amount"
[double]$apr = $(0.01 * (read-host "Enter APR"))
[int]$term = read-host "Enter term in months"
$rate = $apr/12
$mr = $rate * [math]::...
I am having trouble accessing a shared network location while within a PowerShell remote session.
From the PowerShell prompt, I enter a new session:
Enter-PSSession server1
The session is properly created and entered. I then attempt to list the contents of the share:
dir \\server2\share1
The response is this error:
Get-ChildItem ...
I'm trying to run a PowerShell script from a C# application and I need the script to run when my C# app is running as a non-admin user (e.g. Network Service or some other domain account).
Previously, I was using the following code:
using (RunspaceInvoke invoker = new RunspaceInvoke())
{
// load the powershell module
invoker.Inv...
Register-ObjectEvent looks for a object instance in the required parameter InputObject. What is the syntax for an object's static (Shared) event?
UPDATE: Correct syntax for TimeChanged:
$systemEvents = [Microsoft.Win32.SystemEvents]
$timeChanged = Register-ObjectEvent -InputObject $systemEvents
-EventName 'TimeChanged' -Action { Write-...
I need to know how many replacements are made by Powershell when using either the -replace operator or Replace() method. Or, if that's not possible, if it made any replacements at all.
For example, in Perl, because the substitution operation returns the number of replacements made, and zero is false while non-zero is true in a boolean ...