PowerShell day 5
Hey guys???? its another day of our PowerShell lesson ,today we will be talking about PowerShell scripts and how to manage cloud with PowerShell.
PowerShell scripts
As we all know Visual Code is one of the best programs used to run PowerShell. PowerShell is a set of codes that performs a specific task. It is also a PowerShell file that contains PowerShell logic. You should attempt writing your first script. Just think about processes you perform often at work that requests a lot of manual steps.
Steps to create a script in PowerShell (Windows 10)
Visual Studio Code (VS Code) is a free and extensible cross-platform code editor that allows you to edit virtually any programming language. And when adding the PowerShell extension, you get an interactive scripting editing experience that even includes IntelliSense (code-completion) support. The PowerShell ISE application will continue to be available, but the Visual Studio Code with the PowerShell extension is meant to be the new default experience. Also, consider that the legacy experience won't get any new features and doesn't support PowerShell 7 or higher releases.
To install Visual Basic Code on Windows 10, use these steps:
1. Open the Visual Studio code editor
2. Click the?Windows?button to download the installer.
3. Double-click the installer to begin the installation process.
4. Confirm the agreement term.
5.Click the?Next?button.
6.Confirm additional tasks as necessary.
7.Click the?Next?button again.
8.Click the?Trust Workspace & Install?button. After you complete the steps, you can start writing PowerShell scripts using Visual Studio Code on Windows 10.
Creating and saving PowerShell scripts: Creating a PowerShell script is just saving your PowerShell commands with the math.ps1 file. Go ahead and copy the simple code and save it as a math.ps1.
PowerShell execution policy
Depending on the configuration of your device and environment you may not be able to run PowerShell scripts. There are execution policies concerning PowerShell that will need to adjust.
To determine the current execution policy run the following cmdlet in diagram 2 and 3.
Script Scope
Are you aware that when you run a script by specifying the ps1 file ,that script does not run in the scope of the current session. you will not have access to the variables and information in your current session. You can see this in action for yourself. Open a PowerShell window and run the?math.ps1?script from above. After it runs, try typing?$total?in your PowerShell session. It will not return anything. This is because?math.ps1?was run under the scope of a different PowerShell session. Once the script completed, so did that session. I guess you want to write your first script. Just break the objective into manageable chunks.
Manage cloud with PowerShell
Cloud computing is the on-demand availability of computer system resources especially data storage (cloud storage) and computing power, without direct active management by the user. Cloud computing gives you access to storage ,files, software and servers through internet-connected devices ,computer, smart phones ,tablets and wearable. Cloud technology has experiences explosive growth over the last several years. Since cloud was introduces rapid provisioning ,cost efficiency ,enhanced security and performance .
Did you know that Amazon Web Services(AWS) is the largest cloud provider .AWS tool is essentially just a module or collection of modules that enable your existing PowerShell to manage the Amazon Web Service Cloud.
领英推荐
Managing AWS cloud with PowerShell
With your PowerShell session authenticated to your AWS account you might be thinking, now what? The answer is the possibilities are nearly limitless. Using PowerShell the entire power of the AWS cloud is at your fingertips.
PowerShell Azure
Azure PowerShell collects telemetry data by default. Microsoft aggregates collected data to identify patterns of usage to identify common issues and to improve the experience of Azure PowerShell. Microsoft Azure PowerShell does not collect any private or personal data. For example, the usage data helps identify issues such as cmdlets with low success and helps prioritize our work. While we appreciate the insights this data provides, we also understand that not everyone wants to send usage data.
"Trust yourself that you can do it and get it " - Baz Luhrmann
#educ8africa ghana
Information Technology Management
2 年Irène Kinsy Thanks
Passionate Cybersecurity Enthusiast | Crafting a Secure Digital Future
2 年????