tag:blogger.com,1999:blog-29679635026829991392023-11-15T05:32:11.956-08:00QAWARRIOR IT BLOGblog dedicated to automation of everything from builds, testing, deployments, and releases. Posts focusing mainly on PowerShell and related technologies but also including Application Lifestyle Management and anything code, script, computer related. I love tech and need to share my knowledge with the world.Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.comBlogger28125tag:blogger.com,1999:blog-2967963502682999139.post-69319229289832824832017-04-28T13:16:00.000-07:002017-04-28T13:16:08.144-07:00PoshLogger 2.0 Now On GithubAnonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-46174921004237970612014-07-17T10:06:00.005-07:002014-07-17T10:06:50.284-07:00The Winner is ... Wait-ObjectI decided I like the for where is the object i was waiting for was returned, I would pass the InputObject on down the pipeline but if not Write-Error and return null. This allows me to 1. let the command run and do a null check on the return value to decide if the script should continue<br />
<br />
Example 1.<br />
$returned = $false | Wait-Object -ScriptBlock {Test-Path C:\Wait\For\Removal } -TimeOut 10<br />
<br />
if($returned -ne $null) {<br />
#do something<br />
}<br />
else {<br />
#do something else<br />
}<br />
<br />
Also this lets me use a try / catch with the ErrorAction set to stop causing the the catch to trigger in event of failure.<br />
<br />
Example 2.<br />
try {<br />
$returned = $false | Wait-Object -ScriptBlock {Test-Path C:\Wait\For\Removal } -TimeOut 10 -ErrorAction Stop<br />
}<br />
catch {<br />
exit<br />
}<br />
<div>
<br /></div>
Here is the Code:
<script src="https://gist.github.com/qawarrior/b9acc089f0b04d1a126b.js"></script>Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-85836330702566988212014-07-14T10:42:00.000-07:002014-07-14T10:42:06.006-07:00Wait-Object Function Takes Place of Wait-ValueReturnedI previously posted a function Wait-ValueReturned but is did not seem like it flowed with the rest of PowerShell so I re factored the code into Wait-Object but I am not sure about how the command should return. I have considered first return bool from the command to indicate success, which means the command will always return true or false. My other option is to return to object that was being waited on if success and return error record on fail. here is examples of both. Which makes more sense to use in a script<br />
<div>
<br /></div>
<div>
Returning Bool:
<script src="https://gist.github.com/qawarrior/b9acc089f0b04d1a126b.js"></script>
</div>
<div>
<br /></div>
<div>
Returning object or error:
<script src="https://gist.github.com/qawarrior/b9acc089f0b04d1a126b.js"></script>
</div>
Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-57039300859264546032014-06-23T08:02:00.000-07:002014-06-23T08:02:26.124-07:00New Utility Function Wait-ValueReturnedI Just need a way to block a scripts execution while I wait on some command to return the correct value. So I created this little function to allow me to pass the command or commands and what i expect back and let it handle the work instead of littering my scripts main body with a bunch of loops, if / else, and sleeps, I can use this to encapsulate all that into a clean function.<br>
<script src="https://gist.github.com/qawarrior/01c58bbcec77b3465b2c.js"></script>Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-16101602907746735812014-06-11T14:37:00.001-07:002014-06-11T14:38:29.287-07:00PowerShell Objects - Import-Module Pt 3<span style="font-family: Arial, Helvetica, sans-serif;">The -AsCustomObject switch on the New-Module Cmdlet is also available in the Import-Module which opens up a whole new world of using PowerShell objects and modules. Imagine you need to import 2 modules to work with Hyper-V and VMWare in your script but after importing them in that order you notice that Get-VM for VMWare is visiable and the Get-VM command from the Hyper-v module is hidden. The are a couple of way to handle modules with command that are the same name. One would be to use the get-command command to invoke the correct command from the correct module. My perfered way is to use the -AsCustomObject switch when importing the modules. This way I hsave the modules and there commands neatly reference in variable so that it is easy to tell which module the command i am executng is going to run against. Example (sudo-code module names may net be correct)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">.
<script src="http://pastebin.com/embed_js.php?i=hPYzXnPA"></script>
</span>Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com1tag:blogger.com,1999:blog-2967963502682999139.post-22577997924136210302014-05-30T12:18:00.001-07:002014-05-30T12:18:12.176-07:00ISESteriods makes ISE Professional Scripting IDEAnonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-30804296644534667652014-05-29T09:14:00.001-07:002014-05-29T09:14:22.839-07:00PowerShell Talk at Silicon Valley Code Camp<a href='http://www.siliconvalley-codecamp.com/Presenter/2014/Session/Paul-Cassidy-697' target='_new' ><img title='I am speaking at silicon valley code camp. Please come to my session! Click here for details and register if you are not already.' alt='I am speaking at silicon valley code camp. Please come to my session! Click here for details.' src='http://www.siliconvalley-codecamp.com/images/speaker01.jpg?w=250' /></a>Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-1445226222880644232014-05-29T08:52:00.000-07:002014-05-29T08:52:10.833-07:00Credential IO ScriptThis is an updated version of the Import and Export Credential functions that store the creds in a json format versus the clixml format used by the original created by the guys @ powertips & powershell.com. I also store them in a known location and I use a string for a look up key to store and retrieve them. This allows me to use EFS to further secure the files on the drive. Enjoy!!<br />
<br />
<br />
<script src="http://pastebin.com/embed_js.php?i=6gZq24wX"></script>Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0Sonora, CA 95370, USA37.9829496 -120.382172437.9328886 -120.4628534 38.0330106 -120.3014914tag:blogger.com,1999:blog-2967963502682999139.post-90576578555552682282014-05-24T19:28:00.001-07:002014-05-27T16:22:46.747-07:00PowerShell Objects - New-Module Cmdlet Pt. 2<p>If you remember Last we talked we had an Object with 4 Public NoteProperties, 1 Public ScriptMethod, and 1 private member. Now if we look at our ScriptMethod it returns a string unless -AsBool is passed, this can cause issues, like hindering ISE's ability to display Intellisense for the method / function because we are unable to decorate our function with the [OutputType] attribute.</p><p><img style="float: left;" src="http://lh5.ggpht.com/-r-QeCTxUyuQ/U4FTSCPTshI/AAAAAAAAENk/iPaJesSwJd0/%25255BUNSET%25255D.jpg" alt="" width="795" height="137" /></p><p>To correct this and make the code much more standardized i want to expose the IsPublished variable since it contains the boolean value indicating if the BlogPost has been published. Also notice that the value of the IsPublished value is being controlled by the object and that is important because we don't want someone or something else to come and set the value to false after we have successfully published the article to the web. So we need to set this Variable to be Read-Only, There are a couple of different ways to do this in PowerShell. First way is use the Set-Variable Cmdlet like so.</p><p><img style="float: left;" src="http://lh3.ggpht.com/-AixXbCL7jus/U4FT4P3pX-I/AAAAAAAAEOE/ij4sXy29OWA/%25255BUNSET%25255D.jpg" alt="" width="816" height="169" /></p><p>Lets run this code again and update the object that $BlogPostInfo contains a reference to and pipe it to Get-Member.</p><p><img src="http://lh4.ggpht.com/--LLiQ0CPnR0/U4FURIluAGI/AAAAAAAAEOM/LqyL6NBSldc/%25255BUNSET%25255D.jpg" alt="" width="847" height="438" /></p><p>IsPublished is now listed as a Public NoteProperty and you can see we have retrieved its value, but what about setting it.</p><p><img src="http://lh6.ggpht.com/-TSE3OcddeBs/U4FUcQr_h8I/AAAAAAAAEOU/cCk5DG6Puo8/%25255BUNSET%25255D.jpg" alt="" width="844" height="201" /></p><p>OK we see it's current value is set to $false and we receive and error when we try to set it's value with a simple assignment statement. So we are good to go, right, maybe lets see. first modify Get-PublishingStatus function so it has and empty param block and add the [OtutputType([System.String])] attribute between the Param block and the [CmdletBinding(PositionalBinding)] attribute, this lets ISE and other PS Editors and Tools what to expect a call to the function to return. Modify the Process block, remove the check for $AsBool and its surrounding context, leaving just a check to $this.IsPublished and returning the appropriate string value. The $this variable is a powershell automatic variable that references the current object, it is only available inside object body or a scriptblock. now we add a function definition for Publish-BlogPost that returns a bool on successful publishing, it also sets the IsPublished NoteProperty to $true since we are publishing the Post. Add the new function to the list of functions exported by the object.</p><p><img src="http://lh6.ggpht.com/-oHVVU2H2WTA/U4FUqz19rPI/AAAAAAAAEOc/lg4KCqy_1kY/%25255BUNSET%25255D.jpg" alt="" width="849" height="504" /></p><p>Now we rerun the code to update our $BlogPostInfo variable with a reference to our newly modified object.</p><p><img src="http://lh5.ggpht.com/-NV4fROqy-gs/U4FUza2GMaI/AAAAAAAAEOk/AcUU3ntz5Jw/%25255BUNSET%25255D.jpg" alt="" width="863" height="300" /></p><p>OK as we can see IsPublished is $false then we call Publish-BlogPost() which appears to finish successfully but when we check IsPublished again it is still $false, after looking a the $Error variable we see that an error happened when trying to update IsPublished Value it failed because it is ReadOnly which means that the value assigned to it cannot change after assignment, so that is not what we want. So like I said there are a couple of ways to get the desired behavior and interestingly enough they both involve using the same Cmdlet Add-Member. Keeping the code we have now and changing the Set-Variable call to a Add-Member call.</p><p><img src="http://lh3.ggpht.com/-6gPhG7aw7Kg/U4FU-bsc21I/AAAAAAAAEOs/UOsiq5jstNc/%25255BUNSET%25255D.jpg" alt="" width="857" height="149" /></p><p>Running and Inspecting this code we find it works. IsPublished is now updated when the Publish-BlogPost method is called.</p><p><img src="http://lh5.ggpht.com/-ojPFjig3uOg/U4FVRsRtiJI/AAAAAAAAEO8/upc7mXGPW10/%25255BUNSET%25255D.jpg" alt="" width="853" height="130" /></p><p>Awesome we have a ReadOnly NoteProperty, well no we don't because we did not update the member IsPublished we overwrote it's definition and replaced it with a new version that did not include the ReadOnly option so now the variable is free to be updated by any object, process, etc. Also another problem is that anytime we want to change its value we have to overwrite its implementation in memory and when overwriting (overriding) the member when need to define it exactly the same each time or run into issues of scoping and accessibility. Remember i said there was another way using add-member and it is to change the formal definition of the IsPublished member. I removed the current variable altogether. I pipe the object to Add-Member and add a script property that contains only a get scriptblock that returns $False and the modified the Publish-BlogPost Script Method to Call add-member and add the same script property but this tme it returns $True.</p>
<script src="http://pastebin.com/embed_js.php?i=KvuK4tvU"></script>
<p>Next Time will will talk of further uses of the New-Module Cmdlet pertaining to Object creation.</p>Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-366178181786722512014-05-20T18:20:00.001-07:002014-05-22T18:55:28.948-07:00PowerShell Object Creation – New-Module Pt. 1<br />
I have seen quite a few posts on creating custom objects in PowerShell, comparing it to techniques used in languages such as JavaScript but most use some variation of defining an object literal using Select-Object, New-Object, or a HashTable that is cast to PSCustomObject which are all fine and great ways of creating a one off Property Bag. These posts seem skip the most powerful way to define objects in PowerShell and that is to use the New-Module Cmdlet. The New-Module Cmdlet has a switch –AsCustomObject and a parameter –ScriptBlock that allow you to define a custom object. Inside the ScriptBlock every Variable defined is a property and you control whether it’s public or private by using the Export-ModuleMember Cmdlet if you export a variable it is public otherwise it is private. The most powerful part comes in the form that your functions defined inside the module ScriptBlock become the methods and the parameters define the methods arguments for the object and again the visibility is controlled by the Export-ModuleMember Cmdlet. The Functions can be Advanced Functions with Parameter Validation and Comment Based Help. Lets look at some code.<br />
<br />
<script src="http://pastebin.com/embed_js.php?i=1HFDnMVq"></script>
<br />
<br />
Running this code will provide us with a local variable $BlogPostInfo that we can inspect. <br />
<br />
<br />
<br />
<a href="http://lh6.ggpht.com/-DkjLrcN6r6g/U3v_dNXe-JI/AAAAAAAAELE/_YlnCyIBj5c/s1600-h/Example.001%25255B3%25255D.jpg"><img alt="Example.001" border="0" src="http://lh3.ggpht.com/-1t3W2D5Av8w/U3v_d1Esh0I/AAAAAAAAELM/8KJVXnZILTE/Example.001_thumb%25255B1%25255D.jpg?imgmax=800" height="323" style="border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;" title="Example.001" width="744" /></a><br />
<br />
<br />
We can see that the variable has the PSCustomObject type and are variable are now NoteProperties and our function is now a ScriptMethod. Also notice that our IsPublished variable is not included in the list because it is private, we did not export it. Next time we will cover some advanced topics such as defining ScriptProperties and method overriding.<br />
<br />
<br />
$Until_Then = Good-Times | Get-CommandAnonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-18872869085193510892011-03-29T10:56:00.001-07:002014-05-22T18:55:27.730-07:00New Project: PoshLogger<p> </p> <p>New on Codeplex @ <a href="http://poshlogger.codeplex">http://poshlogger.codeplex</a> my project to create a good, easy, unified logger for powerShell scripts, and PowerShell applications. I started with a script that Joel Bennet posted on poshcode.org and next thing you know I had a simple logger that I have been using in my internal projects on a day to day basis. If your looking for a logger jump in and help create a really great Logging Experience in PowerShell. My thanks to Joel for the Idea and thanks to the log4net team for the object model. </p> <p><span style="color: #5f9ea0">Import-Module</span><span style="color: #000000"> </span><span style="color: #0000ff">PoshLogger</span><span style="color: #000000"> <br /> <br /></span><span style="color: #800080">$Mylogger</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Get-Logger</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Name</span><span style="color: #000000"> </span><span style="color: #800000">'</span><span style="color: #800000">Test 123</span><span style="color: #800000">'</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-ConsoleLog</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-EventLog</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-RollingFileLog</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Folder</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #008000; text-decoration: underline">.\Logs</span><span style="color: #800000">"</span><span style="color: #000000"> <br /></span><span style="color: #5f9ea0">Set-DefaultLogger</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Logger</span><span style="color: #000000"> </span><span style="color: #800080">$MyLogger</span><span style="color: #000000"> <br /> <br /></span><span style="color: #5f9ea0">Push-LogContext</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Name</span><span style="color: #000000"> </span><span style="color: #800000">"My Context"</span><span style="color: #000000"> <br /></span><span style="color: #5f9ea0">Write-Log</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Message</span><span style="color: #000000"> </span><span style="color: #800000">"Logging This To Many Various Target"</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-LogLevel</span><span style="color: #000000"> </span><span style="color: #800000">'</span><span style="color: #800000">INFO</span><span style="color: #800000">'</span><span style="color: #000000"> <br /></span><span style="color: #5f9ea0">Pop-Location</span></p> Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-18709404129979718072011-03-29T09:38:00.001-07:002014-05-22T18:55:30.138-07:00Silicon Valley Code Camp 2011: PowerShell Types and Objects<p>I will be speaking once again at SCCC on Powershell. here is the actual Session overview.</p> <p> </p> <h5>PowerShell Types and Objects, Objects and Types. Oh My!</h5> <p>Level: Intermediate   |   Room: Unknown</p> <p>A look at the PowerShell Type System (ETS). PowerShell exposes a few primative Types for use but has a powerful dynamic engine called the Extensible Type System. We will discuss Primatives, Type Accelerators, PSObjects, .NET Types, WMI, ASDI, and the difference between a dynamic type and dynamic objects</p> <p> </p> <p><a title="CodeCamp at FootHill College. Click Here for Details and Registration" href="http://www.SiliconValley-Codecamp.com" target="_new"><img alt="CodeCamp at FootHill College." src="http://www.siliconvalley-codecamp.com/DisplayAd.ashx?ImageType=4" longdesc="" /></a></p> Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-58315320587258682952011-03-14T09:08:00.001-07:002014-05-22T18:55:31.789-07:00PowerShell Plus v4.0 Released! Oh Yeah!<h3> </h3> <p>Advanced PowerShell development environment</p> <p><img alt="" src="https://www.idera.com/images/Products/ProdBox/HeroShot_PowershellPlus.gif" /> <br />Learn PowerShell fast, code PowerShell faster</p> <ul> <li>Learn PowerShell fast using the Interactive Learning Center </li> <li>Execute PowerShell quickly and accurately with the powerful interactive console </li> <li>Take advantage of the PowerShell remoting features directly from the interactive console </li> <li>Access hundreds of pre-loaded scripts in the personal QuickClick™ library </li> <li>Download thousands of community scripts from PowerShell.com, TechNet and PoshCode – directly from the PowerShell Plus console and editor </li> <li>Debug PowerShell 10x faster with the advanced script editor and easily share your scripts with the PowerShell community Code</li> </ul> Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-7346844571705671762011-02-19T19:01:00.000-08:002014-05-22T18:55:26.660-07:00Microsoft Agile Guidance: Visual Studio 2010<a href="http://feedproxy.google.com/~r/ScrumLogJeffSutherland/~3/yGot-uVQPKw/microsoft-agile-guidance-visual-studio.html">Microsoft Agile Guidance: Visual Studio 2010</a>: "<span style="font-family:'Segoe UI', Verdana, Arial"></span><br /><br /><h1 style="color:#3f529c;font-family:'Segoe UI', Verdana, Arial;font-style:normal;font-variant:normal;font-weight:bold;line-height:normal;margin-bottom:10px;margin-left:0px;margin-right:0px;margin-top:0px"><span style="font-size:small">Agile Principles and Values, by Jeff Sutherland</span></h1><div style="margin-bottom:10px;margin-top:2px;padding-bottom:2px"><div style="color:#5d5d5d;float:left;padding-right:3px"><strong>Microsoft Visual Studio 2010</strong></div></div><div style="padding-top:5px"><div><div><br /><br />Agile development is a term that was derived from the Agile Manifesto, which was written in 2001 by a group that included the creators of Scrum, Extreme Programming (XP), Dynamic Systems Development Method (DSDM), and Crystal; a representative of feature-driven development; and several other thought leaders in the software industry. The Agile Manifesto established a common set of overarching values and principles for all of the individual agile methodologies at the time. It details four core values for enabling high-performing teams.<br /><br /><ul style="list-style-type:disc;margin-left:40px;padding-left:0px"><li>Individuals and their interactions</li><br /><li>Delivering working software</li><br /><li>Customer collaboration</li><br /><li>Responding to change</li><br /></ul>These core values are supported by 12 principles, which you can find at the following Web site: <a href="http://go.microsoft.com/fwlink/?LinkId=161241" style="color:#1364c4;text-decoration:none">Manifesto for Agile Software Development</a>.<br /><br /><br /><br />These values are not just something the creators of the Agile Manifesto intended to give lip service to and then forget. They are working values. Each individual agile methodology approaches these values in a slightly different way, but all of these methodologies have specific processes and practices that foster one or more of these values.</div><div><div style="margin-bottom:19px;margin-top:19px"><div><a href="http://draft.blogger.com/post-create.g?blogID=3491762" style="color:#1364c4;float:left;outline-color:initial;outline-style:none;outline-width:initial;text-decoration:none" title="Collapse"><span style="background-color:initial;background-repeat:no-repeat no-repeat;border-color:initial;border-style:initial"><img src="http://i.msdn.microsoft.com/Hash/030c41d9079671d09a62d8e2c1db6973.gif" style="background-color:initial;background-repeat:no-repeat no-repeat;border-bottom-width:0px;border-color:initial;border-left-width:0px;border-right-width:0px;border-style:initial;border-top-width:0px;float:left;height:9px;margin-top:12px;overflow-x:hidden;overflow-y:hidden;vertical-align:middle;width:9px" /></span><span style="color:#3f529c;font-family:'Segoe UI', Verdana, Arial;font-weight:bold;padding-left:6px;word-break:break-all;word-wrap:break-word">Individuals and Interactions</span></a><br /><br /><div style="padding-top:12px"></div></div></div><div style="clear:both;display:block;padding-left:15px"><div>Individuals and interactions are essential to high-performing teams. Studies of 'communication saturation' during one project showed that, when no communication problems exist, teams can perform 50 times better than the industry average. To facilitate communication, agile methods rely on frequent inspect-and-adapt cycles. These cycles can range from every few minutes with pair programming, to every few hours with continuous integration, to every day with a daily standup meeting, to every iteration with a review and retrospective.<br /><br /><br /><br /></div><div>Just increasing the frequency of feedback and communication, however, is not enough to eliminate communication problems. These inspect-and-adapt cycles work well only when team members exhibit several key behaviors:</div><ul style="list-style-type:disc;margin-left:40px;padding-left:0px"><li>respect for the worth of every person</li><br /><li>truth in every communication</li><br /><li>transparency of all data, actions, and decisions</li><br /><li>trust that each person will support the team</li><br /><li>commitment to the team and to the team’s goals</li><br /></ul><div>To foster these types of behavior, agile management must provide a supportive environment, team coaches must facilitate their inclusion, and team members must exhibit them. Only then can teams achieve their full potential.<br /><br /><br /><br /></div><div>Moving toward these types of behavior is more difficult than it might appear. Most teams avoid truth, transparency, and trust because of cultural norms or past negative experiences from conflict that was generated by honest communications. To combat these tendencies, leadership and team members must facilitate positive conflict. Doing so not only helps create productive behavior but also has several other benefits:</div><ul style="list-style-type:disc;margin-left:40px;padding-left:0px"><li>Process improvement depends on the team to generate a list of impediments or problems in the organization, to face them squarely, and then to systematically eliminate them in priority order.</li><br /><li>Innovation occurs only with the free interchange of conflicting ideas, a phenomenon that was studied and documented by Takeuchi and Nonaka, the godfathers of Scrum.</li><br /><li>Aligning the team toward a common goal requires the team to surface and resolve conflicting agendas.</li><br /><li>Commitment to work together happens only when people agree on common goals and then struggle to improve both personally and as a team.</li><br /></ul><div>This last bullet, about commitment, is especially important. It is only when individuals and teams are committed that they feel accountable for delivering high value, which is the bottom line for software development teams. Agile methodologies facilitate commitment by encouraging teams to pull from a prioritized work list, manage their own work, and focus on improving their work practices. This practice is the basis of self-organization, which is the driving force for achieving results in an agile team.<br /><br /><br /><br /></div><div>To create high-performing teams, agile methodologies value individuals and interactions over processes and tools. Practically speaking, all of the agile methodologies seek to increase communication and collaboration through frequent inspect-and-adapt cycles. However, these cycles work only when agile leaders encourage the positive conflict that is needed to build a solid foundation of truth, transparency, trust, respect, and commitment on their agile teams.</div></div></div></div></div><div><div style="margin-bottom:19px;margin-top:19px"><div><a href="http://draft.blogger.com/post-create.g?blogID=3491762" style="color:#1364c4;float:left;outline-color:initial;outline-style:none;outline-width:initial;text-decoration:none" title="Collapse"><img src="http://i.msdn.microsoft.com/Hash/030c41d9079671d09a62d8e2c1db6973.gif" style="background-color:initial;background-repeat:no-repeat no-repeat;border-bottom-width:0px;border-color:initial;border-left-width:0px;border-right-width:0px;border-style:initial;border-top-width:0px;float:left;height:9px;margin-top:12px;overflow-x:hidden;overflow-y:hidden;vertical-align:middle;width:9px" /><span style="color:#3f529c;font-family:'Segoe UI', Verdana, Arial;font-weight:bold;padding-left:6px;word-break:break-all;word-wrap:break-word">Working Software over Comprehensive Documentation</span></a><br /><br /><div style="padding-top:12px"></div></div></div><div style="clear:both;display:block;padding-left:15px"><div>Working software is one of the big differences that agile development brings. All of the agile methodologies that are represented in the Agile Manifesto stress delivering small pieces of working software to the customer at set intervals.<br /><br /><br /><br /></div><div>All agile teams must establish what they mean when they say 'working software,' which is frequently known as the definition of done. At a high level, a piece of functionality is complete only when its features pass all tests and can be operated by an end user. At a minimum, teams must go beyond the unit test level and test at the system level. The best teams also include integration testing, performance testing, and customer acceptance testing in their definition of what it means to be done with a piece of functionality.<br /><br /><br /><br /></div><div>One CMMI Level 5 company has shown, through extensive data on many projects, that defining acceptance tests along with the feature, implementing features serially and in priority order, immediately running acceptance tests on each feature, and fixing any bugs that are identified as highest priority will systematically double the speed of production and reduce defects by 40 percent. This from a company that already has one of the lowest defect rates in the world.</div><div>The Agile Manifesto recommends that teams deliver working software at set intervals. Agreeing on a definition of done is one of the practical ways that agile teams bring about the high performance and high quality that is needed to accomplish this goal.</div></div></div><div><div style="margin-bottom:19px;margin-top:19px"><div><a href="http://draft.blogger.com/post-create.g?blogID=3491762" style="color:#1364c4;float:left;outline-color:initial;outline-style:none;outline-width:initial;text-decoration:none" title="Collapse"><img src="http://i.msdn.microsoft.com/Hash/030c41d9079671d09a62d8e2c1db6973.gif" style="background-color:initial;background-repeat:no-repeat no-repeat;border-bottom-width:0px;border-color:initial;border-left-width:0px;border-right-width:0px;border-style:initial;border-top-width:0px;float:left;height:9px;margin-top:12px;overflow-x:hidden;overflow-y:hidden;vertical-align:middle;width:9px" /><span style="color:#3f529c;font-family:'Segoe UI', Verdana, Arial;font-weight:bold;padding-left:6px;word-break:break-all;word-wrap:break-word">Customer Collaboration over Contract Negotiation</span></a><br /><br /><div style="padding-top:12px"></div></div></div><div style="clear:both;display:block;padding-left:15px"><div>Over the past two decades, project success rates have more than doubled worldwide. This is attributed to smaller projects and frequent deliveries, which allow the customer to provide feedback on working software at regular intervals. The writers of the manifesto were clearly on to something when they stressed that getting the customer involved in the software development process is essential to success.<br /><br /><br /><br /></div><div>The agile methodologies foster this value by having a customer advocate work hand-in-hand with the development team. The first Scrum team, for example, had thousands of customers. Because it was not feasible to involve them all in product development, they selected a customer proxy, called a product owner, to represent not only all the customers in the field, but also management, sales, support, client services, and other stakeholders. The product owner was responsible for updating the list of requirements every four weeks as the team released working software, taking into account the current reality and actual feedback from customers and stakeholders. This allowed the customer to help shape the software that was being created.<br /><br /><br /><br /></div><div>The first XP team began with an internal IT project. They were able to have a company end user on their team work with them daily. About 10 percent of the time, consultancies and internal teams can find an end user who can work with the team on a day-to-day basis. The other 90 percent of the time, they must appoint a proxy. This customer proxy, whom XP teams call the customer, works with end users to provide a clear, prioritized list of features for developers to implement.<br /><br /><br /><br /></div><div>Collaborating with the customer (or customer proxy) on a daily basis is one of the key reasons why industry data shows that agile projects have more than twice the success rate of traditional projects on average worldwide. Agile methodologies recognize this and, as such, have created a place on their development teams that is specifically for the customer representative.</div></div></div><div><div style="margin-bottom:19px;margin-top:19px"><div><a href="http://draft.blogger.com/post-create.g?blogID=3491762" style="color:#1364c4;float:left;outline-color:initial;outline-style:none;outline-width:initial;text-decoration:none" title="Collapse"><img src="http://i.msdn.microsoft.com/Hash/030c41d9079671d09a62d8e2c1db6973.gif" style="background-color:initial;background-repeat:no-repeat no-repeat;border-bottom-width:0px;border-color:initial;border-left-width:0px;border-right-width:0px;border-style:initial;border-top-width:0px;float:left;height:9px;margin-top:12px;overflow-x:hidden;overflow-y:hidden;vertical-align:middle;width:9px" /><span style="color:#3f529c;font-family:'Segoe UI', Verdana, Arial;font-weight:bold;padding-left:6px;word-break:break-all;word-wrap:break-word">Responding to Change over Following a Plan</span></a><br /><br /><div style="padding-top:12px"></div></div></div><div style="clear:both;display:block;padding-left:15px"><div>Responding to change is essential for creating a product that will please the customer and provide business value. Industry data shows that over 60 percent of product or project requirements change during the development of software. Even when traditional projects finish on time, on budget, with all features in the plan, customers are often unhappy because what they find is not exactly what they wanted. 'Humphrey’s Law' says that customers never know what they want until they see working software. If customers do not see working software until the end of a project, it is too late to incorporate their feedback. Agile methodologies seek customer feedback throughout the project so that they can incorporate feedback and new information as the product is being developed.<br /><br /><br /><br /></div><div>All agile methodologies have built-in processes to change their plans at regular intervals based on feedback from the customer or customer proxy. Their plans are designed to always deliver the highest business value first. Because 80 percent of the value is in 20 percent of the features, well-run agile projects tend to finish early, whereas most traditional projects finish late. As a result, customers are happier, and developers enjoy their work more. Agile methodologies are based on the knowledge that, in order to succeed, they must plan to change. That is why they have established processes, such as reviews and retrospectives, that are specifically designed to shift priorities regularly based on customer feedback and business value.</div></div></div><div><div style="margin-bottom:19px;margin-top:19px"><div><a href="http://draft.blogger.com/post-create.g?blogID=3491762" style="color:#1364c4;float:left;outline-color:initial;outline-style:none;outline-width:initial;text-decoration:none" title="Collapse"><img src="http://i.msdn.microsoft.com/Hash/030c41d9079671d09a62d8e2c1db6973.gif" style="background-color:initial;background-repeat:no-repeat no-repeat;border-bottom-width:0px;border-color:initial;border-left-width:0px;border-right-width:0px;border-style:initial;border-top-width:0px;float:left;height:9px;margin-top:12px;overflow-x:hidden;overflow-y:hidden;vertical-align:middle;width:9px" /><span style="color:#3f529c;font-family:'Segoe UI', Verdana, Arial;font-weight:bold;padding-left:6px;word-break:break-all;word-wrap:break-word">Agile is an Umbrella – Methodologies are Implementations</span></a><br /><br /><div style="padding-top:12px"></div></div></div><div style="clear:both;display:block;padding-left:15px"><div>Agile development is not a methodology in itself. It is an umbrella term that describes several agile methodologies. At the signing of the Agile Manifesto in 2001, these methodologies included Scrum, XP, Crystal, FDD, and DSDM. Since then, Lean practices have also emerged as a valuable agile methodology and so are included under the agile development umbrella in the illustration later in this topic.<br /><br /><br /><br /></div><div>Each agile methodology has a slightly different approach for implementing the core values from the Agile Manifesto, just as many computer languages manifest the core features of object-oriented programming in different ways. A recent survey shows that about 50 percent of agile practitioners say that their team is doing Scrum. Another 20 percent say that they are doing Scrum with XP components. An additional 12 percent say that they are doing XP alone. Because more than 80 percent of agile implementations worldwide are Scrum or XP, MSF for Agile Software Development v5.0 focuses on the core processes and practices of Scrum and XP.</div><img alt="The Agile Umbrella" src="http://i.msdn.microsoft.com/dynimg/IC307329.png" style="border-bottom-width:0px;border-color:initial;border-left-width:0px;border-right-width:0px;border-style:initial;border-top-width:0px" title="The Agile Umbrella" /><br /><br /><div>Scrum is a framework for agile development processes. It does not include specific engineering practices. Conversely, XP focuses on engineering practices but does not include an overarching framework of development processes. That does not mean that Scrum does not recommend certain engineering practices or that XP has no process. For example, the first Scrum implemented all of the engineering practices that are now known as XP. However, the Scrum framework for software development was designed to get a team started in two or three days, whereas engineering practices often take many months to implement. Therefore, it left the question of when (and whether) to implement specific practices up to each team. Scrum co-creators Jeff Sutherland and Ken Schwaber recommend that Scrum teams get started immediately and create a list of impediments and a process improvement plan. As engineering practices are identified as impediments, teams should look to XP practices as a way to improve. The best teams run Scrum supplemented with XP practices. Scrum helps XP to scale, and XP helps Scrum to work well.<br /><br /><br /><br /><br /><br />For more see <a href="http://msdn.microsoft.com/en-us/library/dd997578(VS.100).aspx">Microsoft Visual Studio ...</a></div><div><br /><br /></div></div></div><div><img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/3491762-3939801879457882597?l=scrum.jeffsutherland.com" alt="" /></div><p></p><img src="http://feeds.feedburner.com/~r/ScrumLogJeffSutherland/~4/yGot-uVQPKw" height="1" width="1" />"Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-82850262078095225702011-02-15T13:47:00.001-08:002014-05-22T18:54:57.330-07:00Watching PS Vars for changes - Events<p>I have a Testing framework built around Powershell and .net. In the framework there are a couple of main objects that their property values are assigned to Globals that are well know and used. The problem was I did not want to make them read only as this causes issues if reloading the framework and or trying to change paths. I needed a way to report back the value of a variable if it changes so i could keep the objects in sync. First I used Set-PSBreakPoint –Action to Check the value but it breaks before the value is set. Then I thought I need an Event but Powershell has limited native events. So I just started tweeting and thanks to @oising I finally have a solution. Here is a simple example that can be built upon. </p> <p> </p> <pre><span style="color: #008000">#Set value to a new variable<br /></span><span style="color: #800080">$n</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000"><br /><br /></span><span style="color: #008000">#set A break point to watch for any write actions to that variable<br />#this will fire a new event VariableChanged<br /></span><span style="color: #800080">$BP</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Set-PSBreakpoint</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Variable</span><span style="color: #000000"> </span><span style="color: #0000ff">n</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Mode</span><span style="color: #000000"> </span><span style="color: #0000ff">Write</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Action</span><span style="color: #000000"> {<br /> </span><span style="color: #5f9ea0">New-Event</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-SourceIdentifier</span><span style="color: #000000"> </span><span style="color: #0000ff">VariableChanged</span><span style="color: #000000"><br /></span><span style="color: #000000">}<br /><br /></span><span style="color: #008000">#Now register to recieve the VariableChanged events<br />#Here we just check the value of our variable and get its new value<br /></span><span style="color: #800080">$EE</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Register-EngineEvent</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-SourceIdentifier</span><span style="color: #000000"> </span><span style="color: #0000ff">VariableChanged</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Action</span><span style="color: #000000"> {<br /> </span><span style="color: #5f9ea0">Write-Host</span><span style="color: #000000"> </span><span style="color: #800080">$n</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-ForegroundColor</span><span style="color: #000000"> </span><span style="color: #0000ff">Yellow</span><span style="color: #000000"><br />}<br /><br /></span><span style="color: #008000">#assign a new value to n and see the vent fires<br /></span><span style="color: #800080">$n</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000"><br /><br /></span><span style="color: #008000">#do some cleanup<br /></span><span style="color: #5f9ea0">Get-PSBreakpoint</span><span style="color: #000000"> </span><span style="color: #0000ff">|</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Remove-PSBreakpoint</span><span style="color: #000000"><br /></span><span style="color: #5f9ea0">Get-EventSubscriber</span><span style="color: #000000"> </span><span style="color: #0000ff">|</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Unregister-Event</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Force</span><span style="color: #000000"><br /></span><span style="color: #5f9ea0">Get-Event</span><span style="color: #000000"> </span><span style="color: #0000ff">|</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Remove-Event</span></pre><br /><br /><p> </p><br /><br /><p>Good-Times | Get-Command –:)</p> Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-62606155978879124862011-01-27T07:10:00.001-08:002014-05-22T18:58:33.200-07:00PowerShell Plus 4.0 beta<p>Idera has released a Beta for the 4.0 version of Powershell Plus.</p> <h4>PowerShell Plus 4.0 beta introduces a completely redesigned UI so you can code faster, debug more easily and quickly access your favorite features.</h4> <ul> <li>Redesigned UI puts the most used features at your finger tips </li> <li>Work more efficiently by customizing the UI to meet your specific needs </li> <li>New Start Page links to educational resources and a customizable news feed </li> <li>Syntax Error List helps you identify errors at a glance for faster debugging </li> </ul> <p> </p> <p>Register and Download it Here.</p> <p><a href="http://www.idera.com/Promo/PowerShell-Plus-Beta/?s=IderaEB&elq=18d2827c66294d559522a5a169ae6537">Powershell Plus 4.0 Beta</a></p> Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com1tag:blogger.com,1999:blog-2967963502682999139.post-67816861665787642712011-01-04T14:13:00.001-08:002014-05-22T18:55:12.771-07:00Solved: Powershell fails as a functional language if commands are in modules.<p> </p> <p>the issue comes down to the scope that the scriptblock being passed into the function gets bound. In the original example the scriptblock was being bound to the callers scope which can not access anything in the module except what was imported into the scope. The fix turns out to be explicitly binding the scriptblock to the modules scope. See the fixed example below. Thanks go out to @Oisin for the fix.</p> <pre><span style="color: #5f9ea0">New-Module</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Name</span><span style="color: #000000"> </span><span style="color: #800000">'</span><span style="color: #800000">Testing</span><span style="color: #800000">'</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-ScriptBlock</span><span style="color: #000000"> {<br /> </span><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #0000cd">TestOuter</span><span style="color: #000000">{<br /> </span><span style="color: #0000ff">param</span><span style="color: #000000">(<br /> [</span><span style="color: #0000ff">string</span><span style="color: #000000">]</span><span style="color: #800080">$Name</span><span style="color: #000000">,</span><span style="color: #000000"><br /> [</span><span style="color: #0000ff">scriptblock</span><span style="color: #000000">]</span><span style="color: #800080">$TestScript</span><span style="color: #000000"><br /> )<br /> </span><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #0000cd">TestInner</span><span style="color: #000000">{<br /> </span><span style="color: #0000ff">param</span><span style="color: #000000">(<br /> [</span><span style="color: #0000ff">int</span><span style="color: #000000">]</span><span style="color: #800080">$Count</span><span style="color: #000000"><br /> )<br /> </span><span style="color: #5f9ea0">Write-Host</span><span style="color: #000000"> </span><span style="color: #800080">$Count</span><span style="color: #000000"><br /> }<br /> </span><span style="color: #5f9ea0">Write-Host</span><span style="color: #000000"> </span><span style="color: #800080">$Name</span><span style="color: #000000"><br /> </span><span style="color: #800080">$Mod</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Get-Module</span><span style="color: #000000"> </span><span style="color: #0000ff">Testing</span><span style="color: #000000"><br /> </span><span style="color: #000000">&</span><span style="color: #000000"> ( </span><span style="color: #800080">$Mod</span><span style="color: #000000">.</span><span style="color: #8b4513">NewBoundScriptBlock</span><span style="color: #000000">(</span><span style="color: #800080">$TestScript</span><span style="color: #000000">) )<br /> }<br />} </span><span style="color: #0000ff">|</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Import-Module</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Force</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Global</span><span style="color: #000000"><br /></span><span style="color: #0000ff">TestOuter</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Name</span><span style="color: #000000"> </span><span style="color: #800000">"Paul"</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-TestScript</span><span style="color: #000000"> { </span><span style="color: #0000ff">TestInner</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Count</span><span style="color: #000000"> </span><span style="color: #000000">10</span><span style="color: #000000"> }<br /></span><span style="color: #5f9ea0">Remove-Module</span><span style="color: #000000"> </span><span style="color: #0000ff">Testing</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Force</span></pre> Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-38058424378552345392011-01-04T09:57:00.001-08:002014-05-22T18:58:34.465-07:00Powershell fails as a functional language if commands are in modules.<p>I have some functions that contain functions. When I put the Functions in a .ps1 file and Dot Source directly the behave great but if those functions get imported in a module they fail to find the inner function with a CommandNotFound error. It does not matter if the functions are directly in a .psm1 file or if they are dot sourced by the .psm1 file they still fail to find the inner functions. Here are some code examples. Why is this? You can copy the below code into Powershell Console or ISE and run to see the errors.</p> <pre><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #0000ff">TestOuter</span><span style="color: #000000">{<br /> </span><span style="color: #0000ff">param</span><span style="color: #000000">(<br /> [</span><span style="color: #0000ff">string</span><span style="color: #000000">]</span><span style="color: #800080">$Name</span><span style="color: #000000">,</span><span style="color: #000000"><br /> [</span><span style="color: #0000ff">scriptblock</span><span style="color: #000000">]</span><span style="color: #800080">$TestScript</span><span style="color: #000000"><br /> )<br /> </span><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #0000cd">TestInner</span><span style="color: #000000">{<br /> </span><span style="color: #0000ff">param</span><span style="color: #000000">(<br /> [</span><span style="color: #0000ff">int</span><span style="color: #000000">]</span><span style="color: #800080">$Count</span><span style="color: #000000"><br /> )<br /> </span><span style="color: #5f9ea0">Write-Host</span><span style="color: #000000"> </span><span style="color: #800080">$Count</span><span style="color: #000000"><br /> }<br /> </span><span style="color: #5f9ea0">Write-Host</span><span style="color: #000000"> </span><span style="color: #800080">$Name</span><span style="color: #000000"><br /> </span><span style="color: #000000">&</span><span style="color: #000000"> </span><span style="color: #800080">$TestScript</span><span style="color: #000000"><br />}<br /></span><span style="color: #0000ff">TestOuter</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Name</span><span style="color: #000000"> </span><span style="color: #800000">"Paul"</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-TestScript</span><span style="color: #000000"> { </span><span style="color: #0000ff">TestInner</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Count</span><span style="color: #000000"> </span><span style="color: #000000">10</span><span style="color: #000000"> }<br /><br /><br /></span><span style="color: #5f9ea0">New-Module</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Name</span><span style="color: #000000"> </span><span style="color: #800000">'</span><span style="color: #800000">Testing</span><span style="color: #800000">'</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-ScriptBlock</span><span style="color: #000000"> {<br /> </span><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #0000cd">TestOuter</span><span style="color: #000000">{<br /> </span><span style="color: #0000ff">param</span><span style="color: #000000">(<br /> [</span><span style="color: #0000ff">string</span><span style="color: #000000">]</span><span style="color: #800080">$Name</span><span style="color: #000000">,</span><span style="color: #000000"><br /> [</span><span style="color: #0000ff">scriptblock</span><span style="color: #000000">]</span><span style="color: #800080">$TestScript</span><span style="color: #000000"><br /> )<br /> </span><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #0000cd">TestInner</span><span style="color: #000000">{<br /> </span><span style="color: #0000ff">param</span><span style="color: #000000">(<br /> [</span><span style="color: #0000ff">int</span><span style="color: #000000">]</span><span style="color: #800080">$Count</span><span style="color: #000000"><br /> )<br /> </span><span style="color: #5f9ea0">Write-Host</span><span style="color: #000000"> </span><span style="color: #800080">$Count</span><span style="color: #000000"><br /> }<br /> </span><span style="color: #5f9ea0">Write-Host</span><span style="color: #000000"> </span><span style="color: #800080">$Name</span><span style="color: #000000"><br /> </span><span style="color: #000000">&</span><span style="color: #000000"> </span><span style="color: #800080">$TestScript</span><span style="color: #000000"><br /> }<br />} </span><span style="color: #0000ff">|</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Import-Module</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Force</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Global</span><span style="color: #000000"><br /></span><span style="color: #0000ff">TestOuter</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Name</span><span style="color: #000000"> </span><span style="color: #800000">"Paul"</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-TestScript</span><span style="color: #000000"> { </span><span style="color: #0000ff">TestInner</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Count</span><span style="color: #000000"> </span><span style="color: #000000">10</span><span style="color: #000000"> }<br /></span></pre> Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-7496974001735123432010-09-10T16:17:00.001-07:002010-09-10T16:17:13.627-07:00Save HTML as DOCX<blockquote> <p>the other day we had a need to save an HTML file as DOCX. We are creating the HTML file using ConvertT0-HTML. The file contains data that needs to be saved in SharePoint and needs to be editable by others. We decided to save as a DOCX because those in management all have WORD installed but don't have a  Dedicated HTML editor. So here is the Code Enjoy.</p> <p>!!! YOU MUST HAVE WORD 2007 or 2010 INSTALLED !!!!!</p> </blockquote> <blockquote> <pre><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #0000ff">ConvertTo</span><span style="color: #ff0000">-</span><span style="color: #0000ff">DOCX</span><span style="color: #000000">{<br /> </span><span style="color: #0000ff">param</span><span style="color: #000000">(</span><span style="color: #800080">$In</span><span style="color: #000000">,</span><span style="color: #800080">$Out</span><span style="color: #000000">)<br /> <br /> </span><span style="color: #008000">#int the the enum returns for DOCX format<br /></span><span style="color: #000000"> </span><span style="color: #800080">$SaveAs</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #000000">16</span><span style="color: #000000"><br /> <br /> </span><span style="color: #008000">#Create WORD object and perform conversion<br /></span><span style="color: #000000"> </span><span style="color: #800080">$Word</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0">New-Object</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-ComObject</span><span style="color: #000000"> </span><span style="color: #8b4513">Word.Application</span><span style="color: #000000"><br /> </span><span style="color: #800080">$OpenDoc</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$Word</span><span style="color: #000000">.</span><span style="color: #8b4513">Documents</span><span style="color: #000000">.</span><span style="color: #8b4513">Open</span><span style="color: #000000">(</span><span style="color: #800080">$In</span><span style="color: #000000">)<br /> </span><span style="color: #800080">$OpenDoc</span><span style="color: #000000">.</span><span style="color: #8b4513">SaveAs</span><span style="color: #000000">(</span><span style="color: #800080">$Out</span><span style="color: #000000">,</span><span style="color: #800080">$SaveAs</span><span style="color: #000000">)<br /> </span><span style="color: #800080">$OpenDoc</span><span style="color: #000000">.</span><span style="color: #8b4513">Close</span><span style="color: #000000">()<br /><br /> </span><span style="color: #008000">#stop all WORD instances<br /></span><span style="color: #000000"> </span><span style="color: #5f9ea0">Get-Process</span><span style="color: #000000"> </span><span style="color: #0000ff">|</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Where-Object</span><span style="color: #000000"> { </span><span style="color: #000080">$_</span><span style="color: #000000">.</span><span style="color: #8b4513">Name</span><span style="color: #000000"> </span><span style="color: #ff0000">-eq</span><span style="color: #000000"> </span><span style="color: #800000">"WINWORD"</span><span style="color: #000000"> } </span><span style="color: #0000ff">|</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Stop-Process</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Force</span><span style="color: #000000"><br />}</span></pre></blockquote> Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-6151015796893831762010-05-17T10:16:00.000-07:002010-05-17T10:17:12.949-07:005th Silicon Valley Code Camp Oct 9th and 10th 2010<p><a href="http://www.SiliconValley-Codecamp.com"><img alt="CodeCamp at FootHill College. Click Here for Details and Registration" src="http://www.siliconvalley-codecamp.com/DisplayAd.ashx?ImageType=4" longdesc="" /></a></p> <p>I will be giving a session “Advanced Scripting with Powershell” and My co-worker SPowser will be doiing “Powershell Modules” come and enjoy, Its free and lunch is provided. It will only cost you a weekend but why not hang with geeks and further you knowledge.</p> Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-55791949577093351122010-04-16T06:24:00.000-07:002010-04-16T06:24:51.719-07:00Customer, Developer, Tester - Ian Cooper - CodeBetter.Com - Stuff you need to Code Better!<a href="http://codebetter.com/blogs/ian_cooper/archive/2010/04/16/customer-defines-what-developer-defines-how.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+CodeBetter+%28CodeBetter.Com%29">Customer, Developer, Tester - Ian Cooper - CodeBetter.Com - Stuff you need to Code Better!</a>Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-59260310608966085442010-01-10T13:10:00.000-08:002010-01-10T13:10:55.331-08:00Remote Registry PowerShell Module - Shay LevyThis Module Contains lots of cool advanced functions to manage registries on local and remote machines check out Shay's post here... <br />
<a href="http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2010/01/10/remote-registry-powershell-module.aspx" linkindex="17">Remote Registry PowerShell Module - Shay Levy</a>Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-13109920532668353312010-01-03T07:44:00.001-08:002010-01-03T07:44:40.116-08:00A Couple Annoyances in Powershell V2.0<p>I love Powershell I have written thousands of lines of code in it. I have used most of the great new features that were introduced into v2.0 but I have came across I couple of things that just annoy me. The first is that powershell provides lots of built in or automatic variables one of those new to v2.0 is the PsScriptRoot variable. You would think that with this name it would give you the Root of the Script that is running….Well sort of it only works in psm1 or module file. Why is it not $PsModuleRoot then. Finding the root of the script executing is a common action and it was nice to include this variable but why not for any executing powershell so I am left to keep using $MyInvocation.$MyCommand.Path for this purpose. The second little irritant is the fact that if you define params that are of type switch or bool and their value is set to $false (even if you explicitly set their default value) they do not appear in the $PsBounParameters collection. This suck in the case that you want to use that collection as an object initializer i.e. ( New-Object SomeObject –Property $PsBoundParameters ). In this case the bools on the object don't get set to false which is not really an issue unless the Object is PSObject and you are creating the Property Name/Values on the Object then the name and values don't even get created on your PSObject. Not Sure why the decided not to have the values appear in the $PsBoundParameters collection but makes code messier by having to define the complete hashtable with names and values of the switch or bool that is being used to initialize the Object.   That said Powershell rocks and these can be worked around just seems like odd design choices to me. </p> Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-60790845467738037142010-01-03T07:34:00.001-08:002010-01-03T07:34:06.562-08:00Get module Info for a Function in Powershell v2.0<pre><span style="color: #5f9ea0"><font color="#000000">This one liner will return the the module info in a easy to consume format. The info includes the full path to the module that the function is defined in. Good Time and Get-Command!!!</font></span></pre><br /><br /><pre><span style="color: #5f9ea0">Get-Command</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-CommandType</span><span style="color: #000000"> </span><span style="color: #0000ff">Function</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-Name</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Control-FPService</span><span style="color: #000000"> </span><span style="color: #0000ff">|</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Select-Object</span><span style="color: #000000"> </span><span style="color: #5f9ea0">-ExpandProperty</span><span style="color: #000000"> </span><span style="color: #0000ff">Module</span><span style="color: #000000"> </span><span style="color: #0000ff">|</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Format-List</span></pre> Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0tag:blogger.com,1999:blog-2967963502682999139.post-19302517184126425822009-12-23T12:11:00.000-08:002009-12-23T12:13:46.803-08:00Microsoft Release the PowerShell V2 SDK<a href="http://tfl09.blogspot.com/2009/12/microsoft-release-powershell-v2-sdk.html">Microsoft Release the PowerShell V2 SDK</a> <br />
"The Systems Development Kit, or SDK, is a download that the stuff you need to be able to develop applications around a particular technical area. The Windows SDK is huge and there are SDKs for almost every technology MS produces. Other vendors produce SDKs too. <br />
Initially, Microsoft shipped a PowerShell SDK. Then some time ago this changed and the PowerShell SDK was subsumed into the Windows SDK – which meant finding just the PowerShell stuff was challenging. I saw any number of complaints around this in the newsgroups etc.<br />
Well –the PowerShell team have just released the Version 2.0 SDK – as an independent (and small at 2.4mb!) SDK. The SDK contains the reference assemblies and 45 samples that help you to better understand how to use PowerShell. There appears to be no documentation (and the installation process doesn’t seem to add in any shortcuts or start menu items.<br />
More holiday reading!"<br />
<div style="display: inline; float: none; margin: 0px; padding: 0px;">Technorati Tags: <a href="http://technorati.com/tags/Windows+PowerShell" rel="tag">Windows PowerShell</a>,<a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/SDK" rel="tag">SDK</a> <br />
</div>Anonymoushttp://www.blogger.com/profile/15033122149527599386noreply@blogger.com0