cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Contributor

How do we get Folders that Groups are used in?

TLDR; How do we get a list of folders that a group is assigned to and the permissions that group is assigned in that folder.

 

This is going to be long (you have been warned).

 

using PowerShell I can get details from the shared folders as follows:

 

$lpURL = "https://lastpass.com/enterpriseapi.php"
$payload = @{}
$payload.add("Content-Type","application/JSON")
$payload.add("cid","__uzur0wn__")
$payload.add("provhash","__uzur0wn__")
$payload.add("apiuser","__urNameG03zh3r3__")

$payload.add("cmd","getdetailedsfdata")

$jsonPayload = $payload | convertto-json
$rawSFDetailResults = Invoke-WebRequest $lpurl -Body $jsonPayload -UseBasicParsing -Method Post

This gets the raw results but it's messy and hard to grok. So we do some cleanup on it.

$temp = $rawSFDetailResults.content | convertfrom-json

$sfIDs = $temp | Get-Member -MemberType NoteProperty | Select -ExpandProperty Name

$sFolderList = New-Object System.Collections.ArrayList($null)

foreach ($sfID in $sfIDs) {

$tempSFolder = $temp.$sfID
$tempSFolderUsers = ($temp.$sfID).users

$cFolder = @{sfid = $sfID
	sharedfoldername = $tempSFolder.sharedfoldername
	sfScore = $tempSFolder.score
	sfUsers = $tempSFolderUsers
	}

[void]$sFolderList.Add($cFolder)

}

So now we have a nicer list in $sFolderList. You can use the following to get a quick list

 

$sFolderList | Select sfid, sharedfoldername, sfScore

If you just want to dump the folder list with the users that can see it, you can use this:

remove-variable resultOut
foreach ($folder in $sFolderList) {

	$msg = "Folder Name: " + $folder.sharedfoldername + "`n"
	$resultOut += $msg

	foreach ($user in $folder.sfUsers){
		
		$msg = "`t" + $user.username + "`n"
		
		# Means user is an admin
		if ($user.can_administer){ $msg = $msg = "`t" + $user.username + "`t`t(***)`n"}
		
		$resultOut += $msg

	}

	$msg = "`n"
	$resultOut += $msg
}

$resultOut

This variant allows you to dump the list in a format that you can use with a pivot table in Excel to allow for selective folder/user grouping.

$aclList = New-Object System.Collections.ArrayList($null)
foreach ($folder in $sFolderList) {

	foreach ($user in $folder.sfUsers){
		
		$cEntry = [pscustomobject][ordered]@{
			folderName = $folder.sharedfoldername
			userName = $user.username
			admin = $user.can_administer
			ro = $user.readonly
		}

		[void]$aclList.add($cEntry)

	}

}

$aclList | Export-CSV folderACL.csv

Now,  you'll see in all of those listing that we don't see any Group name anywhere. This tells me that LastPass is resolving the group to it's members. That's nice of them but I need to audit where the Groups are applied.

 

How the heck do we do that?

 

 

 

 

 

 

1 REPLY 1
Highlighted
New Contributor

Re: How do we get Folders that Groups are used in?

Groups such as project teams, departments, or classmates can communicate and collaborate using Google Groups. If you want to invite a group to an event, or share documents with a group, you can send a single email to everyone in the group