N1K Posted March 3, 2007 Posted March 3, 2007 Working perfect...please add the script to rename the file for backup purpose well.. as for previous one..B)Here it is, just drag and drop the original file on the script, it'll modify permissions for the original file and make another copy of the same file in source directory..Thank You gunsmokingman! Dim Act : Set Act = CreateObject("Wscript.Shell")Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")Dim File1, File2For Each File1 in Wscript.Arguments Act.Run("takeown /A /f " & Chr(34) & File1 & chr(34)),1,True Act.Run("icacls " & Chr(34) & File1 & chr(34) & " /grant administrators:F"),1,TrueFile2 = Split(File1,".")Set File = Fso.GetFile(File1)File.Copy(File2(0) & "_Original." & File2(1))NextBTW, how can I add now this new script to my right click selection?
gunsmokingman Posted March 3, 2007 Posted March 3, 2007 Working perfect...please add the script to rename the file for backup purpose well.. as for previous one..B)Here it is, just drag and drop the original file on the script, it'll modify permissions for the original file and make another copy of the same file in source directory..Thank You gunsmokingman! Dim Act : Set Act = CreateObject("Wscript.Shell")Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")Dim File1, File2For Each File1 in Wscript.Arguments Act.Run("takeown /A /f " & Chr(34) & File1 & chr(34)),1,True Act.Run("icacls " & Chr(34) & File1 & chr(34) & " /grant administrators:F"),1,TrueFile2 = Split(File1,".")Set File = Fso.GetFile(File1)File.Copy(File2(0) & "_Original." & File2(1))NextBTW, how can I add now this new script to my right click selection?I have made this new script into a sfx fle that extracts to the Sendto folder,this one does not create a extra copy of the fileSave As OwnTheFile_V2Dim Act : Set Act = CreateObject("Wscript.Shell")Dim File1For Each File1 in Wscript.Arguments Act.Run("takeown /A /f " & Chr(34) & File1 & chr(34)),1,True Act.Run("icacls " & Chr(34) & File1 & chr(34) & " /grant administrators:F"),1,True NextI have made this new script into a sfx fle that extracts to the Sendto folderSave as OwnTheFile_V3Dim Act : Set Act = CreateObject("Wscript.Shell")Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")Dim File, File1, File2For Each File1 in Wscript.Arguments Act.Run("takeown /A /f " & Chr(34) & File1 & chr(34)),0,True Act.Run("icacls " & Chr(34) & File1 & chr(34) & " /grant administrators:F"),0,TrueFile2 = Split(File1,".")Set File = Fso.GetFile(File1)File.Copy(File2(0) & "_Original." & File2(1))NextOwnTheFile_V3.exeOwnTheFile_V2.exe
3aces Posted March 3, 2007 Posted March 3, 2007 wooo something i was looking for, hmm isit there anyway you can take over everyfile because that would save time an effort in a sense
gunsmokingman Posted March 3, 2007 Posted March 3, 2007 wooo something i was looking for, hmm isit there anyway you can take over everyfile because that would save time an effort in a senseThis can do multiple files, but there is a limit to how many the Wscript.Arguments can handle.I believe it can handle under 24 files at a time, but do not quote me on that.
Nepali Posted March 3, 2007 Author Posted March 3, 2007 Yesss, it is working great with every files i have checked till now..if problem persist.. rectification will obviously be doneThanks Gunsmokingman for his effort for making the VBS script for sendto menu.
3aces Posted March 3, 2007 Posted March 3, 2007 hmmm 24 aint to bad.....providing you need to do a directory cheers
Nepali Posted March 4, 2007 Author Posted March 4, 2007 (edited) now you can take ownership with the registry fileWindows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\*\shell\runas]@="Gain Ownership""Extended"="""NoWorkingDirectory"=""[HKEY_CLASSES_ROOT\*\shell\runas\command]@="cmd.exe /c takeown /A /f \"%1\" && icacls \"%1\" /grant administrators:F""IsolatedCommand"="cmd.exe /c takeown /A /f \"%1\" && icacls \"%1\" /grant administrators:F"[HKEY_CLASSES_ROOT\Directory\shell\runas]@="Gain Ownership""Extended"="""NoWorkingDirectory"=""[HKEY_CLASSES_ROOT\Directory\shell\runas\command]@="cmd.exe /c takeown /A /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t""IsolatedCommand"="cmd.exe /c takeown /A /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"SHIFT + Right Click = Gain Ownership context menuownership.reg Edited March 4, 2007 by Nepali
N1K Posted March 4, 2007 Posted March 4, 2007 now you can take ownership with the registry fileWhat this reg entry gives us, right click option to take ownership or?Thx
Nepali Posted March 4, 2007 Author Posted March 4, 2007 (edited) merging this, you will get option to gain ownership for files and folderSHIFT + Rt click Edited March 4, 2007 by Nepali
Swimming_Bird Posted March 21, 2007 Posted March 21, 2007 Working perfect...please add the script to rename the file for backup purpose well.. as for previous one..B)Here it is, just drag and drop the original file on the script, it'll modify permissions for the original file and make another copy of the same file in source directory..Thank You gunsmokingman! Dim Act : Set Act = CreateObject("Wscript.Shell")Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")Dim File1, File2For Each File1 in Wscript.Arguments Act.Run("takeown /A /f " & Chr(34) & File1 & chr(34)),1,True Act.Run("icacls " & Chr(34) & File1 & chr(34) & " /grant administrators:F"),1,TrueFile2 = Split(File1,".")Set File = Fso.GetFile(File1)File.Copy(File2(0) & "_Original." & File2(1))NextBTW, how can I add now this new script to my right click selection?I have made this new script into a sfx fle that extracts to the Sendto folder,this one does not create a extra copy of the fileSave As OwnTheFile_V2Dim Act : Set Act = CreateObject("Wscript.Shell")Dim File1For Each File1 in Wscript.Arguments Act.Run("takeown /A /f " & Chr(34) & File1 & chr(34)),1,True Act.Run("icacls " & Chr(34) & File1 & chr(34) & " /grant administrators:F"),1,True NextI have made this new script into a sfx fle that extracts to the Sendto folderSave as OwnTheFile_V3Dim Act : Set Act = CreateObject("Wscript.Shell")Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")Dim File, File1, File2For Each File1 in Wscript.Arguments Act.Run("takeown /A /f " & Chr(34) & File1 & chr(34)),0,True Act.Run("icacls " & Chr(34) & File1 & chr(34) & " /grant administrators:F"),0,TrueFile2 = Split(File1,".")Set File = Fso.GetFile(File1)File.Copy(File2(0) & "_Original." & File2(1))Nexti get a permissions error when i try to run and i'm not sure how to force it to run as admin (or whatever permissions are needed)now you can take ownership with the registry fileWindows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\*\shell\runas]@="Gain Ownership""Extended"="""NoWorkingDirectory"=""[HKEY_CLASSES_ROOT\*\shell\runas\command]@="cmd.exe /c takeown /A /f \"%1\" && icacls \"%1\" /grant administrators:F""IsolatedCommand"="cmd.exe /c takeown /A /f \"%1\" && icacls \"%1\" /grant administrators:F"[HKEY_CLASSES_ROOT\Directory\shell\runas]@="Gain Ownership""Extended"="""NoWorkingDirectory"=""[HKEY_CLASSES_ROOT\Directory\shell\runas\command]@="cmd.exe /c takeown /A /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t""IsolatedCommand"="cmd.exe /c takeown /A /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"SHIFT + Right Click = Gain Ownership context menuThis doesnt allow for gaining of ownership of executeables
gunsmokingman Posted March 21, 2007 Posted March 21, 2007 I used this script to change the permission on mspaint.exeDim Act : Set Act = CreateObject("Wscript.Shell")Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject") Dim File, File1, File2 For Each File1 in Wscript.Arguments Act.Run("takeown /f " & File1),0,True Act.Run("icacls " & File1 & " /grant administrators:F"),1,True File2 = Split(File1,".") Set File = Fso.GetFile(File1) File.Copy(File2(0) & "_Original." & File2(1)) NextThe other scripts I posted where to change permission in the Program Files because of the space in the name.Before OwnTheFileAfter OwnTheFile
kartel Posted May 8, 2007 Posted May 8, 2007 (edited) I was wondering if anyone can help me with this unkown user?I would like to remove it if I could, I am the only user on this computer and the guest account is disabled.Should I run a script to take ownership of "everything" ? Edited May 8, 2007 by kartel
ashtray Posted November 14, 2008 Posted November 14, 2008 Hello,Can this script be used to open an encrypted file,if yes how to do that.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now