Hello! There's already question addressing my issue (http://stackoverflow.com/questions/563600/can-i-get-to-work-in-powershell), but with one difference. I need an OUTPUT from both commands. See, if I just run:
(command1 -arg1 -arg2) -and (command2 -arg1)
I won't see any output, but stderr messages. And, as expected, just typing:
com...
Scenario is:
Given the following files
c:\dev\deploy\file1.txt
c:\dev\deploy\file2.txt
c:\dev\deploy\file3.txt
c:\dev\deploy\lib\do1.dll
c:\dev\deploy\lib\do2.dll
e.g. if $pwd is the following
c:\dev\deploy
running the statement
$files = get-childitem
I want to take this list and using << foreach ($file in $files) >> I want to subs...
I want to delete all the content and the children of a given root folder, however i want to keep some files (the logs), which all reside in a logs folder
What is the elegant way of doing this in powershell.
Currently i am doing it in multile steps, surely this can be done easily... i have a feeling my oo-ness/language bias is getting in ...
Hi,
I'm using the app pool and virtual directory created here
and I'm trying to figure out how to set the recycle worker processes in minutes for the app pool and for the virtual directory I'm trying to change the execute permissions to scripts and executables, adding the same username and password permissions for the virtual directory ...
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...
I'm very new to COM and Windows programming/scripting in general. What I was trying to do is scripting Windows Live Writer; according to the documentation before I can call
$o = New-Object -c WindowsLiveWriter.Application
I need to load the TLB first, so I should call the add-type command, unfortunately it fails:
PS C:\Users\NoWher...
I have this code in PowerShell, that executes SQL query for UPDATE table:
$Connection=new-object data.sqlclient.sqlconnection "server=server;database=mydb;trusted_connection=true;"
$Connection.open()
For( $i = 0; $i -le $ActID.Length; $i ++ ){
$cmd = New-Object System.Data.SqlClient.SqlCommand
$cmd.Connection = $Connection
$cmd.Comma...
Hi,
If I write a class library in Visual Studio, is it possible to write a console application or powershell script which can call the methods or set/get the properties?
This is useful for testing APIs without having to create a form with loads of buttons etc.
I actually meant my executing my own class libraries. So if I write a class...
With custom Powershell functions all function output is returned. I'm attempting to remove that limitation/confusion by writing a wrapper function that will return just $true or $false.
However, I'm struggling with the dynamic function call . . . specifically passing the arguments.
Note that both the function name and the function...
I have a POSH script that sets a user's access to a specific folder for some files to read.
The user's group gets assigned to the folder (which happens to be the same name).
I then created a new view, set it to default, and told it to display all files without folders.
This script has been working perfectly for 4 months but now some p...
Test script:
function outer
{
[cmdletbinding(supportsshouldprocess=$true)]
param($s)
process
{
$pscmdlet.shouldprocess("outer $s", "ShouldProcess") | out-null
"" | out-file "outer $s"
inner ImplicitPassthru
inner VerbosePassthru -Verbose:$Verbose
inner WhatifPassthru -Wh...
Hi.
If I have:
Write-Host "[$(Get-Date -displayhint time)] backup starting..."
I get:
[02/17/2010 1:26:12pm] backup starting...
i. e. the Get-Date parameters are being ignored and is just returning the output of Get-Date.
What's the best way to do inject the current time in the middle of a string?
thanks
...
Some time ago I've started with PowerShell that is really great. I can code almost everyting I know, I can use .NET framework, WMI, even WIN API. Features like piping help me a lot to write manageable and readable code. V2 added advanced functions, modules, background jobs, remoting (woow) etc.
As I said, I can do almost everything with...
I'd liketo use Powershell to post a new action to my Vitalist.com account.
The Vitalist API documentation is here.
I've tried HttpWebResponse in Powershell but I'm missing something. Any pointers are appreciated.
Thanks.
...
I'd like to provide a queuepath and get the number of messages thereupon. Any advice on how this could be done?
...
I have created some custom PowerShell Cmdlets in C# and would like to provide some information to be displayed using the get-help cmdlet; e.g. "get-help my-cmdlet".
I have created a basic snapin deriving from PSSnapIn and overridden the Description, Name and Vendor properties. I have also created my help file "Cmdlets.dll-Help.xml". C...
This seems like a very basic thing to do, but I am new to Powershell and can't figure this out or find an example online...
I am trying to filter a list of strings. This list of strings is the result of a "svn list" command (subversion list of repository files), like:
svn list -R PATHTOREPOSITORY
I have tried
svn list -R PATHTOREPOS...
I have an ODBC connection set up on my Windows 2008 Server, and I'm trying to replace some .BAT files that do some processing with Powershell files.
Is there a way to do the same thing as this in PowerShell?
CALL osql /instanceName /Uuser /Ppassword /Q"EXECUTE storedProcName @Parm1= %ePROFILE%, @param2 = N'%eValList%'
...
I wish to have an automated process that basically deploys (copies) a asp.net web site in a CI situation. I have built the web site and I then want to copy the code to the web server. This powershell code is running on my build server. the build server is running under a defined service account and i have given that account full control ...
I am trying to call a script that gives data as a parameter for another script.
ex.
scriptA.ps1 -parameter1 (scriptB.ps1 -data 'testOne')
I just put () because I thought that would work but can't seem to get it to work. Any ideas? I have tried $() and "" to no avail.
Thanks.
...