It’s not something everyone will use, but if you have a library of VHD files used as templates for quickly deploying VMs or even have VMs you only spin up for certain situations, this could be a major win. The second important thing that Get-Help points out about Get-WindowsFeature is that the -Vhd parameter can have it directly evaluate Virtual Machine (VM) hard drives (specifically VHD or VHDX files used by Hyper-V) without having to bring them online. (Typically, you’d prompt for a new credential and store it in a variable-a unit of memory for storing values-like: $cred = Get-CredentialĪnd then pass the stored credential to the cmdlet using -Credential $cred.) Note that credentials come into play here, so you’ll either need to be running PowerShell as a user with the appropriate permissions on the remote server or you can pass the -Credential parameter to achieve the same result. There are ways to work around this limitation, which we’ll get to later.)Īpplying this to the earlier example of using Hyper-V as a parameter with Get-WindowsFeature, if you want to check whether any Hyper-V features are installed on a remote server, you could execute Get-WindowsFeature Hyper-V -ComputerName RemoteServer01Īnd get an answer fairly quickly. (The Get-Help output for the Get-Process cmdlet would show the format, which would prompt a list/array of strings. Many cmdlets let you specify multiple computers using this method, but Get-WindowsFeature supports only one as indicated by the -Computername parameter showing a format of. First is the -Computername parameter, which is fairly ubiquitous in PowerShell and executes the command against a remote computer rather than the computer with the open PowerShell window. The output at the left identifies a couple of important things about Get-WindowsFeature. (A switch is a parameter that doesn’t require any additional input.) Will provide a handful of sample use cases with the necessary parameters and syntax already completed as below simply copy, paste, and edit the parameters to suit your needs. Adding the -Examples switch: Get-Help Get-WindowsFeature -Examples The output provides an overview of what GetWindowsFeature does, the syntax for its use, and any parameters that are available. To get an overview of the purpose of GetWindowsFeature, you can use the Get-Help cmdlet with GetWindowsFeature as the first parameter. If you want to find all Hyper-V-related features, you can add an asterisk for a wildcard search: Get-WindowsFeature Hyper-V*. Any text typed immediately after the cmdlet-called a parameter in PowerShell-will be used to search against the feature name and will filter the list of roles and features.įor example, Get-WindowsFeature Hyper-V will return the Hyper-V server role from the list and indicate whether the role is installed or available for installation. Fortunately Get-WindowsFeature provides an easy way to focus on specific sets of features.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |