sync
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
|
||||
<#
|
||||
.Synopsis
|
||||
Short description
|
||||
.DESCRIPTION
|
||||
Long description
|
||||
.EXAMPLE
|
||||
Example of how to use this cmdlet
|
||||
.EXAMPLE
|
||||
Another example of how to use this cmdlet
|
||||
#>
|
||||
function Add-ITDCredentialToCsv
|
||||
{
|
||||
[CmdletBinding()]
|
||||
Param
|
||||
(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]
|
||||
$VariableName
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
|
||||
$NewCredential=Get-Credential
|
||||
|
||||
$obj=[PSCustomObject]@{
|
||||
'VariableName' = $VariableName
|
||||
'Username' = $NewCredential.UserName;
|
||||
'SecureString' = $NewCredential.Password | ConvertFrom-SecureString;
|
||||
}
|
||||
|
||||
|
||||
$Obj | export-csv ($env:USERPROFILE + "\Documents\accts.csv") -Force -Append
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Short description
|
||||
.DESCRIPTION
|
||||
Long description
|
||||
.EXAMPLE
|
||||
Example of how to use this cmdlet
|
||||
.EXAMPLE
|
||||
Another example of how to use this cmdlet
|
||||
.INPUTS
|
||||
Inputs to this cmdlet (if any)
|
||||
.OUTPUTS
|
||||
Output from this cmdlet (if any)
|
||||
.NOTES
|
||||
General notes
|
||||
.COMPONENT
|
||||
The component this cmdlet belongs to
|
||||
.ROLE
|
||||
The role this cmdlet belongs to
|
||||
.FUNCTIONALITY
|
||||
The functionality that best describes this cmdlet
|
||||
#>
|
||||
function Update-ITDCredentialCsv
|
||||
{
|
||||
[CmdletBinding()]
|
||||
Param
|
||||
(
|
||||
[string[]]
|
||||
$VariableName,
|
||||
|
||||
[switch]
|
||||
$All
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
$csv = Import-Csv ($env:USERPROFILE + "\Documents\accts.csv")
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
If($All)
|
||||
{
|
||||
$vn = $csv.VariableName
|
||||
}
|
||||
ForEach($vn in $VariableName)
|
||||
{
|
||||
$cred=$null
|
||||
$cred = Get-Credential -Message ("Enter new credentials for variable named: " + $vn)
|
||||
|
||||
If($Cred)
|
||||
{
|
||||
$csv = $csv | Where-Object VariableName -ne $vn | Export-Csv ($env:USERPROFILE + "\Documents\accts.csv") -Force
|
||||
Add-ITDCredentialToCsv -VariableName $vn -Credential $cred
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes old versions of ITD modules
|
||||
.DESCRIPTION
|
||||
Long description
|
||||
.EXAMPLE
|
||||
Example of how to use this cmdlet
|
||||
.EXAMPLE
|
||||
Another example of how to use this cmdlet
|
||||
.INPUTS
|
||||
Inputs to this cmdlet (if any)
|
||||
.OUTPUTS
|
||||
Output from this cmdlet (if any)
|
||||
.NOTES
|
||||
General notes
|
||||
.COMPONENT
|
||||
The component this cmdlet belongs to
|
||||
.ROLE
|
||||
The role this cmdlet belongs to
|
||||
.FUNCTIONALITY
|
||||
The functionality that best describes this cmdlet
|
||||
#>
|
||||
Reference in New Issue
Block a user