-
Notifications
You must be signed in to change notification settings - Fork 54
/
unattendedUnmapConfigurator.ps1
55 lines (54 loc) · 3.13 KB
/
unattendedUnmapConfigurator.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#For use with the Unattended UNMAP Script found here: https://github.com/codyhosterman/powercli/blob/master/unmapsdkunattended.ps1
<#*******Disclaimer:******************************************************
This scripts are offered "as is" with no warranty. While this
scripts is tested and working in my environment, it is recommended that you test
this script in a test lab before using in a production environment. Everyone can
use the scripts/commands provided here without any written permission but I
will not be liable for any damage or loss to the system.
************************************************************************#>
write-host ' __________________________'
write-host ' /++++++++++++++++++++++++++\'
write-host ' /++++++++++++++++++++++++++++\'
write-host ' /++++++++++++++++++++++++++++++\'
write-host ' /++++++++++++++++++++++++++++++++\'
write-host ' /++++++++++++++++++++++++++++++++++\'
write-host ' /++++++++++++/----------\++++++++++++\'
write-host ' /++++++++++++/ \++++++++++++\'
write-host ' /++++++++++++/ \++++++++++++\'
write-host ' /++++++++++++/ \++++++++++++\'
write-host ' /++++++++++++/ \++++++++++++\'
write-host ' \++++++++++++\ /++++++++++++/'
write-host ' \++++++++++++\ /++++++++++++/'
write-host ' \++++++++++++\ /++++++++++++/'
write-host ' \++++++++++++\ /++++++++++++/'
write-host ' \++++++++++++\ /++++++++++++/'
write-host ' \++++++++++++\'
write-host ' \++++++++++++\'
write-host ' \++++++++++++\'
write-host ' \++++++++++++\'
write-host ' \------------\'
write-host 'Pure Storage FlashArray VMware ESXi UNMAP Credential Configurator v1.0'
write-host '----------------------------------------------------------------------------------------------------'
write-host ''
write-host ''
write-host "Please choose a directory to store the encrypted credential files"
function ChooseFolder([string]$Message, [string]$InitialDirectory)
{
$app = New-Object -ComObject Shell.Application
$folder = $app.BrowseForFolder(0, $Message, 0, $InitialDirectory)
$selectedDirectory = $folder.Self.Path
return $selectedDirectory
}
try
{
$credentialfolder = ChooseFolder -Message "Please select a credential file directory" -InitialDirectory 'MyComputer'
$fapath = join-path -path $credentialfolder -childpath "faUnmapCreds.xml"
$Host.ui.PromptForCredential("Need FlashArray Credentials", "Please enter your FlashArray username and password.", "","") | Export-Clixml -Path $fapath
$vcpath = join-path -path $credentialfolder -childpath "vcUnmapCreds.xml"
$Host.ui.PromptForCredential("Need vCenter Credentials", "Please enter your vCenter username and password.", "","") | Export-Clixml -Path $vcpath
write-host "Created credential files successfully"
}
catch
{
write-host $Error[0]
}