Jump to content

CCleaner


oscarr

Recommended Posts

  • 6 months later...

Ditto to the above suggestion, I would like RDP session history cleaned up as well. ( So much so I am willing to provide the code, VB or C++).

Here's what I did in VB.NET 2003 (only used vb cause that is what we do at work, I'm really a C++ coder)

 

Private Function CleanRDP()

Dim regkey_RDPKey As RegistryKey

Dim string_RDPDefaultFile As String

 

'True = Write, False = Read

regkey_RDPKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Terminal Server Client\\Default", True)

If regkey_RDPKey.GetValue("MRU0") <> "" Then : regkey_RDPKey.DeleteValue("MRU0") : End If

If regkey_RDPKey.GetValue("MRU1") <> "" Then : regkey_RDPKey.DeleteValue("MRU1") : End If

If regkey_RDPKey.GetValue("MRU2") <> "" Then : regkey_RDPKey.DeleteValue("MRU2") : End If

If regkey_RDPKey.GetValue("MRU3") <> "" Then : regkey_RDPKey.DeleteValue("MRU3") : End If

If regkey_RDPKey.GetValue("MRU4") <> "" Then : regkey_RDPKey.DeleteValue("MRU4") : End If

If regkey_RDPKey.GetValue("MRU5") <> "" Then : regkey_RDPKey.DeleteValue("MRU5") : End If

If regkey_RDPKey.GetValue("MRU6") <> "" Then : regkey_RDPKey.DeleteValue("MRU6") : End If

If regkey_RDPKey.GetValue("MRU7") <> "" Then : regkey_RDPKey.DeleteValue("MRU7") : End If

If regkey_RDPKey.GetValue("MRU8") <> "" Then : regkey_RDPKey.DeleteValue("MRU8") : End If

If regkey_RDPKey.GetValue("MRU9") <> "" Then : regkey_RDPKey.DeleteValue("MRU9") : End If

 

'Delete C:\Documents and Settings\%user%\My Documents\Default.rdp

string_RDPDefaultFile = Environment.GetEnvironmentVariable("USERPROFILE") & "\\My Documents\\Default.rdp"

If System.IO.File.Exists(string_RDPDefaultFile) Then

System.IO.File.Delete(string_RDPDefaultFile)

End If

End Function 'CleanRDP()

 

 

Basically the two things you need to do... 1) delete the MRU history from the registry 2) Delete the Default.rdp file that is re-created every time you run RDP client.

 

Add this feature and maybe a couple others and I can abandone my code entirely and have just 1 cleaner ;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.