Adding commands in Visual Basic .NET

Encoder Data Matrix in Visual Basic .NET Adding commands

Adding commands
DataMatrix Printer In Visual Basic .NET
Using Barcode encoder for .NET framework Control to generate, create ECC200 image in VS .NET applications.
www.OnBarcode.com
Decoding Data Matrix In VB.NET
Using Barcode decoder for .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
I do see a ServerManager module in that list, so I ll start there. The next step is to get that module loaded into the shell. If it were a snap-in, I d use Add-PSSnapin, but because it s a module, I ll use Import-Module:
Generating Code 39 Extended In VB.NET
Using Barcode generation for .NET framework Control to generate, create ANSI/AIM Code 39 image in VS .NET applications.
www.OnBarcode.com
ANSI/AIM Code 128 Printer In VB.NET
Using Barcode printer for VS .NET Control to generate, create Code 128 Code Set A image in VS .NET applications.
www.OnBarcode.com
PS C:\> import-module servermanager
Data Matrix ECC200 Drawer In Visual Basic .NET
Using Barcode generator for .NET Control to generate, create DataMatrix image in .NET applications.
www.OnBarcode.com
Making UCC.EAN - 128 In VB.NET
Using Barcode printer for .NET framework Control to generate, create GS1 128 image in Visual Studio .NET applications.
www.OnBarcode.com
Now I need to see what commands were added by that module. I ll use Get-Command to do so. If this had been a snap-in, I d specify the -pssnapin parameter, but because it s a module, I ll use the -module parameter:
Barcode Encoder In Visual Basic .NET
Using Barcode generator for .NET Control to generate, create Barcode image in .NET framework applications.
www.OnBarcode.com
C 2 Of 5 Creator In VB.NET
Using Barcode generation for .NET framework Control to generate, create 2/5 Industrial image in Visual Studio .NET applications.
www.OnBarcode.com
PS C:\> get-command -module servermanager CommandType ----------Cmdlet Cmdlet Cmdlet Name ---Add-WindowsFeature Get-WindowsFeature Remove-WindowsFeature Definition ---------Add-WindowsFeature [-Na... Get-WindowsFeature [[-N... Remove-WindowsFeature [...
Printing Data Matrix 2d Barcode In Java
Using Barcode encoder for BIRT reports Control to generate, create Data Matrix ECC200 image in BIRT reports applications.
www.OnBarcode.com
Read Data Matrix ECC200 In .NET
Using Barcode scanner for .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Well that s a short list! But it seems to have the functionality I m after: commands to add, get, and remove Windows features. Hopefully that will include roles, and not just features. I always like to start with Get- commands, because they re non-destructive. I ll read the help first, just to be sure:
Encoding Barcode In None
Using Barcode creation for Office Word Control to generate, create Barcode image in Word applications.
www.OnBarcode.com
Generate Barcode In None
Using Barcode creation for Font Control to generate, create Barcode image in Font applications.
www.OnBarcode.com
PS C:\>help get-windowsfeature
Barcode Creation In None
Using Barcode creator for Online Control to generate, create Barcode image in Online applications.
www.OnBarcode.com
PDF417 Creator In Java
Using Barcode generator for Java Control to generate, create PDF-417 2d barcode image in Java applications.
www.OnBarcode.com
The help is pretty short for this one. It has an optional parameter, -Name, and a second optional parameter, -logPath. It also supports the common parameters, like all cmdlets, but I don t need to worry about any of those right now. Because I don t see any mandatory parameters, I ll run the command without any parameters at all. If I missed a mandatory parameter, the shell will prompt me anyway. The output of the command is quite long, so I ll just include a portion of it here:
Barcode Decoder In VS .NET
Using Barcode decoder for .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
EAN13 Printer In Objective-C
Using Barcode creator for iPhone Control to generate, create European Article Number 13 image in iPhone applications.
www.OnBarcode.com
PS C:\> get-windowsfeature Display Name -----------[ ] Active Directory Certificate Services [ ] Certification Authority [ ] Certification Authority Web Enrollment [ ] Certificate Enrollment Web Service [ ] Certificate Enrollment Policy Web Service [X] Active Directory Domain Services [X] Active Directory Domain Controller [ ] Identity Management for UNIX Name ---AD-Certifi... ADCS-Cert-... ADCS-Web-E... ADCS-Enrol... ADCS-Enrol... AD-Domain-... ADDS-Domai... ADDS-Ident...
Barcode Encoder In Java
Using Barcode generation for Android Control to generate, create Barcode image in Android applications.
www.OnBarcode.com
Creating Barcode In None
Using Barcode maker for Office Excel Control to generate, create Barcode image in Microsoft Excel applications.
www.OnBarcode.com
I can see which features and roles (it does include roles!) are installed, and which ones are available to install. The Name column appears to contain the official name of the role or feature. Unfortunately, I have my PowerShell window too narrow to display the full name (I did that so the output would be narrow enough to fit in this book), so I ll need to make the window a bit larger and run the command again.
Draw USS Code 128 In Java
Using Barcode encoder for Java Control to generate, create Code 128 Code Set B image in Java applications.
www.OnBarcode.com
Make EAN13 In C#.NET
Using Barcode creator for VS .NET Control to generate, create EAN13 image in VS .NET applications.
www.OnBarcode.com
Playing with Server Manager via command line!
I want to try to add a Windows feature. Scrolling down, I see that Telnet Client and Telnet Server are both available, with the official names Telnet-Client and TelnetServer. Both of those features seem pretty harmless, so I ll experiment with them. Reading the help for Add-WindowsFeature, I can see that it supports a mandatory -Name parameter that accepts more than one value. It also has an optional -Include AllSubFeature switch, and an optional -logPath parameter. Because this modifies the system, it supports -confirm and -whatif, which is nice. I also see a -Restart parameter, and I m not sure what that does. I ll need more detail:
PS C:\>help add-windowsfeature -full
The detailed help for that parameter tells me that -Restart will restart the computer automatically if restarting is required. Well, that seems like a good idea, and I m not testing on a production computer, so I ll go ahead and use that. I also see that the -Concurrent switch allows concurrent instances of the cmdlet to be running at the same time. I don t plan to do that, so I won t use that switch. The help also says that use of that switch is not recommended, which is all the more reason for me to not use it! Here we go:
PS C:\> add-windowsfeature -name telnet-client,telnet-server -restart -whatif What if: Checking if running in 'WhatIf' Mode. What if: Performing operation "Add-WindowsFeature" on Target "[Telnet Server] Telnet Server". What if: Performing operation "Add-WindowsFeature" on Target "[Telnet Client] Telnet Client". What if: This server may need to be restarted after the installation c ompletes. Success ------True Restart Needed -------------Maybe Exit Code --------Success Feature Result -------------{}
You can see that I got nervous at the last second and added -whatif. The WhatIf output is telling me that it would have added Telnet Server and Telnet Client, and that I might need a restart. Well, okay, at least now I would know to warn anyone who might be using that server, or to schedule this for off-hours. Let s try again, this time without -whatif.
Copyright © OnBarcode.com . All rights reserved.