The below script makes use of a webservice hosted by webserviceX.net and provides stock quote information.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
<# .Synopsis Retrieve stock information .DESCRIPTION Retrieve stock information .PARAMETER Symbol Stock symbol of one or more companies .EXAMPLE Get-StockInfo -Symbol MSFT,INTC .LINK .NOTES Version 1.0, by Alex Verboon #> [CmdletBinding()] Param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, HelpMessage= 'Stock Symbol for the company')] [String[]]$Symbol ) begin{} process{ if ([string]::IsNullOrEmpty($Symbol)) {Write-Output "You must provide a Symbol" Exit} ForEach ($stock in $Symbol) { [xml][/xml]$sq = Invoke-WebRequest -uri http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=$stock $sqdetail = [xml][/xml]$sq.DocumentElement.'#text' $sqdetail.StockQuotes.stocK } } End{} |