Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

How to delete Windows 7 roaming profile using VB script

$
0
0

Hi Guys,

Hope you're all well. I'm a junior scripting guy but I only know the basics. Part of my script below will delete the user profile. e.g. if the accountname/strUserData is Joe.bloggs, it will delete his profile from location \\rcm-file\staffprof$\joe.bloggs

But how do I amend the last line of code so that it will delete Joe's Windows 7 profile which is joe.bloggs.V2 (only difference is "V2" is added at the end)?

I tried changing "strUserData" to "strUserData.v2" but this does not work.

Please may you provide me with the simple answer?
Many thanks for your help!

----------------------------------------------------------------------

' Delete userprofile if path not specified.
 strUserData = "\\rcm-file\staffprof$\" & objUser.sAMAccountName
 If (objFSO.FolderExists(strUserData) = True) Then
     wshShell.Run "CMD /K rd " & chr(34) & strUserData & chr(34) & " /s", 1, True


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>