Skip to main content

Posts

Windows Services Startup Type Explained

Hi Geeks, Today I was working on a Service related script so thought of sharing some useful information related to Services Startup Type which most of the people knows but doesn’t know about the functionality. So lets begin. What are Windows Services and what they do ? Windows Services are the components or applications that starts when your computer is booted up and runs in the background mode helping the application to work smoothly and finally stops when the computer shuts down. For Example, If you want to send or receive any Fax, then the Fax service should be running in the background to perform the Fax activity. How many Service Startup Types are there and what they do ? There are 4 Service Startup Types available : 1. Automatic Explanation : Automatic Service Startup Type starts the service automatically when the system boot up is done. So if we are having a machine of less memory and there are lots of services in Automatic Startup type then your mac

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

How to customize the Powershell Prompt

By default when you open up Powershell console, you will get a screen as shown below : so today we are going to learn how to replace the PS C:\windows\system32> with any thing lets say I ♥ PowerShell.  So lets learn how to do it. STEP 1 :  We are going to modify the Powershell Profile for this. So open PowerShell as Administrator & give the below command :  Test-Path $Profile If it return True that means Powershell profile is created, if it's False then create the powershell profile by executing the below comand :  New-Item -Path $PROFILE -Type File -Force STEP 2 : Since the Profile is now created, now open the profile in Notepad i.e.  notepad $Profile STEP 3 : Now Copy-Paste the below function in that file and Save it. You can the change the content as per your choice. If any message or warning comes then change the encoding type while saving (Since I am using a Heart Shape by default ANSI Encoding will not s

How to Zip and UnZip files using PowerShell

Today we are going to Learn all about Compressing and Decompressing a file using Powershell. So lets get started. Powershell 5.0 have lots of features added to its feather. One of them is Zipping and Unzipping . Powershell 5.0 contains 2 functions by default for Zipping and Unzipping a file i.e. Compress-Archive and Expand-Archive Syntax : Zip   :   Compress-Archive -path <Source_File_Path> -DestinationPath <Destination_File> Unzip : Expand-Archive -path <Zip_file_path_to_Extract> -DestinationPath <Destination_path_where_to_Extract>   >_ If you are using Powershell version below 5.0 then you can achieve the same by Calling a Class. ZIP - FILE Add-Type -Assembly "System.IO.Compression.FileSystem" ; [System.IO.Compression.ZipFile]::CreateFromDirectory("E:\The Powershell Geek", "E:\sample.zip") UNZIP -FILE Add-Type -Assembly "System.IO.Compression.FileSystem" [System.IO.Compression.ZipFil