diff --git a/SCCMCliCtrWPF/SCCMCliCtrWPF/MainPage.xaml.cs b/SCCMCliCtrWPF/SCCMCliCtrWPF/MainPage.xaml.cs index 39a076d..aab2516 100644 --- a/SCCMCliCtrWPF/SCCMCliCtrWPF/MainPage.xaml.cs +++ b/SCCMCliCtrWPF/SCCMCliCtrWPF/MainPage.xaml.cs @@ -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 @@ -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); @@ -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 { } diff --git a/SCCMCliCtrWPF/SCCMCliCtrWPF/Properties/AssemblyInfo.cs b/SCCMCliCtrWPF/SCCMCliCtrWPF/Properties/AssemblyInfo.cs index d633cb0..5a9e0e7 100644 --- a/SCCMCliCtrWPF/SCCMCliCtrWPF/Properties/AssemblyInfo.cs +++ b/SCCMCliCtrWPF/SCCMCliCtrWPF/Properties/AssemblyInfo.cs @@ -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")]