Can't hide Hidden folders and files.

Hi All,
This past weekend I transferred my OS and apps to a newly installed SSD drive.
During the process I had to move some files around in order to get The OS and Apps on the SSD.
I used a technique that utilizes the Terminal and the chflags command.
My issue is now I can not hide the files and folders that are usually hidden.
I can't remember the exact method I used to unhide hidden folders and files. I can't even find a reference to it in my web browsers history.
I have searched on the web for solutions along these lines:
defaults write com.apple.finder AppleShowAllFiles -boolean FALSE ; killall Finder
chflags hidden
sudo chflags hidden
But none of these approaches have worked.
I have downloaded Onyx, TinkerTool and Show Hide Invisible Files.
I have used them as best I understand to hide the normally hidden files and folders, but nothing has worked.
Any Command Line gurus out there have any suggestions?
Many Thanks in Advance!
Tem

Triple-click anywhere in the line below on this page to select it:
~/Library/Preferences/com.apple.finder.plist
Right-click or control-click the highlighted line and select  
          Services ▹ Show Info in Finder (or just Show Info)
from the contextual menu.* An Info dialog should open.
☞ Does the dialog show "You can read and write" in the Sharing & Permissions section?
☞ In the General section, is the box labeled Locked checked?
☞ What is the Modified date?
If you don't have read and write access to the item, change the settings as directed here. Note, however, that if one file has wrong access settings, most likely others do as well. If the item is locked, unlock it.
*If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination command-C. Open a TextEdit window and paste into it (command-V). Select the line you just pasted and continue as above.

