Solved

Powershell: Need help with function that returns NTFS permissions on folder

Posted on 2014-01-21
3
1,043 Views
Last Modified: 2014-01-21
Hi,

I have found a script that exports NTFS permissions on a folder for groups and users recursive, to a csv file. I just can't get it to run properly. I have attached the script to this question and it can be found as well here: Script

I tried to call the function from another file like this:
C:\Temp\Get-FolderRights.ps1 
Get-NTFSPermissions -ShareName "\\apps003\archive$" -DomainName "domain" | Convertto-CSV | Out-file "C:\Temp\NTFSRights.csv"

Open in new window

It gave me this error:
The term 'Get-NTFSPermissions' is not recognized as the name of a cmdlet, function, etc.etc.

I tried this as well:
C:\Temp\Get-FolderRights.ps1 Get-NTFSPermissions -ShareName "\\apps003\archive$" -DomainName "domain" | Convertto-CSV | Out-file "C:\Temp\NTFSRights.csv"

Open in new window

It did not return an error.
It created only an empty csv file.

Tried to add the parameters directly int the script, this didn't work as well.

I'm doing something wrong but I can't figure out what.
Can someone help me on this ?

Thanks in advance !
0
Comment
Question by:Loyall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Expert Comment

by:Dale Harris
ID: 39796787
This may be a simple question, but did you attempt to load the function manually?  Try a simple copy/paste to make sure it all works and gets put into PowerShell.
0
 
LVL 70

Accepted Solution

by:
Qlemo earned 500 total points
ID: 39796792
You need to call the script with the dot operator. Without, the script builds its own scope, and all functions, vars etc. will not be part of your session (dismissed as soon as the script ran).
. C:\Temp\Get-FolderRights.ps1 
Get-NTFSPermissions -ShareName "\\apps003\archive$" -DomainName "domain" | Convertto-CSV | Out-file "C:\Temp\NTFSRights.csv"

Open in new window

Note that you have to call the script only once for your current session. It just defines the function here, so you can use it until you terminate the session (e.g. by typing exit)
0
 
LVL 2

Author Closing Comment

by:Loyall
ID: 39796841
Just one little dot and some space !
Thanks a lot Qlemo, you gave the right solution !
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question