tag:blogger.com,1999:blog-58470967463282275812024-03-07T19:52:16.768-08:00AutomationScript GuildChris Williamshttp://www.blogger.com/profile/14325447692189400350noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5847096746328227581.post-88584846433860429112017-06-03T12:04:00.001-07:002017-06-03T12:04:09.217-07:00Import-Module Uses Old Version of Module When Running in Powershell ISE or May the Force Be With YouA little tip for those that are debugging and executing scripts. If you are calling Import-Module always use -Force on the end so it will force the script to reload during your session.<br />
<br />
Import-Module c:\myscript.ps1m -Force<br />
<br />
This will save you a lot of headaches during debugging and troubleshooting. For performance reasons, if you wanted to do this only when in the ISE you could wrap it in an if and use a function like this to check if you are in the ISE:<br />
<br />
function Test-IsISE {<br />
# try...catch accounts for:<br />
# Set-StrictMode -Version latest<br />
try { <br />
return $psISE -ne $null;<br />
}<br />
catch {<br />
return $false;<br />
}<br />
}<br />
<br />
I found this snippet on <a href="https://stackoverflow.com/questions/13195406/is-there-a-way-to-check-if-the-script-is-running-by-powershell-ise" target="_blank">stackoverflow</a><br />
<br />Chris Williamshttp://www.blogger.com/profile/14325447692189400350noreply@blogger.com0tag:blogger.com,1999:blog-5847096746328227581.post-223124115241801262017-05-01T08:16:00.003-07:002017-05-01T08:16:44.000-07:00Windows Powershell for AutomationWhether it is automated unit testing or automated tasks, Windows Powershell is the right script for you. Even products like Episerver and Sitecore have Extensions for it. You can extend it yourself simply by loading assemblies.<br />
<br />
You can also run Powershell Scripts from your custom applications. Are you struggling with Powershell, email me at <a href="mailto:chris.williams@readwatchcreate.com">chris.williams@readwatchcreate.com</a> and I will see if I can assist.Chris Williamshttp://www.blogger.com/profile/14325447692189400350noreply@blogger.com0