Hi,
I am running the following command.
([xml](new-object net.webclient).DownloadString(
"http://blogs.msdn.com/powershell/rss.aspx"
)).rss.channel.item | format-table title,link
The answer shows me that one rss items has the text "You Don’t Have to Be An Administrator to Run Remote PowerShell Commands"
So, the question is; why the...
I've been looking for a way to terminate a Powershell (PS1) script when an unrecoverable error occurs within a function. For example:
function foo() {
# Do stuff that causes an error
$host.Exit()
}
Of course there's no such thing as $host.Exit(). There is $host.SetShouldExit() but this actually closes the console window, which...
I'd like to send a chipcard command (an APDU) to a chipcard and read the response from the chipcard.
Because there should be no extra install on the windows system, I'd like to do it within windows powershell.
Is there an easy way to do this?
...
I'd like to access a web service with a given (simple) WSDL from within windows powershell.
Is there an easy way to do this?
...
Is there any recommended coding style how to write PowerShell scripts? It's not about how to structure the code (how many functions, if to use module, ...). It's about 'how to write the code so that it is readable'.
In programming languages there are some recommended coding styles (what to indent, how to indent - spaces/tabs, where to ...
How can one create an object that when its operators, such as:
operator > (Object obj1, Object obj2)
operator < (Object obj1, Object obj2)
, are overridden PowerShell utilizes these operators?
Such that:
where-object { $CustomObject -gt 12 }
would call:
public static bool operator > (Object object1, Object object2)
Is it pos...
Guys and Gals, a really stupid question:
How do I run a PowerShell script?
I have a script named myscript.ps1
I have all the necessary frameworks installed
I set that execution policy thing
I have followed the instructions on this MSDN help page
and am trying to run it like so:
powershell.exe 'C:\my_path\yada_yada\run_import_script.ps...
I am running a PowerShell script from within a batch file. The script fetches a web page and checks whether the page's content is the string "OK".
The PowerShell script returns an error level to the batch script.
The batch script is executed by ScriptFTP, an FTP automation program. If an error occurs, I can have ScriptFTP send the full...
I have a PowerShell script that connects to a web site, and parses its returned data (It's about importing a previously uploaded SQL file into the web site's data base). The PowerShell script uses wget, something I may replace by a native function later.
The import process is embedded in a script that is executed by a 3rd party program ...
I am using PowerShell to run a script that executes wget to fetch a web page (a simple database import script) and analyzes its output (Error message or "OK").
I am using code from the answer to this previous question of mine.
$a = c:\path_to_wget\wget.exe --quiet -O - "http://www.example.com/import_db"
$rc = $a.CompareTo("OK")
exit $r...
I'm running a Windows Service (Hudson) which in turn spawns a PowerShell process to run my custom PowerShell commands. Part of my script is to unzip a file using CopyHere. When I run this script locally, I see a progress dialog pop up as the files are extracted and copied. However, when this runs under the service, it hands at the poi...
Have a very simple powershell script to count the number of trades in a file:
(gc \mimkeimc11n\Batch\FundQuest\TradeFiles\trades.dat |? {$_ -match 'SL|BY'} | Measure-Object | select count).count > \mimkeimc11n\Batch\FundQuest\ConfirmtoFQ\NumberofTrades.txt
The problem I am running into is the output NumberofTrades.txt is including the ...
I want to call a perl script from powershell where a parameter is quoted:
myProg -root="my path with spaces"
I've tried to use -root='"my path with spaces"', -root='my path with spaces', -root=\"my path with spaces\", but nothing seems to work. After pressing <ENTER>, I see >> as a prompt.
How do I pass this quoted argument on the co...
Hi, i am playing with Powershell and SQL WMI events and i am wondering if i can do this stuff remotely from the admin notebook:
I'd like to query the "root\Microsoft\SqlServer\ServerEvents\MSSQLSERVER" namespace:
On SQLServer directly:
get-wmiobject -list -namespace "root\Microsoft\SqlServer" >> Works!
get-wmiobject -list -namespac...
I am trying to show a message box from PowerShell with yes and no buttons.
I can display a message box with an OK button:
[system.windows.forms.messagebox]::show("Hello, world!")
And I can create a variable $buttons with the buttons I want:
$buttons=[system.windows.forms.messageboxbuttons].yesno
And I can see that the Show() stati...
I have some PowerShell scripts that accept many long parameters, like,
myScript.ps1 -completePathToFile "C:\...\...\...\file.txt" -completePathForOutput "C:\...\...\...\output.log" -recipients ("[email protected]") -etc.
I can't seem to make PowerShell run such scripts unless all the parameters are on a single line. Is there a way to invoke ...
This is a duplicate of http://serverfault.com/questions/102098/powershell-script-showing-commands-run. I thought it would be more appropriate to ask this question here.
I am playing around with PowerShell scripts and they're working great. However, I am wondering if there is any way to also show all the commands that were run, just as ...
We have a powershell build script that calls out to other scripts that is giving me trouble under Windows 7 64 bit. It works fine under XP. I've run set-executionpolicy to RemoteSigned (and also tried it with Bypass and Unrestricted). I can pull the command line from the error message and run it myself and it all runs fine.
Build err...
I have following code to send files to a FTP server.
function FtpUploader(
[string]$uri,
[string]$localeFile,
[string]$user = "ftp",
[string]$password = "ftp",
[int] $timeout = 20000
){
trap {
Write-Host ("ERROR: " + $_) -Foregroundcolor Red
return $false
}
$ftp = [System.Net.FtpWebRequ...
I run a Powershell script on a computer that has no Internet connection. But it takes about 30 seconds to start it. How do I solve it?
I have run ngen.
...