Similar Messages

  • Showing/ Accessing hidden folders and files

    Hi,
    In order to reinstal an application (Trend Micro sync), I first need to remove a selecion of hidden files that I used on Leopard to find under the account/library/ Application support.... They are "hidden folders and files". Under Lion I don't know how to set the finder to show them to me, especially as I don't remember the name !
    Thanks for your help
    Stéphane

    [What Should Be Invisible Isn't|http://www.pinkmutant.com/articles/toovisible.html]
    [Invisible Finder 2.1|http://www.versiontracker.com/php/dlpage.php?id=9867&db=mac&pid=7198&kind=& lnk=http%3A%2F%2Fwww.ragedownload.com%2Finvisfinder.sit] lists just invisible files. JuhOS X lists all files and flags invisible ones. Some applications let you toggle invisibility, though this doesn't take effect until you restart the Finder.
    The other thing to do is verify your drive with Disk Utility. Your computer isn't likely to be suddenly deciding to hide files, but aberrant behavior could be an indicator of a corrupt drive.

  • How can I explore the folders and files on my phon...

    How can I explore the folders and files on my phone from my phone (lumia 920)?

    the file system including all the data pertaining to that partition is closed on windowsphone8, unlike that of Symbian.
    the only part you will be able to see is what you would see in this post here: /t5/Nokia-Lumia/Transfer-file-for-920/m-p/1605954#M24335
    the rest is locked unless you have developer access, and even then not much as you would just use the SDK to make your applications.

  • Hidden folders and files with random character filenames

    You could try media info to see if that tells you any different - be sure to decline the stupid addons included
    https://mediaarea.net/en/MediaInfo

    Recently I noticed several hidden folders with random character names and each of those folders has 5 files in them with randomly named files. These are tiff, png, bmp, and docx files. I copied the folder to virtual machine removed from the network to inspect them, but they can not be opened as it says files appears damaged or corrupt. They appear to be benign as I ran two full system virus scans (including malwarebytes), but really bothers me how they got there in the first place. The owner says local administrators. They were found on the root of the C: drive and in documents, pictures, music, and video of the user profile. I attached a picture to help understand what they look. They are different than other examples I have seen when I attempted to google my answer. Thanks in advance!
    This topic first appeared in the Spiceworks Community

  • Hidden folders and files.  Why? and how can I unhide them?

    I have a file folder that is suddenly hidden from Finder. It was fine last week and the previous year or two that I have accessed that folder. I can still find and open it using Spotlight, and I see the correct path displayed, but when I navigate that path in Finder, the files/folders are not visible.
    Why is it hiding? None of the discussions I've read about hidden files helped explain or solve the issue. It happened with an Excel spreadsheet file a few months ago, and I was able to unhide that one with the "Hidden Files" widget. Do I really need to venture into Terminal?
    I'm on an iMac G5 with OSX 10.4.11.

    [What Should Be Invisible Isn't|http://www.pinkmutant.com/articles/toovisible.html]
    [Invisible Finder 2.1|http://www.versiontracker.com/php/dlpage.php?id=9867&db=mac&pid=7198&kind=& lnk=http%3A%2F%2Fwww.ragedownload.com%2Finvisfinder.sit] lists just invisible files. JuhOS X lists all files and flags invisible ones. Some applications let you toggle invisibility, though this doesn't take effect until you restart the Finder.
    The other thing to do is verify your drive with Disk Utility. Your computer isn't likely to be suddenly deciding to hide files, but aberrant behavior could be an indicator of a corrupt drive.

  • My macbook keeps locking all of my folders and files, even when I try unlocking them myself in Get Info and disabling autolocking in Time Machine, how can I stop the locking as well as unlock my files?

    My macbook keeps locking all of my folders and files, even when I try unlocking them myself in Get Info and disabling autolocking in Time Machine, how can I stop the locking as well as unlock my files?

    Managed to solve this myself. Just went to properties > hidden.

  • MY system folder, including hidden folders are littered with duplicate folders and files with the suffix (from old Mac) How do I remove them

    I have a Macbook Pro running Leopard 10.5.8. I had a problem with my my operating system (my fault, I moved a file I shoudnt have) couldnt boot up but was able to boot up from a backup. I managed to repair my original system except now all the system folders, including hidden folders are littered with duplicate folders and files with the suffix (from old Mac).  For the most part the dupes are an exact copy, but not always.  I want to remove them to free up space and cant imagine duplicate folders in the /system/library are not hindering my computer. But I dont know where to start and am afraid of doing irreparable damage. Any ideas

    pacull,
    Use iCal>View>Show Notifications to choose what to do with the notification.

  • After Photoshop Elements quit working for the second time in three months, I uninstalled it and now cannot get it to reinstall from the disc. Nothing happens when I insert the disc. All I can do is look at the folders and files and see nothing that tells

    After Photoshop Elements quit working for the second time in three months, I uninstalled it and now cannot get it to reinstall from the disc. Nothing happens when I insert the disc. All I can do is look at the folders and files and see nothing that tells me how to start the installation. Clicking "open with Auto play" gives me irrelevant options, view photos, share, etc. I'm running Windows 8. This program has worked, although buggy, for the past year.

    reinstall by clicking setup on your disk or downloading and installing,
    Downloads available:
    Suites and Programs:  CC | CS6 | CS5.5 | CS5 | CS4 | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  12 | 11, 10 | 9,8,7
    Lightroom:  5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • Time Machine - can it backup selected folders and/or files?

    Hello All,
    I have searched for an answer to this question, but found no answer.
    Can I select certain files or folders in TimeMachine to backup, instead of having to backup a whole disk (only).
    I am sure I am not the only person with this question, but I could not find a post on this topic.
    Thanks for any information,
    eholz1

    Time Machine is designed as a simple backup system to handle an entire system, and provides only limited flexibility. You can exclude things from Time Machine backups, but there's no way to start with nothing being selected and add just specific folders. If backing up only certain folders and files what you really wish to do, I'd suggest you look into a different backup solution, of which there are many.
    Regards.

  • Formatted HD, but have backup of all the folders and files of Firefox. How can I restore everything, including plugins, bookmarks and saved settings?

    I have formatted my computer's HD because of a problem with Windows 7, the thing is that Windows 7 didn't start, so I couldn't backup my Firefox settings, bookmarks, plugins, themes, personas and etc. the right way.
    I also don't have a Firefox Sync account.
    What I do have are all the folders and files of Firefox, because I just created a new partition and installed Windows 7 again, what I'm having trouble is finding a way (if there's any) to restore everything from my previous installation to the new one.
    I have searched for days on both Google and on te Firefox forum with no success, the only questions I found are about restoring a profile, but what I'm trying to do is the same thing that the Firefox add-on " FEBE " does, which is restoring everything to the previous configuration.
    Here's alink to the add-on: https://addons.mozilla.org/pt-br/firefox/addon/febe/
    I have tried copying, pasting and overwritting from the " .default " folder to my new installation of Firefox (yes, Firefox was closed), but when I opened it again, nothing was restored.
    I every single folder and file Firefox ever created on my computer, this includes the installation folder (at Program Files), the profile (.default at AppData) folder, the Mozilla folder (ProgramData) and the Mozilla Firefox folder (also at AppData).
    I also had the FEBE add-on installed, but like stated before, unfortunately I couldn't start Windows 7, forcing me to create a new partition to install a new copy of the OS.
    Thanks in advance.
    PS. Sorry if I made the text too long and/or if I mentioned the same things twice, just trying to be thorough.

    Hi Sdarts,
    I apologize for the delay in replying to your question, and I am sorry to hear that you are having issues restoring your Firefox user data.
    Please see the following article, which explains how to restore your Firefox user data using a previously backed up Profiles folder, which seems to apply to your situation:
    * [https://support.mozilla.org/en-US/kb/back-and-restore-information-firefox-profiles Backup and Restore information from Firefox Profiles]
    Please let us know if this solves your problem or if you have any questions.
    Thanks!!
    - Ralph

  • Why can't I drag and drop folders and files in finder?

    I was sorting out my folders and files when all of a sudden it stopped letting me drag and drop.
    I didn't go on 'Show View Options'.
    I've also checked my trackpad settings and all is as should be.
    Any idea what's up?
    Thanks in advance for any suggestions.

    all of a sudden it stopped letting me drag and drop.
    What do you mean by this?  What symptoms are being displayed?  Are you getting an error message when you try to drag and drop?  We need more information to help you diagnose the problem.

  • Finder not able to view folders and files on EHD after updating to OS X 10.9.4

    I can see still see 'Hitachi' in the 'Devices' Sidebar, but I am not able to view folders and files on this Hitachi XL2000 2TB FAT32 Hard Drive (EHD) that is USB connected to the iMac below.
    Late 2013 Apple iMac (27-inch Display 2560 x 1440), 3.4GHz Quad-core Intel Core i5, Turbo Boost up to 3.8GHz, 8GB 1600MHz DDR3 SDRAM - 2X4GB, 512GB Flash Storage, NVIDIA GeForce GTX 775M 2GB GDDR5, Magic Trackpad, Apple Wireless Keyboard and OS X 10.9.4 Mavericks
    All was fine until I updated from OS X 10.9.3 to 10.9.4 earlier this week, so now when I double-click on 'Hitachi' it just loads and loads with nothing happening and never displays the folder and file contents of the EHD.
    Also, confirmed that Hitachi EHD has been removed from Spotlight indexing per System Preferences > Privacy > + > Hitachi and it was so this does not seem to be an indexing issue.
    I have used OnyX and Apple Disk Utilities unsuccessfully to try and fix this problem.
    Interestingly, Backblaze online backup still sees the EHD and connecting this EHD to a Win 8.1 PC also sees the EHD.
    Further, I ran the commands below in 'Terminal' to make sure the drive was visible and got the following results which shows that the EHD is not hidden.
    iMac:Applications john$ chflags nohidden /Volumes/Hitachi/
    iMac:Applications john$ GetFileInfo /Volumes/Hitachi/
    directory: "/Volumes/HITACHI"
    attributes: avbstclinmedz
    modified: 07/10/2014 23:26:44
    Finally, I installed XtraFinder and am still not able to see the contents of the EHD, but when I installed OmniDiskSweeper I can navigate the EHD folder tree with no problems and can see the contents of the EHD, but when I try and open up a file it opens Finder which loads and loads and nothing happens.

    Apple Support was quite helpful, but in the end I will wait to do a clean install of OS X Yosemite which is due in the Fall and not try and fix OS X 10.9.4 Mavericks.
    It turns out that I run backups on my '/Users/john/Library' and the size of this folder before the 10.9.4 update was 1.07 GB and after the update it is 806.9 MB which is baffling, but in the end all of these problems should be resolved with a clean install of OS X Yosemite.
    One lesson learned for the future is that I will wait on installing an update until it has been in the wild for awhile as a quick OS X Mavericks Finder Problem search and similar searches show there could be an issue.

  • Taking Ownership of folders and files

    So I am doing what sure seems like way too much work to do something rather simple in GUI. There seem to be many topics on this and I base my code off of their results, but it isn't working entirely. Hopefully an easy one for you folks!  I am trying
    to take ownership of a path, be it a file or folder.  I DO NOT want to use a separate module like PSCX as not all machines will have the module.
    I created a function based off the code I found at the end of
    http://social.technet.microsoft.com/Forums/en-US/87679d43-04d5-4894-b35b-f37a6f5558cb/ that I can pass a path to singularly or I was hoping to be able to pipe Get-ChildItem to it.  When I do "Get-ChildItem -Path D:\Permissions\TopFolder -Recurse
    -Force | Take-Ownership" it seemed to work, but then I noticed it only seems to work going one layer deep. The text output for troubleshooting shows it recursing all the way through, but yet Owner is not being set all the way down.
    Folder layout:
    D:\Permissions\TopFolder
    D:\Permissions\TopFolder\FirstFolder
    D:\Permissions\TopFolder\FirstFile.txt
    D:\Permissions\TopFolder\FirstFolder\SecondFolder
    D:\Permissions\TopFolder\FirstFolder\SecondFile.txt
    D:\Permissions\TopFolder\FirstFolder\SecondFolder\ThirdFolder
    D:\Permissions\TopFolder\FirstFolder\SecondFolder\ThirdFile.txt
    Function Take-Ownership {
    [CmdletBinding(DefaultParameterSetName=”Set01”)]
    Param(
    [parameter(Mandatory=$true,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True,Position=1,ParameterSetName='Set01')]
    [string]$Path,
    [parameter(Mandatory=$true,ValueFromPipelinebyPropertyName=$True,ParameterSetName='Set02')]
    [Alias('FullName')][string]$FullPath
    ) # End of Param()
    Begin {
    # Check that script was Run as Administrator
    If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
    [Security.Principal.WindowsBuiltInRole] "Administrator")) {
    Write-Host -ForegroundColor Red -BackgroundColor Black "`n ERROR: You MUST have Administrator rights to run this script!"
    Write-Host -ForegroundColor Red -BackgroundColor Black " Re-run this script as an Administrator!`n"
    Break
    #P/Invoke'd C# code to enable required privileges to take ownership and make changes when NTFS permissions are lacking
    $AdjustTokenPrivileges = @"
    using System;
    using System.Runtime.InteropServices;
    public class TokenManipulator
    [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
    internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall,
    ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen);
    [DllImport("kernel32.dll", ExactSpelling = true)]
    internal static extern IntPtr GetCurrentProcess();
    [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
    internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr
    phtok);
    [DllImport("advapi32.dll", SetLastError = true)]
    internal static extern bool LookupPrivilegeValue(string host, string name,
    ref long pluid);
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    internal struct TokPriv1Luid
    public int Count;
    public long Luid;
    public int Attr;
    internal const int SE_PRIVILEGE_DISABLED = 0x00000000;
    internal const int SE_PRIVILEGE_ENABLED = 0x00000002;
    internal const int TOKEN_QUERY = 0x00000008;
    internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
    public static bool AddPrivilege(string privilege)
    try
    bool retVal;
    TokPriv1Luid tp;
    IntPtr hproc = GetCurrentProcess();
    IntPtr htok = IntPtr.Zero;
    retVal = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok);
    tp.Count = 1;
    tp.Luid = 0;
    tp.Attr = SE_PRIVILEGE_ENABLED;
    retVal = LookupPrivilegeValue(null, privilege, ref tp.Luid);
    retVal = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);
    return retVal;
    catch (Exception ex)
    throw ex;
    public static bool RemovePrivilege(string privilege)
    try
    bool retVal;
    TokPriv1Luid tp;
    IntPtr hproc = GetCurrentProcess();
    IntPtr htok = IntPtr.Zero;
    retVal = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok);
    tp.Count = 1;
    tp.Luid = 0;
    tp.Attr = SE_PRIVILEGE_DISABLED;
    retVal = LookupPrivilegeValue(null, privilege, ref tp.Luid);
    retVal = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);
    return retVal;
    catch (Exception ex)
    throw ex;
    Add-Type $AdjustTokenPrivileges
    # Activate necessary admin privileges to make changes without NTFS perms on the folder
    [void][TokenManipulator]::AddPrivilege("SeRestorePrivilege") # Necessary to set Owner Permissions
    [void][TokenManipulator]::AddPrivilege("SeBackupPrivilege") # Necessary to bypass Traverse Checking
    [void][TokenManipulator]::AddPrivilege("SeTakeOwnershipPrivilege") # Necessary to override File Permissions
    $Admin = New-Object System.Security.Principal.NTAccount("BUILTIN\Administrators")
    $NewDirACL = New-Object System.Security.AccessControl.DirectorySecurity
    $NewFileACL = New-Object System.Security.AccessControl.FileSecurity
    $NewDirACL.SetOwner($Admin)
    $NewFileACL.SetOwner($Admin)
    } # End of Begin {}
    Process {
    if( $FullPath.Length -gt 0 ) {
    if( Test-Path $FullPath ) {
    $Path = $FullPath
    if( Test-Path $Path -PathType Container ) {
    "Take Ownership: $Path"
    $Folder = Get-Item $Path -Force
    $Folder.SetAccessControl($NewDirACL)
    } elseif( Test-Path $Path -PathType Leaf ) {
    "Take Ownership: $Path"
    $File = Get-Item $Path -Force
    $File.SetAccessControl($NewFileACL)
    } else {
    Write-Host -ForegroundColor Red -BackgroundColor Black "ERROR: Path does not exist: $Path"
    } # End of Process {}
    End { } # End of End {}
    } # End of Function Take-Ownership
    To run this I have been doing:
    PS D:\> $Folder = 'D:\Permissions\TopFolder'
    PS D:\> Get-Item $Folder | Get-Acl
    Directory: D:\Permissions
    Path Owner
    TopFolder DOMAIN\user1
    PS D:\> Get-ChildItem $Folder -Force -Recurse | Get-Acl
    Directory: D:\Permissions\TopFolder
    Path Owner
    FirstFolder DOMAIN\user1
    FirstFile.txt DOMAIN\user1
    Directory: D:\Permissions\TopFolder\FirstFolder
    Path Owner
    SecondFolder DOMAIN\user1
    SecondFile.txt DOMAIN\user1
    Directory: D:\Permissions\TopFolder\FirstFolder\SecondFolder
    Path Owner
    ThirdFolder DOMAIN\user1
    ThirdFile.txt DOMAIN\user1
    PS D:\>
    PS D:\> Get-Item $Folder | Take-Ownership
    Take Ownership: D:\Permissions\TopFolder
    PS D:\> Get-ChildItem $Folder -Force -Recurse | Take-Ownership
    Take Ownership: D:\Permissions\TopFolder\FirstFolder
    Take Ownership: D:\Permissions\TopFolder\FirstFile.txt
    Take Ownership: D:\Permissions\TopFolder\FirstFolder\SecondFolder
    Take Ownership: D:\Permissions\TopFolder\FirstFolder\SecondFile.txt
    Take Ownership: D:\Permissions\TopFolder\FirstFolder\SecondFolder\ThirdFolder
    Take Ownership: D:\Permissions\TopFolder\FirstFolder\SecondFolder\ThirdFile.txt
    PS D:\>
    PS D:\>
    PS D:\> Get-Item $Folder | Get-Acl
    Directory: D:\Permissions
    Path Owner
    TopFolder BUILTIN\Administrators
    PS D:\> Get-ChildItem $Folder -Force -Recurse | Get-Acl
    Directory: D:\Permissions\TopFolder
    Path Owner
    FirstFolder BUILTIN\Administrators
    FirstFile.txt BUILTIN\Administrators
    Directory: D:\Permissions\TopFolder\FirstFolder
    Path Owner
    SecondFolder DOMAIN\user1
    SecondFile.txt DOMAIN\user1
    Directory: D:\Permissions\TopFolder\FirstFolder\SecondFolder
    Path Owner
    ThirdFolder DOMAIN\user1
    ThirdFile.txt DOMAIN\user1
    PS D:\>
    I don't know why this isn't working.  The output text shows I went through the subfolders and files...HELP!
    Find this post helpful? Does this post answer your question? Be sure to mark it appropriately to help others find answers to their searches.

    Here is the end result. I am looking to add a '-Recurse'/'-Force' switches to give another option to not have to Get-ChildItem and pipe it to the function and possibly a '-User' parameter to be able to specify who to set as owner, but both of those ideas
    are untested.
    Here is the code.  Hope it helps someone else.
    Function Take-Ownership {
    <#
    .SYNOPSIS
    This function takes ownership of a file or folder and sets it back to 'BUILTIN\Administrators'.
    .DESCRIPTION
    This function takes ownership of a file or folder and sets it back to 'BUILTIN\Administrators'.
    This will work even when the user does not have ownership or existing permissions on the file or folder.
    .EXAMPLE
    PS C:\> Take-Ownership -Path $Path
    Takes ownership of the individual folder or file. The -Path is optional as long as $Path
    is the first parameter.
    .EXAMPLE
    PS C:\> Get-Item $Path | Take-Ownership
    Takes ownership of the individual folder or file.
    .EXAMPLE
    PS C:\> Get-ChildItem $Path -Recurse -Force | Take-Ownership
    Recurse through all folders and files, including hidden, and takes ownership.
    #>
    [CmdletBinding()]
    Param(
    [parameter(Mandatory = $true, ValueFromPipeline = $True, ValueFromPipelinebyPropertyName = $True, Position = 0)]
    [Alias('FullName')]
    [string]$Path
    ) # End of Param()
    Begin {
    # Check that script was Run as Administrator
    If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
    [Security.Principal.WindowsBuiltInRole] "Administrator")) {
    Write-Host -ForegroundColor Red -BackgroundColor Black "`n ERROR: You MUST have Administrator rights to run this script!"
    Write-Host -ForegroundColor Red -BackgroundColor Black " Re-run this script as an Administrator!`n"
    Return
    #P/Invoke'd C# code to enable required privileges to take ownership and make changes when NTFS permissions are lacking
    $AdjustTokenPrivileges = @"
    using System;
    using System.Runtime.InteropServices;
    public class TokenManipulator
    [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
    internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall,
    ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen);
    [DllImport("kernel32.dll", ExactSpelling = true)]
    internal static extern IntPtr GetCurrentProcess();
    [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
    internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr
    phtok);
    [DllImport("advapi32.dll", SetLastError = true)]
    internal static extern bool LookupPrivilegeValue(string host, string name,
    ref long pluid);
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    internal struct TokPriv1Luid
    public int Count;
    public long Luid;
    public int Attr;
    internal const int SE_PRIVILEGE_DISABLED = 0x00000000;
    internal const int SE_PRIVILEGE_ENABLED = 0x00000002;
    internal const int TOKEN_QUERY = 0x00000008;
    internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
    public static bool AddPrivilege(string privilege)
    try
    bool retVal;
    TokPriv1Luid tp;
    IntPtr hproc = GetCurrentProcess();
    IntPtr htok = IntPtr.Zero;
    retVal = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok);
    tp.Count = 1;
    tp.Luid = 0;
    tp.Attr = SE_PRIVILEGE_ENABLED;
    retVal = LookupPrivilegeValue(null, privilege, ref tp.Luid);
    retVal = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);
    return retVal;
    catch (Exception ex)
    throw ex;
    public static bool RemovePrivilege(string privilege)
    try
    bool retVal;
    TokPriv1Luid tp;
    IntPtr hproc = GetCurrentProcess();
    IntPtr htok = IntPtr.Zero;
    retVal = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok);
    tp.Count = 1;
    tp.Luid = 0;
    tp.Attr = SE_PRIVILEGE_DISABLED;
    retVal = LookupPrivilegeValue(null, privilege, ref tp.Luid);
    retVal = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);
    return retVal;
    catch (Exception ex)
    throw ex;
    Add-Type $AdjustTokenPrivileges
    # Activate necessary admin privileges to make changes without NTFS perms on the folder
    [void][TokenManipulator]::AddPrivilege("SeRestorePrivilege") # Necessary to set Owner Permissions
    [void][TokenManipulator]::AddPrivilege("SeBackupPrivilege") # Necessary to bypass Traverse Checking
    [void][TokenManipulator]::AddPrivilege("SeTakeOwnershipPrivilege") # Necessary to override File Permissions
    } # End of Begin {}
    Process {
    # Process for taking Ownership of the folder
    # - Specify the NT Account user to set as Owner (BUILTIN\Administrators)
    # - Create a new ACL object for the sole purpose of defining a new owner
    # - Establish the new ACL as owned by BUILTIN\Administrators, thus
    # guaranteeing the following ACL changes can be applied.
    # - Then apply that update to the existing folder's ACL which merges
    # the proposed changes (new owner) into the folder's actual ACL
    # - - IN OUR CASE OVERWRITING THE OWNER
    # - Additional Documentation:
    # http://msdn.microsoft.com/en-us/library/System.Security.AccessControl(v=vs.110).aspx
    $Admin = New-Object System.Security.Principal.NTAccount("BUILTIN\Administrators")
    $NewDirACL = New-Object System.Security.AccessControl.DirectorySecurity
    $NewFileACL = New-Object System.Security.AccessControl.FileSecurity
    $NewDirACL.SetOwner($Admin)
    $NewFileACL.SetOwner($Admin)
    if( Test-Path $Path -PathType Container ) {
    $Folder = Get-Item $Path -Force
    $Folder.SetAccessControl($NewDirACL)
    } elseif( Test-Path $Path -PathType Leaf ) {
    $File = Get-Item $Path -Force
    $File.SetAccessControl($NewFileACL)
    } else {
    Write-Host -ForegroundColor Red -BackgroundColor Black "ERROR: Path does not exist: $Path"
    } # End of Process {}
    End { } # End of End {}
    } # End of Function Take-Ownership
    Find this post helpful? Does this post answer your question? Be sure to mark it appropriately to help others find answers to their searches.

  • How to recover lost folders and files - Pls help, help...

    Some days ago I lost all of my 15 GB folders and files that stored in my Macbook Pro hard drive called DATA.  I brought my Macbook pro to an experienced computer tecnicians who providing data recovery services. To his and my suprise, after checking, scanning it a few hours, he said their is no way to recover because he did not find any trails at all.  The computer still seems working properly - I have no problem with any applications.  There are few other folders in the DATA hard disk containing pictures, computer programs still remain.  These lost folders and files contain mainly documents (word, excel, power point, pdf etc) which I accumulated in my many years working  !!!!.  I did not make a back up since last September partly because I think Mac is very safe.
    The computer with me all the time on that day and only my son used Power Point to make a simple presentation on that evening - he can not save it on the folders the he normally use - All the folders and files are gone.
    I will appreciate it very much if any of you can tell me what would be the possible causes and more importanly how to recover the lost folders and files.  They are very very valuable to me.
    Many thanks for your kind attention
    Loimekong from Vietnam
    Macbook Pro 2.4 Ghz
    Intel Core 2 Duo
    4 GB 1067 MhZ DDR3

    First, did the data actually get deleted, or is it still there somewhere?  Try searching the drive for some of the documents, perhaps it's all just in another folder on that drive.
    If it's truly gone, it's impossible for us to say what might have happened to make it unrecoverable.  Perhaps someone using the computer used Secure Empty Trash, or securely erased empty space on the hard drive.  Perhaps it was overwritten by other stuff before you noticed.  It's possible the hard drive is starting to fail, though this seems like an awfully specific problem for that to be the issue.
    Or perhaps the tech you took the computer to didn't know what he was doing.  Why not try recovering what you can on your own?  See Recovering deleted files.
    You should be aware that no computer is safe.  All computers rely on hardware that may fail and software that can have bugs.  You absolutely MUST maintain a good set of frequently-updated backups...  no fewer than two full backups of anything you don't want to lose.
    (Note that my pages contain links to other pages that promote my services, and this should not be taken as an endorsement of my services by Apple.)

  • With my taking any action, my folders and files no longer appear under documents (under Places). Now a folder titled Documents has appeared on my desktop with all my files and folders. What happened?What happened?

    With my taking any action, my folders and files no longer appear under documents (under Places). Now a folder titled Documents has appeared on my desktop with all my files and folders. What happened?What happened?

    The way I moved from 10.3.9 to 10.5.8 was to use "ditto -rsrc" and copy the user homes and the data share to an external firewire drive. Then did the same in reverse.
    I found the key to data and share permissions to make sure that the users had the same UID in Leopard that they had in Panther.
    You can then use "sudo rm -rf" to remove any folder from the relocated homes that you want. Remember if you do choose to remove "~/Library" from each users relocated home, you will be removing any iCal calendars, login.keychains, browser bookmarks, custom screensavers and wallpapers, etc.
    Users don't really care if they can login and do any work. But there will be much wailing, gnashing of the teeth, and anxiety, if they lose their bookmarks and wallpaper.

