java | get file shares \\domain\netlogin\{scripts}

6 Dec

My current project has recently required that i be able to report on the Network UNC shares consumed by each Active Directory OU. Not easy to accomplish when your domain is in excess of 110 OU’s and 10k+ users.

This will be a two part example : (update to complete second part)

1. What i have to start with is a list of network login scripts for all users in a given AD OU. How i got this data is irrelevant for now (still compiling java).

2. Here : is a little .jar file that will ask for a NetBIOS Domain Name (NONE canonical), Server (forced target for specific/local Domain Controller for the lookups) and login script. It than iterates through the script and extracts all NET USE statements with PERSISTENT on and dumps into a lsUNCshares.csv.

You can run it as a batch by putting

for /F “eol=; tokens=1 delims=,” %%A in (lscriptlist.txt) do @”java.exe” -jar GetScriptUNCs.jar %%A > %%AResults.csv

in a run.cmd batch file in the same directory as the .jar. Edit a lscriptlilst.txt with the output of all login scripts you want to check and run it.

Bang. A list of all UNC Shares for all login scripts in a file.

Shoutout goes to Carl Billings for assistance with this code segment.

{Source Included}


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: