The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
I need 2 powershell scripts and then the assignment I have attached
I need the knock knock joke powershell script and the 3 amigos script.
Then I have attached the assignment I really need. I will pay 60 bucks
PowerShell Script that configures your PowerShell Environment.
-----------------------------------------------------------------------------------------------------------------------------------------Part 1:
In this part of the script you will create a warning message to be displayed on your local host computer
whenever a user opens powershell. (Reference page 57-59 of your textbook)
1. Create a script call Microsoft.PowerShell_profile.ps1
a. NOTE: The script will need to be saved into the
C:\Windows\system32\WindowsPowerShell\v1.0 folder on the computer you want the
profile to apply to.
2. Enter the Following into your script
# PART 1
# create an object variable, by using the Get-Host cmdlet and its UI property to access the RawUI
property, which can be used to access and configure console properties.
$PSConsoleWindow = (Get-Host).UI.RawUI #set the background and foreground color, and change PS console window title
$PSConsoleWindow.BackgroundColor = “Yellow”
$PSConsoleWindow.ForegroundColor = “Red”
$PSConsoleWindow.WindowTitle = “(your name)’s Customized PowerShell Console Session” # create an object reference variable , by using the WindowSize property, which can be used to set the
windowsize properties width and height.
$PSConsoleSize = $PSConsoleWindow.WindowSize $PSConsoleSize.Width = 80
$PSConsolesize.Height = 25
#reassign the $PSConsoleSize settings to the the $PSConsoleWindow objects WIndowSize property.
$PSConsoleWIndow.WindowSize = $PSConsoleSize
Clear-host 3. save your script, close any open PowerShell windows, and then open a new instance of
PowerShell to verify: -------------------------------------------------------------------------------------------------------------------------------------Part 2: In this part of the script you will add a warning message to be displayed on your local host computer
whenever a user opens PowerShell. (Reference page 92-94 of your textbook)
1. Modify your script called Microsoft.PowerShell_profile.ps1 . Append the following text into
your profile script:
#part 2
#create an alias for the Write-Host command
Set-Alias ds Write-Host #clear the console screen
Clear-Host #Display Warning message
ds
ds “--------------------------------------------------------------------------------“
ds “This computer and network are private.”
ds “Unauthorized access is prohibited!”
ds “For authorization contact your name at 406-555-1234”
ds #prompt user acknowledgment of warning message:
ds “By pressing ENTER, you acknowledge that you are authorized“
ds “to use PowerShell on this computer: ‘$env:COMPUTERNAME’ “
ds “and agree to the security policy”
ds “--------------------------------------------------------------------------------“
Read-Host “press enter” #reset background and text colors
$PSConsoleWindow.BackgroundColor = “Black”
$PSConsoleWindow.ForegroundColor = “White”
Clear-Host 3. save you script, close any open PowerShell windows, and then open a new instance of PowerShell to
verify your message displays After pressing enter: