In migration mode! It’s been awhile since I’ve done post-configuration of File Servers. I needed to recreate a DFSn structure in our Datacenter. A great opportunity to try out the new dfsn en smb cmdlets! 😉
The SMB & DFSn cmdlet work with CIMSessions. Before I can create the DFS structure I need to create the shares… Here’s an impression of what the csv file looks like:
Server ShareName Path FullAccess ChangeAccess ReadAccess AZR-FS-01 FS_ARC001$ E:\FS_ARC001 NT AUTHORITY\Authenticated Users AZR-FS-01 FS_ARC002$ E:\FS_ARC002 NT AUTHORITY\Authenticated Users AZR-FS-01 FS_ARC003$ E:\FS_ARC003 NT AUTHORITY\Authenticated Users AZR-FS-01 FS_ARC004$ E:\FS_ARC004 NT AUTHORITY\Authenticated Users AZR-FS-01 FS_ARC005$ E:\FS_ARC005 NT AUTHORITY\Authenticated Users AZR-FS-01 FS_ARC006$ E:\FS_ARC006 NT AUTHORITY\Authenticated Users
I’ll be using the servername to retain the cimsession amongst other things. Instead of giving everyone FullAccess to the share, we’re giving ‘Authenticates users’ FullAccess. To complete the list I’ve added Change- and ReadAccess as well even though I won’t be using them.
Here’s a quick rundown of the script. I’ve created quite a few checkpoints. First, see if the share exists then verify if the paths are identical. You never know if the share already exists and is pointing to another folder, I’ve learned that from past migration. If it doesn’t exist create it!
The reason for this setup is that I want to be able to re-run this script in the future. Without the check we’d end up with quite some errors… Incidentally, this is how I did my validation pre Pester… 😉
Ok now for the fun part!
This time I didn’t make use of snapshots and went straight to the source! Using the csv file I can verify that the shares have been create using the right path and that ‘Authenticated Users’ have Full access.
Looking at the creation script you might wonder why bother with an OV script (Operation Validation)? As chance would have it, one of the File Server’s volume needed to be recreated. Which meant shares had to be recreated (and validated…) Now I wasn’t part of the recreation process, but I could validate that the shares were available as intended once the recreation took place! 😉 It’s all about having peace of mind… I just ran the test before posting this blog, everything is as it should be… 🙂
Hope it’s worth something to you
Yo Irw. Nice one as usual. One question though: Whats up with this line:
Why did you use the curly brackets like that? Wouldn’t this work just as well:
I’m not judging, I just like it neat and tidy.
Smell ya later, honourable reverend Strachan. ;^)
Many ways to Rome… 😉 Hadn’t thought much about it, but you’re right it can be done without… 😛 Late!