In the last part of scripting series, we will make the script to be able to query remote machines, e.g. servers.
We will also check how to add parameters to the script (and configure the default value of parameter) so that user will able to pass the parameter name like in a standard PowerShell cmdlet.
Finally, we are going to format the script so that it looks more reliable and make some refactoring so that the logic is simpler.
In this lesson we are taking our script further by adding details about IP configuration and last installed hotfixes.
But it turns out, the networking information is not that shallow as it seems at the first glance – thus I’ll show you how to retrieve the information from the configuration.
We will also look on how to reuse our already created object so that we don’t need to duplicate code.
In this lesson we carry on writing the scripting by gathering requirements and putting them together as comments in code.
Then we will retrieve OS information with the help of WMI and display it on the screen with Write-Host.
Although using Write-Host is easy to use, it doesn’t really allow us to do very much e.g. we cannot export information to the CSV, therefore we change it and start using custom PSObject – that way our script will start returning information like a regular PowerShell command.
In this lesson we will be preparing our workstation for writing PowerShell scripts. We will start by enabling RSAT and then install Visual Studio Code which is a recommended and free PowerShell code editor.
We will then have a look at the basic function of VS Code and create a simple “Hello World” script.
Exercises If you haven’t followed along, you definitely would like to install VS Code and create a *.
In this lesson we will have a look on PowerShell built in security features and how it differs from e.g. BAT files.
We will then have a look how execution policy can help to control on what basis the PowerShell scripts can be executed.
At the end, we will configure some GPOs to control the execution and transcription of scripts.
In this lesson we learn how to use PowerShell to access WMI (Windows Management Instrumentation), so that we can gain often hidden or obscure information.
We will then use WMI Explorer graphical tool to ease discovering all possible classes and instances that WMI provides.
Finally, we will use WMI queries to add another level of granularity in GPO so that we can target very specific computers in it.