PowerShell –SQL Automate Tutorial-6

Disclaimer:Hey Guys, this post contains affiliate link to help our reader to buy best product\service for them. It helps us because we receive compensation for our time and expenses.

InterServer Web Hosting and VPS

Scenario: PS is most powerful and very helpful tool for windows and SQL server administrator and automation. So its today need to learn at least basic of some PS cmdlets.

In this series of tutorial, we will only walk through some of the basis and need to know cmdlets which will helps us in future in order to manage our SQL server.

For more details, you can google and look for good site.

Note:- Please click here to get 5th part of PowerShell –SQL Automate tutorial.




To get more information about PowerShell cmdlets, you can refer this link.

In this tutorial, we will walk through PowerShell Write-host cmdlets.

PowerShell Write-Host

The PowerShell Write-Host cmdlet is used to write the customized output to a host. We can specify the text color by using the -foreground parameter, and by using the -background parameter, we can specify the background color.

Syntax
Write-Host   
[[-Object] <Object>]   
[-NoNewline]   
[-Separator <Object>]   
[-ForegroundColor {Black | DarkBlue | DarkGreen | DarkCyan | DarkRed | DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red | Magenta | Yellow | White}]   
[-BackgroundColor {Black | DarkBlue | DarkGreen | DarkCyan | DarkRed | DarkMagenta | DarkYellow | Gray | DarkGray | Blue | Green | Cyan | Red | Magenta | Yellow | White}]   
[<CommonParameters>]  
Parameters

-Object

The -Object parameter is used to display the objects in the host.

-NoNewline

The -NoNewline parameter specifies that no spaces or newlines are inserted between the output strings, and there is no newline which is added after the last output string.

-Separator

The -Separator parameter is used to specify a separator string which is inserted between the objects displayed by the host.

-ForegroundColor

The -ForegroundColor parameter is used to specify the color of the text

Follow this link to know possible acceptable color.

Example:-

Knowledge is lost without putting it into practice; a man is lost due to ignorance; an army is lost without a commander; and a woman is lost without a husband

Chanakya

One thought on “PowerShell –SQL Automate Tutorial-6

  1. Pingback: PowerShell –SQL Automate Tutorial-7 – ADsql- An Independent DB Consultant

Comments are closed.