Nagpur Cha SysAdmin is a blog about tips, tricks, free PowerShell scripts, free tools and easy solutions for various day to day and advance tasks of system administrators.

Search This Blog

Monday, 9 October 2017

How to show Powershell Output block on blogger blog as it is


Hey Guys,

How are you doing? seems like I missed posting this article before posting few others…
Anyways here it is…

In my previous article in same category “Code snippets”, we have discussed how to insert code block snippets inside blogger posts. However, this post will be like a dessert after dinner as we are going to discuss how to insert output result of your code block just like the actual output of PowerShell.


When we run Get-Service cmdlet in PowerShell we get an output as shown in below snap.





As the above representation of the actual output is in the form of its cropped image where we cannot select any text of it.
Below is a trick based on LazyWinAdmin blog article which will allow you to share your output on your blog posts like the actual PowerShell output.



Steps
  1. Go to blogger dashboard
  2. Click theme
  3. Click Customize
  4. In the Blogger Template Designer, Click Advanced
  5. Click on Add CSS
Copy the following CSS code and click Apply to Blog to finish.


CSS Code
.PoshConsole {
  color: #EEEDF0;
  background-color: #012456;
  font-family: consolas;
  font-size: 0.99em;
  padding: .25em;
  padding-top: 0.25em;
  padding-right: 0.25em;
  padding-bottom: 0.25em;
  padding-left: 0.25em;
}



Now insert you copied output to the blog post as shown below
All you need to do now is add the following line with your code in HTML mode.
 


<pre class="PoshConsole">PS E:\> Get-Service
Status   Name               DisplayName                          
------   ----               -----------                          
Stopped  AJRouter           AllJoyn Router Service               
Running  ALG                Application Layer Gateway Service    
Running  AppHostSvc         Application Host Helper Service      
Stopped  AppIDSvc           Application Identity                 
Running  Appinfo            Application Information              
Stopped  AppMgmt            Application Management               
Stopped  AppReadiness       App Readiness                        
Stopped  AppXSvc            AppX Deployment Service (AppXSVC)    
Stopped  aspnet_state       ASP.NET State Service                
Running  AudioEndpointBu... Windows Audio Endpoint Builder       
Running  Audiosrv           Windows Audio                        
Running  AVP                Kaspersky Endpoint Security Service  
Running  avpsus             Kaspersky Seamless Update Service    
Stopped  AxInstSV           ActiveX Installer (AxInstSV)         
Stopped  BDESVC             BitLocker Drive Encryption Service   
Running  BFE                Base Filtering Engine            
</pre> 



With above steps, you will get result on your blog post as below.
PS E:\> Get-Service

Status   Name               DisplayName                           
------   ----               -----------                           
Stopped  AJRouter           AllJoyn Router Service                
Running  ALG                Application Layer Gateway Service     
Running  AppHostSvc         Application Host Helper Service       
Stopped  AppIDSvc           Application Identity                  
Running  Appinfo            Application Information               
Stopped  AppMgmt            Application Management                
Stopped  AppReadiness       App Readiness                         
Stopped  AppXSvc            AppX Deployment Service (AppXSVC)     
Stopped  aspnet_state       ASP.NET State Service                 
Running  AudioEndpointBu... Windows Audio Endpoint Builder        
Running  Audiosrv           Windows Audio                         
Running  AVP                Kaspersky Endpoint Security Service   
Running  avpsus             Kaspersky Seamless Update Service     
Stopped  AxInstSV           ActiveX Installer (AxInstSV)          
Stopped  BDESVC             BitLocker Drive Encryption Service    
Running  BFE                Base Filtering Engine             


Kindly Share your experience in comment section with my blog/post if it did help you !!

Stay Blessed!!  
Thank You!!

1 comment:

Comments system