I have a powershell 1.0 script to just open a bunch of applications. The first is a virtual machine and the others are development applications. I want the virtual machine to finish booting before the rest of the applications are opened.
In bash I could just say "cmd1 && cmd2".
This is what i've got...
C:\Applications\VirtualBox\vbox...
How do I creat AppPool and virtual directory on a remote server using Powershell on iis6
...
Hi,
I tried it works fine for the asmx (simple web services) but for WCf do we need to do some thing different.
Can the Same work for the WCF services as i get the error for the WCF service also.
i just created the Simple WCF service in .net and tried to access. but was not successful.
Error:
$Url = "http://localhost:4637/WCFService2/...
I'll write a script that runs a program and wait for it finished. But if the program is not finished within a specified time I want that the program is killed.
...
I have the following line of code to create object to access to a remote server before I associate it with user name, password and process:
$process = [WMIClass]"\\remoteServer\ROOT\cimv2:Win32_Process"
I tried this on two PCs, one is OK without any errors, but another one I am going to run has an exception:
Cannot convert value "\\...
What is the simplest way to forcefully delete a directory and all its subdirectories in PowerShell? I am using PowerShell V2 in Windows 7.
I have learned from several sources that the most obvious command, Remove-Item $targetDir -Recurse -Force, does not work correctly. This includes a statement in the PowerShell V2 online help (found u...
Hi,
I'm having problems figuring out what is the Powershell string for choosing the "Enforce access checks for this application" under the Security tab of the properties for that application. Here is what I have so far for Powershell in choosing other things:
$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog
$apps = $comAdmin...
My goal is to assign the value of the results returned to a variable:
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server=HOME\SQLEXPRESS;Database=master;Integrated Security=True"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = "select name from sysdata...
I use PowerGUI to edit my script. In Visual Studio, I can add command line argument from project properties. However, I cannot find a way to set parameters to the UI to debug my codes with specified $args.
For example, I set one debug point in PowerGUI, first line of my start code. Then I try to start my script from UI's panel "PowerShe...
I am new to PS. Here is an example of my function codes:
function foo()
{
# get a list of files matched pattern and timestamp
$fs = Get-Item -Path "C:\Temp\*.txt" | Where-Object {$_.lastwritetime -gt "11/01/2009"}
if ( $fs -ne $null ) # $fs may be empty, check it first
{
foreach ($o in $fs)
{
# new ...
SCENARIO
I'm writing a cmdlet for Powershell 2.0 using Visual Studio 2008 and .NET 3.5
the cmdlet requires 3 arguments.
my intended grammar of the cmdlet is something like this:
cmdletname [foo|bar] p1, p2
That reads as the user must give a value for "-foo" or "-bar" but can't give both together.
EXAMPLE OF VALID INPUT
cmdle...
Is there a way to capture STDOUT information from an executable within powershell, without affecting the default behaviour of the STDOUT process? Whenever I attempt to capture output from an executable within PowerShell, it appears that the STDOUT is then formatted before being returned to the host/screen. Further, it also appears that...
I have a powershell script that is replacing patterns in a file with the argument passed to the script. I grabbed the algorithm from another site and it works great, except for the fact that when I use anything but a literal string, the pattern isn't replaced.
Here's the original script:
(Get-Content c:\File.txt) |
Foreach-Obje...
I would like to find a replacement for list.com, specifically the ability to accept piped input. For example:
p4 sync -n | list
which accepts the output of the perforce command and displays the results in the viewer/editor for manipulation or saving. I know that I would send the output to a file and then open the file in the viewer/ed...
I would like to set the following alias up in my powershell profile:
set-alias mem-users get-process | ? {($_.PM -gt 10000000) -or ($_.VM -gt 10000000)} | sort -property PM
But when I try this out and call mem-users I just get the results of get-process. How would I set this up? Do I have to write a custom function? The examples fo...
First, a disclaimer. I'm not a CS grad nor a math major, so simplicity is important.
I have a four-character string (e.g. "isoy") that I need to pass as a single 32-bit integer field. Of course at the other end, I need to decode it back to a string. The string will only contain A-Z, and case is not important, if that helps.
The funny ...
What's the best way of concatenating binary files using Powershell?
I'd prefer a one-liner that simple to remember and fast to execute.
The best I've come up with is:
gc -Encoding Byte -Path ".\File1.bin",".\File2.bin" | sc -Encoding Byte new.bin
This seems to work ok, but is terribly slow with large files.
...
Given a list of items in powershell, how do I find the index of the current item from within a loop?
For example:
$letters = { 'A', 'B', 'C' }
$letters | % {
# Can I easily get the index of $_ here?
}
The goal of all of this is that I want to output a collection using Format-Table and add an initial column with the index of the cu...
I have installed PS 1.0 on a remote PC(RPC001). I used Windows Sysinternals
tool PSExec.exe to execute the following process on the remote:
PSExec \\RPC001 -u myID -p myPWD PowerShell C:\script\StartPS.ps1 par1 par2
I can see the PowerShell.exe process running on the remote PC afterwards, but it is actually doing nothing, just hangin...
This Powershell script:
Copy-Item $src_dir $dst_dir$agent_folder -recurse
works if the resources are not there. But if the resources are there, it will say:
+ Copy-Item <<<< $src_dir $dst_dir$agent_folder -recurse
+ CategoryInfo : ResourceExists: (C:\Users\Pac\Desktop\Agents\Agent0\lib:S
tring) [Copy-Item], IOEx...