Thursday 17 August 2017

Trigger a BSOD windows server.

Hello Folks,

Here is a simple way to trigger a BSOD for demo purpose.
This would create a bug check 0xc000021a.

Note : This is for demo purpose, do not try this on production systems.

Open Task Manager and Select 'Details' Tab.
Right Click on the Columns and Click on 'Select coulmns'
 
Select 'Command Line'

Start Killing the processes in the following order, Right Click and Select





This is for demo purpose and do not try this on production systems.

Happy Scripting,

Thursday 6 July 2017

Setting Windows PowerShell Path

Hi!

Here we discuss some ways to set the PowerShell Path variable to meet our requirements.

We would look at the following scenarios.

Check the current PATH
Change the Current PATH
Append to the Current PATH
Make the PATH changes permanent.


Check the current PATH
To find out the current PowerShell Path, run the below cmd in PowerShell.

$env:Path
Change the Current PATH
This would completely change the existing PATH to the new PATH defined by you.


 $env:Path = "C:\newpath;c:\newpath64";





Append to the Current PATH
This could be the best way to consider if you would like to change the PATH, so that you may not end up breaking some dependencies that may be needed.

 $env:Path += ";C:\Program Files\NewApp\bin;C:\Program Files\NewApp\Lib"
Please pay attention to the semicolon ";" before the new PATH folders, if this is missed it could break the PATH variable syntax, the command may go through, but you may not get the desired output.



Make the PATH changes permanent. 
And finally make the PATH changes permanent for your profile when ever you open PowerShell.
By default the user profile loads this PATH,

[Environment]::SetEnvironmentVariable("Path", "C:\Program Files\NewApp\bin;C:\Program Files\NewApp\Lib" , [EnvironmentVariableTarget]::User)



The path would not change immediately, we need to re-open the session for this to work!

This would actually create a key at  HKEY_CURRENT_USER\Environment :: PATH with the Folders added. When the profile loads this would be appended to the existing PATH.

If you want to revert, delete the KEY PATH at HKEY_CURRENT_USER\Environment\

Happy Scripting!