Maybe you are looking for

  • Questions before an internal lab POC (on old underperformant hardware)

    Hello VDI users, NB: I initially asked this list of questions to my friends at the SunRay-Users mailing list, but then I found this forum as a more relevant place. It's a bit long and I understand that many questions may have already been answered in

  • Web Cam does not work for yahoo messenger

    Hi, I down loaded a s/w MacCleanse, it kinda deleted a lot of files from my mac book air after which the web cam stopped working on yahoo messenger. I checked Ichat the cam works perfectly but does'nt with messenger. Does any one have a clue on how t

  • In need of customized JTextField

    I need to create a custom textfield, and the formatter won't cut it. I need to have formatting applied real time, with a variable number of characters. The ATM might be a good example, where you enter numbers and the display field fills in from left

  • IPad won't charge in ITunes

    I'm still using the cord that came with the Ipad (2) I just got it for Christmas so it's not old. The cord works when I plug it into the wall but when it's plugged into my computer it simply won't charge. The IPad shows up in ITunes and I can downloa

  • 10.2.0.1 install, linux Red Hat 4 fails on Oracle Config Asst ORA-27102

    INFO: Configuration assistant "Oracle Net Configuration Assistant" succeeded INFO: Command = /oracle/ora10gr2/bin/dbca -progress_only -createDatabase -templateName General_Purpose.dbc -gdbName orcl -sid orcl -sysPassword 053d3e43dd32524082f71c6390916