Skip to content

Commit

Permalink
Fix: store password
Browse files Browse the repository at this point in the history
  • Loading branch information
rzander committed Oct 11, 2019
1 parent d788b7f commit f614b3e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions SCCMCliCtrWPF/SCCMCliCtrWPF/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public MainPage()
}
catch { }

pb_Password.Password = common.Decrypt(Properties.Settings.Default.Password, Application.ResourceAssembly.ManifestModule.Name);
Common.Hostname = tb_TargetComputer.Text.Trim();

try
Expand Down Expand Up @@ -518,9 +519,9 @@ private void bt_Connect_Click(object sender, RoutedEventArgs e)
tb_Username.Text = Environment.UserDomainName + @"\" + tb_Username.Text;
}
//Hack to handle switing over to securestrings while sccmclictrlib only takes strings. Obviously this defeats the point of SecureStrings.
string sPW = new System.Net.NetworkCredential(string.Empty, pb_Password.SecurePassword).Password;
oAgent = new SCCMAgent(sTarget, tb_Username.Text, sPW, int.Parse(tb_wsmanport.Text), false, cb_ssl.IsChecked ?? false);
sPW = "";
//string sPW = new System.Net.NetworkCredential(string.Empty, pb_Password.SecurePassword).Password;
oAgent = new SCCMAgent(sTarget, tb_Username.Text, pb_Password.SecurePassword, int.Parse(tb_wsmanport.Text), false, cb_ssl.IsChecked ?? false);
//sPW = "";
}

oAgent.PSCode.Listeners.Add(myTrace);
Expand All @@ -543,6 +544,12 @@ private void bt_Connect_Click(object sender, RoutedEventArgs e)
Properties.Settings.Default.recentlyUsedComputers.RemoveAt(10);
}

//save password
if (!string.IsNullOrEmpty(tb_Username.Text))
{
Properties.Settings.Default.Password = common.Encrypt(new System.Net.NetworkCredential(string.Empty, pb_Password.SecurePassword).Password, Application.ResourceAssembly.ManifestModule.Name);
}

Properties.Settings.Default.Save();
}
catch { }
Expand Down
2 changes: 1 addition & 1 deletion SCCMCliCtrWPF/SCCMCliCtrWPF/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5.*")]
[assembly: AssemblyFileVersion("1.0.5.3")]
[assembly: AssemblyFileVersion("1.0.5.4")]

0 comments on commit f614b3e

Please sign in to comment.