tag:blogger.com,1999:blog-5987791209900104222.post6733648479136407398..comments2023-12-27T05:16:09.968+02:00Comments on $cript Fanatic: Restart your engine - The PowerShell wayShay Levyhttp://www.blogger.com/profile/14910279001063843963noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-5987791209900104222.post-52114258177233613342009-07-09T13:31:28.277+03:002009-07-09T13:31:28.277+03:00Caterpillar,
We can take it offline if you want, ...Caterpillar,<br /><br />We can take it offline if you want, you can email me to scriptolog AT gmail DOT com.Shay Levyhttps://www.blogger.com/profile/14910279001063843963noreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-5284000569221739242009-07-08T02:52:54.476+03:002009-07-08T02:52:54.476+03:00Interesting stuff I must admit. But what I really ...Interesting stuff I must admit. But what I really want to know is how did you really compose all this coding?? Okay, once I get this down hopefully it will work for me because I tried a couple different ways and none of them seemed to work. No worries though, that's why Google is here! haha I can literally find anything to everything on the web nowadays but enough of that.. But then thing is, that whenever I try inserting something like this it say, "The project type is not supported by this installation" How can I solve this problem?Caterpillar Engine Partshttp://www.internetdiesel.comnoreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-63003589660751063752008-04-28T12:15:00.000+03:002008-04-28T12:15:00.000+03:00Hi Lo0mI have a a function in my $profile that sta...Hi Lo0m<BR/><BR/>I have a a function in my $profile that starts a transcript for the session. <BR/><BR/>The only *bad* thing I found is having an error, when launching the shortcut, that the transcript could not be started.<BR/><BR/>Thanks for the idea!<BR/><BR/>-ShayShay Levyhttps://www.blogger.com/profile/14910279001063843963noreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-75388053765632687112008-04-10T08:51:00.000+02:002008-04-10T08:51:00.000+02:00is there anything bad about using this?:function r...is there anything bad about using this?:<BR/><BR/>function resps {& "c:\prace\powershell\powershell.lnk"; exit}Lo0mhttps://www.blogger.com/profile/06208380317782397996noreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-57911270142392322412007-09-12T00:43:00.000+02:002007-09-12T00:43:00.000+02:00Actually, I did. There's an update to this post he...Actually, I did. There's an update to this post here<BR/>http://scriptolog.blogspot.com/2007/08/restart-your-engine-powershell-way.htmlShay Levyhttps://www.blogger.com/profile/14910279001063843963noreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-86045828710764348912007-09-11T19:57:00.000+02:002007-09-11T19:57:00.000+02:00Do you can write anything else about it? Great art...Do you can write anything else about it? Great article!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-15300947775143327462007-01-05T21:42:00.000+02:002007-01-05T21:42:00.000+02:00Perhaps I am missing something here, but doesn't t...Perhaps I am missing something here, but doesn't the following accomplish the same thing? (it works in my env)<br /><br />function Restart-PowerShell {<br /> Invoke-Item "c:\winnt\system32\WindowsPowerShell\v1.0\<br />powershell.exe"<br /> exit<br />}thomashttps://www.blogger.com/profile/05025444891188572243noreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-30757129664512027142006-12-30T01:10:00.000+02:002006-12-30T01:10:00.000+02:00Cool idea. However I changed mine to look like thi...Cool idea. However I changed mine to look like this:<br /><br />start-process $pshome\powershell.exe | out-null<br /><br /> exitAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-37031846785579761672006-12-30T00:52:00.000+02:002006-12-30T00:52:00.000+02:00My prompt function looks like this:
function prom...My prompt function looks like this:<br /><br />function prompt { <br /> $host.ui.rawui.windowtitle = "The Shell Must Flow."<br /> $host.ui.rawui.foregroundcolor = "Green"<br /> $history = @(get-history)<br /> if ($history.count -eq 0) {<br /> $intCommandCount = 0 <br /> } else {<br /> $intCommandCount = $history[$history.count - 1].ID<br /> }<br /> "PS[" + ($intCommandCount + 1).ToString() +"]>"<br /> <br />}<br /><br />Any changes to that function are visible after typing ". $profile".<br /><br /><br />Cheers,<br />Aleksandar<br />http://powershellers.blogspot.comaleksandarhttps://www.blogger.com/profile/11946050716712696119noreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-82989421226637725972006-12-30T00:48:00.000+02:002006-12-30T00:48:00.000+02:00This primitive way works fine for me:
function Re...This primitive way works fine for me:<br /><br />function Restart-PowerShell {<br />cmd /c start powershell.exe<br />exit<br />}<br /><br />Thanks,<br />Roman KuzminAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-76667096275127109002006-12-29T16:59:00.000+02:002006-12-29T16:59:00.000+02:00aleksandar
after some expermenting there is
one ex...aleksandar<br />after some expermenting there is<br />one exception for the .$profile<br />any changes to the prompt function (if exists) doesnt work, and i guess it wont work for any startup functions in the $profile.Shay Levyhttps://www.blogger.com/profile/14910279001063843963noreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-37259890815960408142006-12-29T16:27:00.000+02:002006-12-29T16:27:00.000+02:00well, this is even shorter.
thats the POWER of Pow...well, this is even shorter.<br />thats the POWER of PowerShell :-)Shay Levyhttps://www.blogger.com/profile/14910279001063843963noreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-57371648846347585652006-12-29T01:37:00.000+02:002006-12-29T01:37:00.000+02:00When I want to restart PowerShell session, I type:...When I want to restart PowerShell session, I type:<br /><br />. $profile<br /><br />It looks to me like a totally PowerShell way to restart PS engine. :-)<br /><br />Cheers,<br />Aleksandar<br />http://powershellers.blogspot.comaleksandarhttps://www.blogger.com/profile/11946050716712696119noreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-9545142497596546022006-12-29T00:22:00.000+02:002006-12-29T00:22:00.000+02:00Thank you Jeffry. I couldn't ask for more (my jaw ...Thank you Jeffry. I couldn't ask for more (my jaw hearts, it wont close). Certainly learned something new from your post.<br /><br />PowerShell is realy powerfull as its name suggests, a whole new world to explore from the VBScript side of things. Its amazing what a one-liner command can do, and there is many more.<br /><br />CheersShay Levyhttps://www.blogger.com/profile/14910279001063843963noreply@blogger.comtag:blogger.com,1999:blog-5987791209900104222.post-17232530573789979722006-12-28T20:02:00.000+02:002006-12-28T20:02:00.000+02:00Howdy $hay!
Cool stuff!
I just added your resta...Howdy $hay!<br /><br />Cool stuff! <br />I just added your restart function to my profile file. I changed it to: <br />1) use the standard VERB name (RESTART) and then defined an alias to make it easy to type.<br />2) used a here-string to make the script a little more readable.<br /><br />function Restart-PowerShell {<br /> $cmd = @"<br />'This is a temporary script to Restart a PowerShell Session<br />'Created $(Get-Date)<br />Set oShell = CreateObject("WScript.Shell") <br />WScript.Sleep 1000 <br />oShell.Run "PowerShell.exe"<br />"@<br /> Out-File -filePath $env:temp"\Restart-PowerShell.vbs" -inputobject $cmd -encoding ASCII -force<br /> WScript.exe $env:temp"\Restart-PowerShell.vbs"<br /> exit<br />}<br />Set-Alias rsps Restart-PowerShell<br /><br />Cheers!<br /><br />Jeffrey Snover [MSFT]<br />Windows PowerShell/MMC Architect<br />Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell<br />Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspxAnonymousnoreply@blogger.com