In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you what the Windows PowerShell practice cases are, which are concise and easy to understand, which will definitely brighten your eyes. I hope you can gain something through the detailed introduction of this article.
Task 1:
Can the following command get a list of Hotfix that has been installed on all computers in a particular domain? Explain the reason
Get-HotFix-ComputerName (Get-ADComputer-Filter * | Select-Object-ExpandProperty name)
Answer:
Get-Hotfix 's-ComputerName gets the pipe type: String [], and what is passed through () is the type and String. So the command can be run and the result is correct.
-ComputerName
Specify the remote computer. The default value is the local computer.
Type the NetBIOS name, Internet Protocol (IP) address, or fully qualified domain name of the remote computer.
This parameter does not depend on Windows PowerShell remoting. Even if your computer is not configured to run remote commands, you can use the ComputerName parameter of Get-Hotfix.
Is it necessary? False
Location? Named
Default value Local computer
Do you accept pipe input? True (ByPropertyName)
Do you accept wildcards? False
(Get-ADComputer-Filter * | Select-Object-ExpandProperty name) | gm
TypeName:System.String
Task 2:
Can the following command be taken from a list of Hotfix already installed on the same computer? Explain the reason
Get-ADComputer-Filter * | Get-HotFix
Answer:
The Get-Hotfix command supports ByPropertyName parameters, and the parameters passed by Get-ADComputer-Filter * are of type string. So the command can be executed. For more information, see the following:
Help Get-Hotfix-full view the following information
-ComputerName
Specify the remote computer. The default value is the local computer.
Type the NetBIOS name, Internet Protocol (IP) address, or fully qualified domain name of the remote computer.
This parameter does not depend on Windows PowerShell remoting. Even if your computer is not configured to run remote commands, you can use the ComputerName parameter of Get-Hotfix.
Is it necessary? False
Location? Named
Default value Local computer
Do you accept pipe input? True (ByPropertyName)
Do you accept wildcards? False
Get-ADComputer-Filter * | gm views the following information:
TypeName:Microsoft.ActiveDirectory.Management.ADComputer
Name MemberType Definition
-
Contains Method bool Contains (string propertyName)
Equals Method bool Equals (System.Object obj)
GetEnumerator Method System.Collections.IDictionaryEnumerator GetEnumerator ()
GetHashCode Method int GetHashCode ()
GetType Method type GetType ()
ToString Method string ToString ()
Item ParameterizedProperty Microsoft.ActiveDirectory.Management.ADPropertyValueCollection Item (string propertyName) {get;}
DistinguishedName Property System.String DistinguishedName {get;set;}
DNSHostName Property System.String DNSHostName {get;set;}
Enabled Property System.Boolean Enabled {get;set;}
Name Property System.String Name {get;}
ObjectClass Property System.String ObjectClass {get;set;}
Task 3:
Can the following command get a list of HotFix that has been installed on the computer in the domain? Explain the reason.
Get-ADComputer-Filter * | Select-Object @ {lumped computers ComputerNameters} = {$_ .Name}} | Get-HotFix
Answer:
The String type is passed through Get-ADComputer-Filter * | Select-Object @ {lumped ComputerNameters} = {$_ .Name}}, which exactly meets the name parameter receiving requirements of Get-FoxHit. Therefore, it can be executed correctly. The specific information is as follows:
Get-ADComputer-Filter * | Select-Object @ {lumped ComputerNameName} = {$_ .Name}} | gm to view the following information
TypeName:Selected.Microsoft.ActiveDirectory.Management.ADComputer
Name MemberType Definition
-
Equals Method bool Equals (System.Object obj)
GetHashCode Method int GetHashCode ()
GetType Method type GetType ()
ToString Method string ToString ()
ComputerName NoteProperty System.String ComputerName=WIN-JFDKC82CU4F
Task 4:
Use pipe parameter binding to write a command to get a list of running processes on each computer in the domain. Do not use parentheses.
Answer:
Get-ADComputer-Filter * | Select-Object @ {lumped computer names} = {$_ .name}} | Get-Process
Answer ideas:
Because Get-ADComputer-Filter * can only pass the Sting type of the ComputerName (ad computer name in the domain) of the name attribute, but the Get-Process can only receive the String type pipe of the ComputerName attribute, we convert the name to the String type pipe that can receive the ComputerName attribute by Select-Object @ {lumped computer name = {$_ .name}}.
Task 5:
You can use parentheses instead of the pipe input method to get a list of services that have been installed on each computer in the domain.
Answer:
Get-Service-ComputerName (Get-ADComputer-Filter * | Select-Object name-ExpandProperty name)
Task 6:
Confirm that the command is working properly and explain why.
Get-ADComputer-Filter * | Select-Object @ {lumped computers ComputerNameters = {$_ .name}} | Get-WmiObject-Class Win32_BIOS
Answer:
Cannot execute properly because the Get-WmiObject command does not support pipe input. The specific information is as follows:
Help Get-WmiObject-full can view the following information:
Input
None
Input cannot be passed to Get-WmiObject through pipes.
What are the above examples of Windows PowerShell practice? have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.