Add scripts
This commit is contained in:
parent
422934aef7
commit
350807c951
30 changed files with 574 additions and 0 deletions
22
Scripts/Get-CredToXML.ps1
Normal file
22
Scripts/Get-CredToXML.ps1
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
function Get-CredToXML {
|
||||
param (
|
||||
$CredFile = "$home\Documents\cred.xml"
|
||||
)
|
||||
if (Test-Path $CredFile) {
|
||||
Import-Clixml -path $CredFile
|
||||
}
|
||||
elseif (!(Test-Path $CredFile)) {
|
||||
$Cred = Get-Credential -Message "Enter credential"
|
||||
if ($Cred -ne $null) {
|
||||
$Cred | Export-CliXml -Path $CredFile
|
||||
$Cred
|
||||
}
|
||||
else {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# $Cred = Get-CredToXML
|
||||
# $Login = $Cred.UserName
|
||||
# $PasswordText = $Cred.GetNetworkCredential().password
|
||||
Loading…
Add table
Add a link
Reference in a new issue