Jump to content

goaliepride

Members
  • Posts

    47
  • Joined

  • Last visited

Reputation

0 Neutral

About goaliepride

  1. That helped me immensely, thanks Chris! ? { ! (Get-QadUser $_.Username) } was the key I was missing
  2. I have a powershell script that currently imports a csv, and runs a command to create a student against each line of it. It is as follows. import-csv $Student |` ForEach-Object {"for each student, create a user account"} What I'd like to do though, is only run the creation of an account if the student doesn't exist. I'm unsure though how to go about adding in that conditional logic. If you cannot tell, I'm new to the world of piping and the like. I even used to have it be Where{} instead of ForEach-Object and that worked fine too (just no conditional logic). Sorry to be a dunce, but reading through an actual powershell book for answers isn't helping me "get it".
  3. I will check out regshot, thanks for the suggestion. iTunes by itself isn't much of a problem, ya know? It just plays media files. Some of the uses are legitimate, such as reading of some speeches and things, or music classes. So I don't like to throw the baby out with the bath water. It does cause some headaches though, as you can tell from me having to post.
  4. The question is a bit old hat, with a spin. We have hundreds of users who have iTunes, of course this becomes a space hog. We redirect "my documents" so of course "my music" is also part of that, which under XP we cannot change. I do know how to redirect iTunes for single users. What I'd like to be able to do is redirect iTunes with a script so that it goes to C:\music or something. I need to keep their files in tact. I need to not have to do this by hand each and every time. Has anyone done this? Is there a command line for this?
  5. This wound up being a problem of statements I think. true/false should be written $true/$false, who knew something that looked like a variable was a constant?
  6. Here's another version. I changed it so that it created folder for periods within the main folders. My teacher list also evolved to go "Last name (next line) firstinitial (next line) Last name (next line) first initial" and so forth. Our domains naming convention is firstinitiallastname, so by getting this I copy the ACL from my template folders, apply it to their folders, and then add them as full control to their folder. In this way I can prevent other teachers from accessing their stuff, or more likely, prevent some rogue student from logging on as his teacher and wiping everything every teacher has. Neat huh? #Read a text file to know what folders to create $names = Get-Content "\\bogusfs02\bogus-Students\StudentTurnIn\DontDelete\teachers.txt" #Count the names for future loop usage $nametotal = $names.length #The root folder for what we're going to create $root = "\\bogusfs02\bogus-Students\StudentTurnIn" #grab the ACL for the folder we'd like to mimic the permissions of $templateacl = get-acl "\\bogusfs02\bogus-Students\StudentTurnIn\DontDelete" #For loop to create folders that don't exist and assign permission For($loopcount=0; $loopcount -ne $nametotal; $loopcount+=1) { #Find the name of the next teacher folder $currentteach = $names[$loopcount] #Add the root path to the teacher to create $folderinquestion = join-path $root $currentteach #test is the path already exists $pathexists = test-path $folderinquestion #Create the folder if it doesn't exist if ($pathexists -eq $False){New-Item $folderinquestion -type directory} #Set the new ACL Set-Acl -Path $folderinquestion -AclObject $templateacl -Passthru:$PassThru #Create an array with the number of period at the school, including zer0 $PeriodArray = 0..7 #Count the length of the period array $periodarraytotal = $periodarray.length #Get the name of the teacher, and the username $lastname = $names[$loopcount] $loopcount=$loopcount+1 $firstinitial = $names[$loopcount] $username = "$firstinitial$lastname" #Grab the current acl, add the user as full control, set them to the acl $inherit = [system.security.accesscontrol.InheritanceFlags]"ContainerInherit, ObjectInherit" $propagation = [system.security.accesscontrol.PropagationFlags]"None" $acl = get-acl $folderinquestion $permission = "LOSAL\$username","FullControl", $inherit, $propagation, "Allow" $accessRule = new-object System.Security.AccessControl.FileSystemAccessRule ($permission) $acl.SetAccessRule($accessRule) $acl | Set-Acl $folderinquestion #For loop to add the Period folders. Permissions are taken from inheritance For($perloopcount=0; $perloopcount -ne $periodarraytotal; $perloopcount+=1) { $currentperiod = $periodarray[$perloopcount] $periodfolder = "$folderinquestion\Period $currentperiod" $pathexists = test-path $periodfolder if ($pathexists -eq $False){New-Item $periodfolder -type directory} } }
  7. I've created a powershell script to do this for me. The teachers.txt has a list of teacher last names (the folders I want to create). The DontDelete folder has the correct permissions set on it, which I copy to the others. I found a few ways of doing powershell where it can set permissions I specify, but they kept seeming to overwrite each other rather than add (so replace, rather than edit) and it was bugging me so I went the easy but imperfect route. Enjoy! #Read a text file to know what folders to create $names = Get-Content "\\**Path hidden for privacy**\teachers.txt" #Count the names for future loop usage $nametotal = $names.length #The root folder for what we're going to create $root = "\\**Path hidden for privacy**\StudentTurnIn\" #grab the ACL for the folder we'd like to mimic the permissions of $templateacl = get-acl "\\**Path hidden for privacy**\StudentTurnIn\DontDelete" #For loop to create folders that don't exist and assign permission For($loopcount=0; $loopcount -ne $nametotal; $loopcount+=1) { #Find the name of the next teacher folder $currentteach = $names[$loopcount] #Add the root path to the teacher to create $folderinquestion = join-path $root $currentteach #test is the path already exists $pathexists = test-path $folderinquestion #Create the folder if it doesn't exist if ($pathexists -eq $False){New-Item $folderinquestion -type directory} #Set the new ACL Set-Acl -Path $folderinquestion -AclObject $templateacl -Passthru:$PassThru}
  8. I'm new to powershell, but am trying to evaluate a statement and getting results I don't understand. I find that my variable = True. Then when I write an if statement to evaluate if something is "True" I get a yes answer. PS U:\> $pathexists True PS U:\> if ($pathexists -eq "True") {"It was True"} It was True PS U:\> if ($pathexists -eq "False") {"It was also False!"} It was also False! PS U:\> $pathexists True Why in the world would ($pathexists -eq "False") wind up evaluating as if they were equal, when my variable is clearly True?
  9. Thanks everyone. I've created a main folder which everyone connects to. Main Folder (staff, change permissions. Students (apply to this folder only), Traverse folder / execute file, list folder / read data, read attributed, read extended attributes, read permissions. Subfolders created for each teacher. Students (Apply to: This folder and subfolders), same as above + , create files /write data. I'm going to try to write some powershell or something to script this too, but we'll see on that. The method is sound, though
  10. Hi All. I am looking for a solution where I can map a drive for students and staff. I want staff to be able to put files in for students to use (easy part). I also want students to be able to put files into the directory/directories (maybe one per teacher), but only see their own files. In this way we can avoid them changing other students work, cheating by reading other students work, e.t.c. . Is there a good way to do this without using "home directories" ala active directory? The computers are XP pro, and the file servers are 2008R2
  11. the blind watchmaker - richard dawkins Plato and a Platypus Walk into a Bar . . .: Understanding Philosophy Through Jokes - Thomas Cathcart into the wild - Jon Krakauer the watchmen - Alan Moore and Dave Gibbons
  12. I'd make sure the person responsible knows the severity of the situation, which it sounds like they are already aware. Past that the only thing you would get out of going further is self gratification. IMHO
  13. has anyone found a link to a stream to use with something like VLC?
  14. ended up being permissions, they need "traverse the directory" and the generic read, cleared it up for us.
  15. congo-rats!
×
×
  • Create New...