Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Get-LogonToken {
- [CmdletBinding()]
- param(
- [Parameter(Position = 0, Mandatory = $true)]
- [ValidateNotNullOrEmpty()]
- [string] $ServerName,
- [Parameter(Position = 1, Mandatory = $true)]
- [ValidateSet("secEnterprise", "secLDAP", "secWinAD")]
- [string] $Authentication,
- [Parameter(Position = 2, Mandatory = $true)]
- [ValidateNotNullOrEmpty()]
- [string] $Username,
- [Parameter(Position = 3, Mandatory = $true)]
- [ValidateNotNullOrEmpty()]
- [SecureString] $Password
- )
- Write-Verbose "ServerName: $ServerName"
- Write-Verbose "Authentication: $Authentication"
- Write-Verbose "Username: $Username"
- Write-Verbose "Password: $(ConvertFrom-SecureString $Password)"
- ...
- }
- [System.Management.Automation.Cmdlet(System.Management.Automation.VerbsCommon.Get, "LogonToken")]
- [OutputType(typeof(System.String))]
- public class GetLogonToken : System.Management.Automation.Cmdlet
- {
- [System.Management.Automation.Parameter(Position = 0, Mandatory = true)]
- [ValidateNotNullOrEmpty]
- public string ServerName
- {
- get { return server; }
- set { server = value; }
- }
- private string server;
- [System.Management.Automation.Parameter(Position = 1, Mandatory = true)]
- [ValidateSet("secEnterprise", "secLDAP", "secWinAD")]
- public string Authentication
- {
- get { return authentication; }
- set { authentication = value; }
- }
- private string authentication;
- [System.Management.Automation.Parameter(Position = 2, Mandatory = true)]
- [ValidateNotNullOrEmpty]
- public string Username
- {
- get { return username; }
- set { username = value; }
- }
- private string username;
- [System.Management.Automation.Parameter(Position = 3, Mandatory = true)]
- [ValidateNotNullOrEmpty]
- public SecureString Password
- {
- get { return password; }
- set { password = value; }
- }
- private SecureString password;
- ...
- }
- PS> get-logontoken -verbose
- cmdlet Get-LogonToken at command pipeline position 1
- Supply values for the following parameters:
- ServerName: server
- Authentication: sec<tab> (nothing generated)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement