Skip to main content

Posts

How to close a Process run by a specific User using PowerShell

Hi Geeks, Today we are going to learn how to close or kill a process run by a specific user. Lets take an example, there are 2 different users : Admin and TestUser , Now Admin and TestUser both are logged into the same machine and performing some important task in Internet Explorer. If Admin does this : Get-Process -Name “iexplorer” It will get all the list of Internet Explorer process run by both Admin as well as TestUser. Now Admin wants to Kill or Stop the Processes which are being executed by him only. So in order to perform this task you can to use the GETOWNER Method. Full Script : Hope you all enjoyed the post, Do Like , Share and comment if you have any query related to this.

How to take Snapshot of the screen using PowerShell

Hi Guys, Welcome to the Powershell Tips and Trick section. Today one of the follower of my page The Powershell Geek asked me how to take Snapshot of the Screen using PowerShell. Before beginning let me tell you , few months back one of my friend got the same requirement from our client i.e. Login to a website, then performing certain tasks and once done take snapshots as a proof that its done successfully. So here’s the Code, its already available in Technet anyways. CODE : OUTPUT IMAGE FILE : So now you can keep the code in between your script or where ever required to take the Snapshot. Hope you all enjoyed it, do Like and Share. Source : Technet

Error Handling Tips in PowerShell

Hi Geeks, We all know the ways to handle error in scripting or programming languages i.e Try, Catch, Finally and so on. The same thing can also be done in PowerShell. Example : Try { $a = 1/0 } Catch { Write-Host “Got Exception” } But suppose your script is too long and you want your Error should be handled in such a way that you can know exactly what caused the error and at which path or line number. So to do so PowerShell provides some cool properties as given below : To Catch the Complete Exception -> $_.Exception To Find the exact Error Line number -> $_.InvocationInfo.ScriptLineNumber To only get the Exception Message -> $_.Exception.Message So will look like this : Try {           Your Script Goes here  } Catch {         $Exception = $_.Exception         $Line = $_.InvocationInfo.ScriptLineNumber         $Message = $Exception.Message } FINAL OUTPUT :                                                             Hope yo

Simplest way to Hack IBM BladeCenter Management Devices

Hi Everyone, Today I will show you the simplest way to hack IBM BladeCenter devices whose password has not been changed i.e. using the default credentials. Before beginning this tutorial you should know the default credentials used by most IBM BladeCenter devices : Username : USERID ; Password : PASSW0RD (it’s Zero not O) So lets begin, Step 1 : Click on the Link to open Shodan website -> Shodan.io About Shodan , Shodan is a very powerful tool which helps to find different vulnerable network devices and helps us to gather ample amount of information about a network. Step 2 : Once the Url is loaded, type /private/main.php in the search box which will basically help you to get multiple IBM Management console list available publically . See the image below for reference. Step 3 : It will list lots and lots of Vulnerable devices,now just try out your luck . Some or more devices might be using the default credentials. I got one!! Step 4 : Once you g

How to add multiple contents in a HTML Report using Powershell

Hey Geeks, Today em gonna show you how to add multiple contents like CPU Utilization, Disk check, Services Check etc. into a single HTML Report file. Few days back I got this requirement to add multiple contents into a single report file and once the report generation is done send a mail. So lets learn how to achieve this through Powershell. Powershell provides two properties for this PRECONTENT & POSTCONTENT ,so whatever you want to add should be kept in Pre Content and finally we can merge it using Post Content. Further you can also use Add-Content , Append or Out-File to do the same. But in this example I will show you Pre Content and Post Content. Sample 1 : How to Add contents  $Services = gwmi -Class Win32_Service -ComputerName $Server -Credential $Cred |?{$_.name -match ‘Test’} | Select Name,State | Select -last 4 | ConvertTo-HTML -AS Table -Fragment -PreContent ‘<h2>Services Report</h2>’| Out-String Sample 2 : How to Merge all the contents