<?xml version="1.0" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/">

	<channel>
		<title>PowerShellCommunity.org General PowerShell</title>
		<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/afv/topicsview/Default.aspx</link>
		<description>General discussions on using Windows PowerShell</description>
		<language>en-US</language>
		<generator>ActiveForums  4.0</generator>
		<copyright>Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008</copyright>
		<lastBuildDate>Thu, 29 Jul 2010 08:57:51 GMT</lastBuildDate><image><url>http://powershellcommunity.org/Portals/0/community-logo.png</url><title>PowerShellCommunity.org General PowerShell</title><link>http://powershellcommunity.org/Forums/tabid/54/aff/1/afv/topicsview/Default.aspx</link></image>
		<item>
			<title>Posting Guideilnes</title>
			<description>&lt;p&gt;When posting code, click on the Source button in the editor, then enclose your code in &lt; code &gt; and &lt; / code &gt; HTML tags, omitting the spaces between the angle brackets as I did here to bypass the parser.  Sorry for the additional step required.  This is the best we can do for now.  Hopefully we can improve this in the future.&lt;/p&gt;

&lt;code&gt;
ps | foreach-object {
  # do something
}&lt;/code&gt;</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/1406/afv/topic/Default.aspx</link>
			<dc:creator>halr9000</dc:creator>
			<pubDate>Tue, 25 Mar 2008 00:01:42 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/1406/afv/topic/Default.aspx</guid>
			<slash:comments>1</slash:comments>
		</item>
		<item>
			<title>&quot;get-qaduser -tsprofilepath *servername&quot; not working</title>
			<description>I'm trying to get all the AD users whose TS profilepath match a certain server but using the above command doesn't work, works fine for just profilepath or homedirectory but doesn't seem to work for either tsprofilepath or tshomedirectory, any ideas would be greatly appreciated&lt;br&gt;</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5453/afv/topic/Default.aspx</link>
			<dc:creator>Khabel</dc:creator>
			<pubDate>Thu, 29 Jul 2010 08:57:51 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5453/afv/topic/Default.aspx</guid>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>Deleting old file and folders with remove-item -recurse option</title>
			<description>I have the following script to delete the old files/folders on a share. I need to keep files that were created earlier than 30 days.$LastWrite seems to look at Date Created, and not Date Modified.&lt;BR&gt;&lt;BR&gt;Problem is &lt;STRONG&gt;whenever there are folders that where created 30 days ago, script deletes them, even though there may be new folders/files inside those old folders&lt;/STRONG&gt;&lt;BR&gt;&lt;BR&gt;Function RemoveOldFile &lt;BR&gt;{ &lt;BR&gt;$TargetFolder = &lt;A href=&quot;file://\\MyUNCpath&quot;&gt;\\MyUNCpath&lt;/A&gt; &quot;&lt;BR&gt;&lt;BR&gt;$days = 30 if (Test-Path $TargetFolder) &lt;BR&gt;{ $Now = Get-Date &lt;BR&gt;$LastWrite = $Now.AddDays(-$days) Get-ChildItem $Targetfolder |Where {$_.LastWriteTime -le &quot;$LastWrite&quot;}|remove-item -recurse }&lt;BR&gt;&#160;Else &lt;BR&gt;{Write-Host &quot;The Folder $TargetFolder Does Not Exist!&quot;} &lt;BR&gt;} RemoveOldFile</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5422/afv/topic/Default.aspx</link>
			<dc:creator>BikeBoy</dc:creator>
			<pubDate>Wed, 21 Jul 2010 23:30:51 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5422/afv/topic/Default.aspx</guid>
			<slash:comments>9</slash:comments>
		</item>
		<item>
			<title>How to change powershell configuration file at run time</title>
			<description>Hi,&lt;BR&gt;&lt;BR&gt;I have a .net project that is built upon powershell project&#160;template.&lt;BR&gt;The project contains cmdlets and snapin to register them.&lt;BR&gt;&lt;BR&gt;I want to be able to change powershell configuration file (that resides in powershel home directory) at run time and use the new settings without having to restart powershell session.&lt;BR&gt;&lt;BR&gt;How do change configuration file on the fly and use it immediately at the current session?</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5452/afv/topic/Default.aspx</link>
			<dc:creator>powersheller</dc:creator>
			<pubDate>Thu, 29 Jul 2010 00:19:48 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5452/afv/topic/Default.aspx</guid>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>PS Script in SendTo context menu - howto?</title>
			<description>Hello,

I wonder if there is a way to have PS scripts in the Windows-Explorer SendTo context menu. I do have some batch files in the SendTo folder but .ps1 files (or links to them) put there don't show up in the menu. Is there a way to get this working? I'm using Windows 7.

Alternatively, is there any way that I right click on a file and the files FullName gets passed to a PS script as a variable?

Thanks</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5435/afv/topic/Default.aspx</link>
			<dc:creator>absolutebeginner</dc:creator>
			<pubDate>Mon, 26 Jul 2010 02:23:12 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5435/afv/topic/Default.aspx</guid>
			<slash:comments>7</slash:comments>
		</item>
		<item>
			<title>add-type works but no joy</title>
			<description>I'm not a strong programmer so I'm not sure if I'm just doing this wrong or there is a difference in Windows&#160;Server 2008 R2 vs Win7 but I can't get an add-type to work. &lt;BR&gt;&lt;BR&gt;The type is from&#160;&lt;A href=&quot;http://sharpsnmplib.codeplex.com/&quot;&gt;http://sharpsnmplib.codeplex.com&lt;/A&gt; where I'm trying to make use of the snmpget function using code like this:&lt;BR&gt;&lt;BR&gt;Add-Type -Path &quot;C:\SNMP\sharpsnmplib.dll&quot; &lt;BR&gt;Add-Type -Path &quot;C:\SNMP\SharpSnmpLib.Controls.dll&quot;&lt;BR&gt;snmpget -v 1 -c public $hostname $oidstring&lt;BR&gt;&lt;BR&gt;It works fine on my windows 7 64 bit workstation but on a windows server 2008 R2 server it throws an error stating it doesn't know what &quot;snmpget&quot; is, meaning it didn't add the type properly. &lt;BR&gt;&lt;BR&gt;I set execution policy and tried it on 64bit and 32bit powershell and no joy.&lt;BR&gt;&lt;BR&gt;Any ideas?&lt;BR&gt;&lt;BR&gt;thanks&lt;BR&gt;&lt;BR&gt;Pete</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5446/afv/topic/Default.aspx</link>
			<dc:creator>PDMeat</dc:creator>
			<pubDate>Tue, 27 Jul 2010 08:01:56 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5446/afv/topic/Default.aspx</guid>
			<slash:comments>2</slash:comments>
		</item>
		<item>
			<title>Win32_Processor Xeon</title>
			<description>I was tasked with writing a script to&#160;produce a report for&#160;a Windows&#160;2008 upgrade project.&#160; Pretty simple, query all servers not running windows server 2008 and&#160; then get some basic information.&#160; While the report worked well, there is a major flaw in&#160; my data gathering.&#160; One of the items of information was wheter the server had 64bit processor(s).&#160; Now the flaw seems specific to a certain manufacturer (IBM&#160; Blades) but in general the&#160;data couldn't be trusted.&#160;Using gwmi win32_processor&#160;I looked at Architecture which returns 0 for x86, DataWidth returns 32, Family returns 2.&#160; I know the processor I am looking at is a Xeon 5160 which supports 64bit via&#160; IA64&#160; (which is why it might not read x64&#160; architecture).&#160; The server I am testing against is running&#160;Windows&#160;Server 2003 SP2, and I&#160; even tried to run WMIC locally on the server to see if the results would be different.&#160; Then the SCCM admin overheard me discussing the data and produced a report that indicated the&#160;servers (and more specifically my test case) had a 64bit processor.&#160; &lt;BR&gt;&lt;BR&gt;This might not be powershell related at all, but I have&#160;seen many inventory scripts and wondering if anyone else has seen this and if there might be an alternative logic (i.e. if win32_Processor.name -like &quot;*Xeon*5160*&quot;){&quot;This is a 64bit processor box&quot;} but that&#160; could lead to a lengthy reference loop for processor&#160; names.&#160; I know SP2&#160; fixed the data returned my win32_processor.family but SP2 is installed.&lt;BR&gt;&lt;BR&gt;Thanks</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5440/afv/topic/Default.aspx</link>
			<dc:creator>jkavanagh58</dc:creator>
			<pubDate>Mon, 26 Jul 2010 23:59:39 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5440/afv/topic/Default.aspx</guid>
			<slash:comments>7</slash:comments>
		</item>
		<item>
			<title>Listing local users, admin and service accounts</title>
			<description>Hi all,&lt;br&gt;&lt;br&gt;New to Powershell and I was wondering if someone could give me some assistance.&lt;br&gt;&lt;br&gt;I'm working on a auditing project where I have to obtain (export to csv) all local accounts (user, admin, service) from a list of servers (500+), which i have to then label them all by adding some content to their description fields.&lt;br&gt;The labelling aspect I'm ok with, its the retrieving the info, which I'm lost.&lt;br&gt;Some of the servers are DC's and I've read several articles to be aware how this is done as it will pull out a list of all users from the domain , instead of the local ones.&lt;br&gt;&lt;br&gt;Thanks in advance&lt;br&gt;</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5447/afv/topic/Default.aspx</link>
			<dc:creator>Chico76</dc:creator>
			<pubDate>Wed, 28 Jul 2010 00:50:37 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5447/afv/topic/Default.aspx</guid>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>Variable conversion from import-csv not converting to.. variable</title>
			<description>Hi all,&lt;br&gt;&lt;br&gt;I have a bit of a tricky one that I've been working on all morning and for the life of me I can't figure this one out.&#160; Hope someone out there can tell me to write .totring at the end of a command and make it all magically work :)&lt;br&gt;&lt;br&gt;I have 2 csv files that I'm pulling data from. &lt;br&gt;The first file - DistroGroups.csv contains two columns -&lt;br&gt;GroupNames,SharePointFilters&lt;br&gt;Stores ALL, ($_.'Banner Type_ID.Name' -eq 'Diegos' -and $_.'Banner_ID.Name' -eq 'Bannered')&lt;br&gt;&lt;br&gt;The second - Stores.csv contains everything I'm look up.&#160; It's a huge list, but condensed down it's something like:&lt;br&gt;Banner Type_ID.Name, Banner_ID.Name&lt;br&gt;Diegos, Bannered&lt;br&gt;&lt;br&gt;What I'm trying to do is use SharePointFilters to do a where-object on stores.csv .&#160; Essentially, when I manually input the data from the csv file into a command, it runs fine, but when I use a variable $_.'SharepointFilters' it never works, or gives me back everything ignoring the filter.&#160; I've tried taking off the ('s and )'s, tried importing and exporting the distrogroups csv file, just for the sake of it, but it never works.&#160; I've also tried assigning $_.sharepointfilters to it's own variable first off.&#160; When I merely do a write-host on sharepointfilters they both appear exactly the same (manually entered and from the csv). &lt;br&gt;&lt;br&gt;Code is below, and the output is essentially empty unless I manually do it.&#160; I'm wondering if a) there's an issue using pipeline input as variables (do they go in as text only?), or b) if I need to convert it into something else first.&lt;br&gt;&lt;br&gt;$QueryStores = import-csv $SPWork\Stores.csv&lt;br&gt;$QueryDG = Import-Csv C:\Scripts\DistroGroups.csv&lt;br&gt;$QueryDG | ForEach-Object {&lt;br&gt;&#160;&#160;&#160; $SPFilter = $_.'SharePointFilter'&lt;br&gt;&#160;&#160;&#160; $QueryStores | where-object {($_.'Banner Type_ID.Name' -eq 'Diegos' -and $_.'Banner_ID.Name' -eq 'Bannered')} | export-csv ($SPWork + &quot;\Stores-Match-BanneredVIC2P&quot; + &quot;.csv&quot;) # This DOES work&lt;br&gt;&#160;&#160;&#160; $QueryStores | where-object {$_.'SharepointFilter'} | export-csv spfilters.csv # this doesn't work&lt;br&gt;&#160;&#160;&#160; $QueryStores | where-object {$SPFilter} | export-csv spfilters.csv # this doesn't work&lt;br&gt;&#160;&#160;&#160; }&lt;br&gt;&lt;br&gt;Thanks for your help,&lt;br&gt;Josh</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5438/afv/topic/Default.aspx</link>
			<dc:creator>Mitsu</dc:creator>
			<pubDate>Mon, 26 Jul 2010 17:01:18 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5438/afv/topic/Default.aspx</guid>
			<slash:comments>5</slash:comments>
		</item>
		<item>
			<title>get-wmiobject win32_printer name includes twice as many &quot;\&quot;?</title>
			<description>I'm somewhat of a powershell newbie here, so I apologize if this is a ridiculous question:&#160; Why does the printer name of a network printer show up as &quot;\\\\printserver.domain.com\\printername&quot; when using get-wmiobject win32_printer?&lt;br&gt;&lt;br&gt;Why all the extra &quot;\&quot;?&lt;br&gt;&lt;br&gt;This had me confused for the longest time as I was writing a script to remove printers and re-add different ones...&#160; I now have it working, but still have no idea why the extra slashes are added.&#160; Any pointers would be greatly appreciated, i hate not knowing the &quot;why&quot;.&#160; :)&lt;br&gt;</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5445/afv/topic/Default.aspx</link>
			<dc:creator>Ryan32</dc:creator>
			<pubDate>Tue, 27 Jul 2010 04:54:54 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5445/afv/topic/Default.aspx</guid>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>Powershell Overwrite / Update Array Values</title>
			<description>Hello All&lt;br&gt;&lt;br&gt;&#160;I hope this is an easy one to answer, I've no doubt it's extremely basic however google has been of little help. If anybody could assisst I'd appreciate it.&lt;br&gt;&lt;br&gt;&#160;Basically the code below doesn't work:&lt;br&gt;&lt;br&gt;&lt;textarea rows=&quot;8&quot; cols=&quot;50&quot;&gt;$AFile = Get-Content Results.xml
foreach ($VFile in $AFile)

{
$VFile = &quot;URL&quot;
}

$AFile&lt;/textarea&gt;&lt;br&gt;&lt;br&gt;All I'd like to do is overwrite each item in this array (currently simplified although this will be conditional in the finished script,) and then output the result. The problem is nothing updates. Am I missing a cmdlet?&lt;br&gt;&lt;br&gt;Many thanks,&lt;br&gt;&lt;br&gt;James&lt;br&gt;</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5437/afv/topic/Default.aspx</link>
			<dc:creator>jamesscott11</dc:creator>
			<pubDate>Mon, 26 Jul 2010 16:12:11 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5437/afv/topic/Default.aspx</guid>
			<slash:comments>2</slash:comments>
		</item>
		<item>
			<title>Listing a groups for user</title>
			<description>Hi,&lt;BR&gt;&lt;BR&gt;I was wondering how I can list what groups a user belongs to in PowerShell.&lt;BR&gt;&lt;BR&gt;Thanks,&lt;BR&gt;&lt;BR&gt;PSB</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5414/afv/topic/Default.aspx</link>
			<dc:creator>psbeginner</dc:creator>
			<pubDate>Wed, 21 Jul 2010 01:30:07 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5414/afv/topic/Default.aspx</guid>
			<slash:comments>1</slash:comments>
		</item>
		<item>
			<title>multiple variables don't pass correctly to function</title>
			<description>I am writing a script to copy files to multiple computers by taking source file, hostname list and destination location as the inputs. Following is the script (removed actual copy-item command for debugging);&lt;br&gt;&lt;br&gt;function mycopyfile{&lt;br&gt;param($sourcefile, $hostlist, $filedestination)&lt;br&gt;Write-host $sourcefile&lt;br&gt;Write-host $hostlist&lt;br&gt;Write-host $filedestination&lt;br&gt;}&lt;br&gt;$sourcefile = $args&amp;#91;0&amp;#93;&lt;br&gt;$hostlist = $args&amp;#91;1&amp;#93;&lt;br&gt;$filedestination = $args&amp;#91;2&amp;#93;&lt;br&gt;mycopyfile($sourcefile, $hostlist, $filedestination)&lt;br&gt;&lt;br&gt;When I run this I get the following output;&lt;br&gt;&lt;br&gt;PS C:\powershell scripts&gt; .\paratest.ps1 c:\abc.txt d:\cde.txt scripts&lt;br&gt;c:\abc.txt d:\cde.txt scripts&lt;br&gt;&lt;br&gt;As you can see all the three variables are assigned to &quot;$sourcefile&quot; inside the function and therefore when used with the copy-item command it fails because $hostlist and $filedestination are null.&lt;br&gt;&lt;br&gt;How can I pass the variables ( &quot;c:\abc.txt&quot;, &quot;d:\cde.txt&quot; and &quot;scripts&quot;) correctly?&lt;br&gt;&lt;br&gt;PS : I have tried with single and double quotes but all failed. If I do write-host just before calling mycopyfile then the variables are showing correctly. Just running function with three values also display them properly so I think this relates to error is value passing.&lt;br&gt;</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5433/afv/topic/Default.aspx</link>
			<dc:creator>jaysun</dc:creator>
			<pubDate>Fri, 23 Jul 2010 21:04:22 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5433/afv/topic/Default.aspx</guid>
			<slash:comments>2</slash:comments>
		</item>
		<item>
			<title>&quot;Silence&quot; the output</title>
			<description>Hi,&lt;BR&gt;POSH noob here.&lt;BR&gt;&lt;BR&gt;Very simple thing. I want to ensure that the output from sme of my cmdlets doesn't go to the console.&lt;BR&gt;&lt;BR&gt;For example, &quot;mkdir FolderName&quot; produces quite a lot of output. Is there an easy way to pipe it into another cmdlet that just &quot;swallows it up&quot; and doesn't do anything?&lt;BR&gt;&lt;BR&gt;I'm sure there's an obvious way of doing this but I can't figure it out.&lt;BR&gt;&lt;BR&gt;thanks&lt;BR&gt;Jamie</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5423/afv/topic/Default.aspx</link>
			<dc:creator>jamiet</dc:creator>
			<pubDate>Thu, 22 Jul 2010 00:54:51 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5423/afv/topic/Default.aspx</guid>
			<slash:comments>4</slash:comments>
		</item>
		<item>
			<title>Relative paths?</title>
			<description>Hi,&lt;br&gt;A powershell noob here...&lt;br&gt;&lt;br&gt;I have a Powershell script that is calling Invoke-Sqlcmd and passing in a file to be executed using its -InputFile property. i.e.:&lt;br&gt;Invoke-Sqlcmd -ServerInstance . -database MyDB -InputFile &quot;.\Script.sql&quot;&lt;br&gt;&lt;br&gt;Script.sql is stored in the same place as my Powershell script.&lt;br&gt;&lt;br&gt;When I run the Powershell script I get an error:&lt;br&gt;Invoke-Sqlcmd : Could not find file 'C:\Windows\System323\Script.sql'&lt;br&gt;&lt;br&gt;Clearly the relative path &quot;.\Script.sql&quot; is not behaving like I thought it would.&lt;br&gt;&lt;br&gt;How do I reference a path stored in the same folder using a relative path? Surely this can be done, can't it?&lt;br&gt;&lt;br&gt;Is there a solution to this? Something that works in POSH v1 would be preferable.&lt;br&gt;&lt;br&gt;thanks&lt;br&gt;Jamie&lt;br&gt;</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5419/afv/topic/Default.aspx</link>
			<dc:creator>jamiet</dc:creator>
			<pubDate>Wed, 21 Jul 2010 19:55:47 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5419/afv/topic/Default.aspx</guid>
			<slash:comments>6</slash:comments>
		</item>
		<item>
			<title>A count in a trap?</title>
			<description>Hey all, I need some help. &lt;BR&gt;&lt;BR&gt;I wrote a simple powershell to add/remove a user in local groups. I'm giving this to other techs in the area to use as well so I included a simple error trap to let them know if an error occurred or not. Basically what I'm doing is I define a &quot;count&quot; variable = 0 and if it enters the trap, count increases by 1. Only problem is it runs the other commands in the trap, but never increases count? I'm a total noob when it comes to powershell so I figured I'd ask for help. Here's my code: &lt;BR&gt;&lt;BR&gt;$Computers = Read-Host 'Please enter computer name' &lt;BR&gt;$domain = Read-Host 'Please enter&#160;domain name' &lt;BR&gt;$group = Read-Host 'Please enter group name (ie Administrators, Remote Desktop Users)' &lt;BR&gt;$username = Read-Host 'Please enter username.' &lt;BR&gt;$check = 0 &lt;BR&gt;&lt;BR&gt;foreach ($computer in $Computers) {&#160;&lt;BR&gt;&#160;&#160;&#160;$addcomp = &amp;#91;ADSI&amp;#93;(&quot;WinNT://&quot; + $computer + &quot;,computer&quot;)&#160;&lt;BR&gt;&#160;&#160;&#160;$group2 = $addcomp.psbase.children.find(&quot;$group&quot;)&#160;&lt;BR&gt;&#160;&#160;&#160;$group2.Add(&quot;WinNT://&quot; + $domain + &quot;/&quot; + $username) &lt;BR&gt;&lt;BR&gt;trap &amp;#91;Exception&amp;#93; {&#160;&lt;BR&gt;$check++&#160;&lt;BR&gt;$(&quot;ERROR on $computer &quot; + $_.Exception.GetType().FullName) | Add-Content add-errors.txt &lt;BR&gt;$(&quot;Message: &quot; + $_.Exception.Message) | Add-Content add-errors.txt &lt;BR&gt;continue; } } &lt;BR&gt;&lt;BR&gt;if ($check -eq 0 ) { &lt;BR&gt;Write-Host (&quot;The command completed successfully $check&quot;) } &lt;BR&gt;else { &lt;BR&gt;Write-Host (&quot;Errors were detected. See add-errors.txt&quot;) } &lt;BR&gt;&lt;BR&gt;Check always stays at 0 but it writes the error file successfully. Thanks in advance for any help. Probably simple. &lt;BR&gt;&lt;BR&gt;</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5430/afv/topic/Default.aspx</link>
			<dc:creator>jiffylueb</dc:creator>
			<pubDate>Fri, 23 Jul 2010 06:17:08 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5430/afv/topic/Default.aspx</guid>
			<slash:comments>3</slash:comments>
		</item>
		<item>
			<title>WriteObject / WriteError error message</title>
			<description>Hi,&lt;BR&gt;&lt;BR&gt;I'm writing a script that will grab info from a database, then use it to ping servers, then write some results back to the same database.&#160; Unfortunately it is falling over when writing back to the database.&lt;BR&gt;&lt;BR&gt;Here it is.&lt;BR&gt;&lt;BR&gt;&lt;B&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;
&lt;P&gt;Invoke-Sqlcmd&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;I&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;-ServerInstance&lt;/I&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;DPROVDB&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;I&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;-Query&lt;/I&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&quot;select org_id&lt;BR&gt;from organisation_tbl&lt;BR&gt;where opt_id = 3&lt;BR&gt;and org_categories like 'S%'&lt;BR&gt;and org_categories not like '%A%'&lt;BR&gt;and org_categories not like '%M%'&lt;BR&gt;order by org_id desc&quot;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; | &lt;/FONT&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;ForEach-Object&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; {&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#800080 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800080 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800080 size=2&gt;&#160;&#160;&#160;$DENI&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#ff0000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#ff0000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#ff0000 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#800080 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800080 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800080 size=2&gt;$_&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;.org_id&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&#160;&#160;&#160;gwmi&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;Win32_PingStatus&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;I&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;-Filter&lt;/I&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&quot;Address='$DENI-am01'&quot;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; | &lt;/FONT&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;select&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;IPV4Address &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;|&#160;&lt;/FONT&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;where&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; { &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#800080 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800080 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800080 size=2&gt;$_&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;.IPV4Address &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#ff0000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#ff0000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#ff0000 size=2&gt;-notlike&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;'10.*'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; } | &lt;/FONT&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;ForEach-Object&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; {&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&#160;&#160;&#160;Invoke-Sqlcmd&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;I&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;-ServerInstance&lt;/I&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;DPROVDB&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;I&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#5f9ea0 size=2&gt;-Query&lt;/I&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&lt;FONT face=&quot;Courier New&quot; color=#800000 size=2&gt;&quot;INSERT&#160;INTO&#160;HoldingDB.dbo.OFFLINESIMS_TMP VALUES ('$DENI')&quot;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;
&lt;P&gt;&#160;&#160;&#160;}&lt;BR&gt;}&lt;BR&gt;---------------------------------------&lt;BR&gt;I can write-host the results no worries, but when I attempt to run the SQL&#160;Insert I recieve this error :&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;FONT face=&quot;Courier New&quot; size=2&gt;&lt;/P&gt;
&lt;P&gt;The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing methods, and only from that same thread. Validate that the cmdlet makes these calls correctly, or please contact Microsoft Support Services.&lt;/P&gt;
&lt;P&gt;At :line:1 char:13&lt;/P&gt;
&lt;P&gt;+ Invoke-Sqlcmd &lt;&lt;&lt;&lt; -ServerInstance DPROVDB -Query &quot;&lt;BR&gt;----------------------------------------&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR&gt;I've googled the error and I couldn't find anything that related to what I am trying to do.&#160; So wondered if anyone could help in any way.&lt;BR&gt;&lt;BR&gt;Thanks in advance&lt;BR&gt;&lt;BR&gt;Robbie.&lt;BR&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5420/afv/topic/Default.aspx</link>
			<dc:creator>bobdee1980</dc:creator>
			<pubDate>Wed, 21 Jul 2010 21:47:51 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5420/afv/topic/Default.aspx</guid>
			<slash:comments>3</slash:comments>
		</item>
		<item>
			<title>Delegate parameters from one command to another</title>
			<description>I'm trying to do something which is trivial to do with the Unix shells I'm used to, but seems to be very cumbersome to do with Powershell.&#160; I'm wondering if I'm just missing something though.&lt;BR&gt;&lt;BR&gt;Occasionally I want to create a wrapper around some command, which simply passes all the arguments passed to the wrapper on to the wrapped command, but adds some additional argument.&#160; &lt;BR&gt;&lt;BR&gt;For example, say I want to create a command called Select-StringCS, which&#160;is a wrapper around&#160;Select-String that&#160;adds the -CaseSensitive switch to the commandline, but otherwise just passes all its parameters on to Select-String.&#160;&#160; So if I type:&lt;BR&gt;&lt;BR&gt;(&quot;FOOL&quot;, &quot;tool&quot;) | Select-StringCS -Pattern 'oo'&lt;BR&gt;&lt;BR&gt;I want it to behave exactly as if I had typed:&lt;BR&gt;&lt;BR&gt;(&quot;FOOL&quot;, &quot;tool&quot;) | Select-String -CaseSensitive&#160;-Pattern 'oo' &lt;BR&gt;&lt;BR&gt;Similarly, if I pass any other options to Select-StringCS I want them to be passed on to Select-String.&#160; What is the easiest way to implement Select-StringCS&#160;in Powershell?&lt;BR&gt;&lt;BR&gt;In a Unix shell like bash, the &quot;grep&quot; command is roughly equivalent to Select-String.&#160;Grep does case-sensitive matches by default, but can be made to do case-insensitive matches by passing the -i switch.&#160; I can create a new command called &quot;igrep&quot; like this:&lt;BR&gt;&lt;BR&gt;alias igrep='grep -i'&lt;BR&gt;&lt;BR&gt;That's it!&#160; Now if I type:&lt;BR&gt;&lt;BR&gt;igrep -opt1 arg1 -opt2 arg2&lt;BR&gt;&lt;BR&gt;it's&#160;exactly as if I had typed:&lt;BR&gt;&lt;BR&gt;grep -i -opt1 arg1 -opt2 arg2&lt;BR&gt;&lt;BR&gt;A first stab at this in Powershell might be:&lt;BR&gt;&lt;BR&gt;function Select-StringCS {&lt;BR&gt;&#160; Select-String -CaseSensitive @args&lt;BR&gt;}&lt;BR&gt;&lt;BR&gt;This works fine as long as I only pass positional arguments to Select-StringCS, but it breaks as soon as I try to use a -ParameterName VALUE&#160;type switch with Select-StringCS, because then it will just pass the string &quot;-ParameterName&quot; as a separate argument to Select-String, which isn't what I wanted.&#160;&#160; So, this will work:&lt;BR&gt;&lt;BR&gt;Select-StringCS 'oo'&lt;BR&gt;&lt;BR&gt;but this won't:&lt;BR&gt;&lt;BR&gt;Select-StringCS -Pattern 'oo'&lt;BR&gt;&lt;BR&gt;because in the second case, Select-String will receive both &quot;-Pattern&quot; and &quot;oo&quot; as two separate arguments, which wasn't the intention.&#160;&lt;BR&gt;&lt;BR&gt;To fix this, I would&#160;have to explicitly declare every paramater that Select-String supports as a parameter of Select-StringCS, so then I can use @psBoundParameters to&#160;pass the actual parameters&#160;on to Select-String.&#160; &#160;Since Select-String supports at least a dozen different parameters, of various types, this would be pretty laborious for such a simple task, so in practice I just live with Select-StringCS not supporting the same options as Select-String.&#160;&#160;&lt;BR&gt;&lt;BR&gt;So, is there some simple&#160;way I don't know about to write wrappers like this in Powershell, which accept the same parameters as another command?&#160;&#160; &lt;BR&gt;&lt;BR&gt;Thank you in advance.&lt;BR&gt;&lt;BR&gt;</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5431/afv/topic/Default.aspx</link>
			<dc:creator>bilboa</dc:creator>
			<pubDate>Fri, 23 Jul 2010 07:34:07 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5431/afv/topic/Default.aspx</guid>
			<slash:comments>4</slash:comments>
		</item>
		<item>
			<title>You cannot call a method on a null-valued expression</title>
			<description>&lt;P&gt;Hi, I'm hoping someone can help me here.&lt;/P&gt;
&lt;P&gt;I am trying to use powershell to produce graphical reports but am constantly stumbling on every script that contains this particular line:&lt;/P&gt;
&lt;P&gt;&lt;code&gt;&lt;BR&gt;&#160;&#160;&#160; $series = (&amp;#91;array&amp;#93; $chart.charts)&amp;#91;0&amp;#93;.SeriesCollection.Add(0)&lt;BR&gt;&lt;/code&gt;&lt;BR&gt;It doesnt matter what the script does, either simply collecting process utilisation from the local pc or obtaining management&#160;stats from our vmware environment, any script that uses that line causes the following error:&lt;BR&gt;&lt;BR&gt;&lt;code&gt;&lt;BR&gt;You cannot call a method on a null-valued expression. At C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\Scripts\test.ps1:18 char:62 + $series = (&amp;#91;array&amp;#93; $chart.charts)&amp;#91;0&amp;#93;.SeriesCollection.Add &lt;&lt;&lt;&lt; (0)&lt;BR&gt;&lt;/code&gt;&lt;BR&gt;&lt;BR&gt;Here's hoping for something really silly/trivial that'll make all my scripts work properly!&lt;BR&gt;Thanks in advance&lt;BR&gt;&lt;BR&gt;&lt;code&gt;&lt;BR&gt;$msWord = New-Object -Com Word.Application&lt;BR&gt;&#160;# Create new document &lt;BR&gt;$wordDoc = $msWord.Documents.Add()&lt;BR&gt;&#160;# Make word visible (optional) &lt;BR&gt;$msWord.Visible = $true &lt;BR&gt;# Activate the new document &lt;BR&gt;$wordDoc.Activate() &lt;BR&gt;$Caption = &quot;Simple Example&quot; &lt;BR&gt;$categories = @() &lt;BR&gt;$values = @() &lt;BR&gt;$chart = new-object -com OWC11.ChartSpace.11 &lt;BR&gt;$chart.Clear() &lt;BR&gt;$c = $chart.charts.Add(0) &lt;BR&gt;$c.Type = 4 &lt;BR&gt;$c.HasTitle = &quot;True&quot; &lt;BR&gt;$c.HasLegend = &quot;True&quot; &lt;BR&gt;$series = (&amp;#91;array&amp;#93; $chart.charts)&amp;#91;0&amp;#93;.SeriesCollection.Add(0) &lt;BR&gt;Get-Process | foreach-object {&#160;&lt;BR&gt;&#160;&#160;&#160;$categories += $_.Name $values += $_.CPU * 1&lt;BR&gt;&#160;&#160;&#160;&#160;} &lt;BR&gt;$series.Caption = $Caption &lt;BR&gt;$series.SetData(1, -1, $categories) &lt;BR&gt;$series.SetData(2, -1, $values) &lt;BR&gt;$filename = (resolve-path .).Path + &quot;\pie1.jpg&quot; &lt;BR&gt;$chart.ExportPicture($filename, &quot;jpg&quot;, 800, 500) &lt;BR&gt;$objSelection = $msWord.Selection &lt;BR&gt;$msword.Selection.EndKey(6) &lt;BR&gt;$objSelection.TypeParagraph() &lt;BR&gt;$msWord.Application.Selection.InlineShapes.AddPicture($filename) &gt; Null &lt;BR&gt;&lt;/code&gt;&lt;/P&gt;</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/3581/afv/topic/Default.aspx</link>
			<dc:creator>icts.prsi</dc:creator>
			<pubDate>Fri, 16 Jan 2009 01:41:34 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/3581/afv/topic/Default.aspx</guid>
			<slash:comments>6</slash:comments>
		</item>
		<item>
			<title>Unable to Customize Powershell Console</title>
			<description>I am reading Windows Powershell™ 2 For Dummies&#174; and chapter 2 explains how to customize the powershell console. &lt;BR&gt;&lt;BR&gt;Created a file Microsoft.PowerShellISE_profile.ps1 with the following contents: &lt;BR&gt;&lt;BR&gt;$Shell = $Host.UI.RawUI &lt;BR&gt;$Shell.WindowTitle=&quot;PowerShell Obeys Me&quot; &lt;BR&gt;$Shell.BackgroundColor=&quot;White&quot; &lt;BR&gt;$Shell.ForegroundColor=&quot;Blue&quot; &lt;BR&gt;$size = $Shell.WindowSize &lt;BR&gt;$size.width=120 $size.height=55 &lt;BR&gt;$Shell.WindowSize = $size &lt;BR&gt;$size = $Shell.BufferSize &lt;BR&gt;$size.width=120 &lt;BR&gt;$size.height=5000 &lt;BR&gt;$Shell.BufferSize = $size &lt;BR&gt;Clear-Host &lt;BR&gt;&lt;BR&gt;When I load the powershell_ise, it does change the window title, background, foreground colors, but I also receive the following errors: &lt;BR&gt;&lt;BR&gt;Property 'width' cannot be found on this object; make sure it exists and is settable. &lt;BR&gt;At C:\Users\&amp;#91;user&amp;#93;\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1:6 char:7 + $size. &lt;&lt;&lt;&lt; width=120 + CategoryInfo : InvalidOperation: (width:String) &amp;#91;&amp;#93;, RuntimeException + FullyQualifiedErrorId : PropertyNotFound &lt;BR&gt;&lt;BR&gt;Property 'height' cannot be found on this object; make sure it exists and is settable. At C:\Users\&amp;#91;user&amp;#93;\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1:7 char:7 + $size. &lt;&lt;&lt;&lt; height=55 + CategoryInfo : InvalidOperation: (height:String) &amp;#91;&amp;#93;, RuntimeException + FullyQualifiedErrorId : PropertyNotFound &lt;BR&gt;&lt;BR&gt;Exception setting &quot;WindowSize&quot;: &quot;Cannot convert null to type &quot;System.Management.Automation.Host.Size&quot;.&quot; At C:\Users\&amp;#91;user&amp;#93;\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1:8 char:8 + $Shell. &lt;&lt;&lt;&lt; WindowSize = $size + CategoryInfo : InvalidOperation: (:) &amp;#91;&amp;#93;, RuntimeException + FullyQualifiedErrorId : PropertyAssignmentException &lt;BR&gt;&lt;BR&gt;How do I fix these errors?</description>
			<link>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5421/afv/topic/Default.aspx</link>
			<dc:creator>jibberjabber</dc:creator>
			<pubDate>Wed, 21 Jul 2010 22:44:54 GMT</pubDate>
			<guid>http://powershellcommunity.org/Forums/tabid/54/aff/1/aft/5421/afv/topic/Default.aspx</guid>
			<slash:comments>3</slash:comments>
		</item><atom:link href="http://powershellcommunity.org/DesktopModules/ActiveForums/feeds.aspx?portalid=0&amp;forumid=1&amp;tabid=54&amp;moduleid=413" rel="self" type="application/rss+xml" />
	</channel></rss>