Jump to content

noelmm

Members
  • Posts

    332
  • Joined

  • Last visited

Everything posted by noelmm

  1. Hi Chris, I got a reply from their helpdesk last night and their answer is to install the software following the instructions on the website. The install procedure is that simple that I don't understand how they think anyone can get it wrong. I've asked them for an alternative installer that I can test with however I don't think I'll have any luck with getting one.
  2. I'm having nothing but problems with e-Marker at the moment. I have installed it on to a standalone device on an open network and the software works perfectly, installed the same software onto an identical device and the software fails and the error message is basically useless. I have been able to install the software onto one of our domained machines and it works however on another 3 identical devices the software again doesn't work. Like you I have contacted AQA and had no response so i'm stuck waiting at the moment.
  3. I've never used them as we no longer have projectors however I received a call from a salesman at Home Projector Lamps for Schools ProjectorLampsforSchools.co.uk the other day who said they will beat any genuine price from another supplier and do next day delivery. As I have said I haven't used the company so can't say if their service is good or not but it's an option you could look at.
  4. I use Double Driver here, works on windows 7, 8.1 and windows 10 and is quick and simple. It can be downloaded freely from various sites, just google it.
  5. I have the roadhawk hd 2 and the picture quality is great. If you connect the gps it also logs your location and speed and this information is viewable when you use the software that came with the camera, if you send the file off to anyone and they use a normal video application they cannot see the gps information (at least I think so). The kit is a little pricey when you also buy the car fitting kit but it took me around 15 minutes to wire it into my car and I've not had any problems with it.
  6. Hi, That worked, all of the user accounts are now being created along with all folders and permissions assigned. Thanks for all of the help you have given, I'm now going to through the script to fully understand and learn the changes you put in and why they work. Noel
  7. Hi, I have used the modified script and this time only 1 test user account was created and the Jake B account was created. I do receive a lot of errors now though so they may give some information as to what's not working Move-ADObject : An attempt was made to add an object to the directory with a name that is already in use At D:\V16 - Modified Code.ps1:98 char:19 + Get-ADUser $SAM | Move-ADObject -TargetPath "OU=Year 7,OU=Student,OU=Users,OU=Bu ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (CN=Test.User,CN=Users,DC=test,DC=com:ADUser) [Move-ADObject], ADException + FullyQualifiedErrorId : ActiveDirectoryServer:8305,Microsoft.ActiveDirectory.Management.Commands.MoveADObject d---- 28/04/2017 09:57 Test.User1 New-ADUser : An attempt was made to add an object to the directory with a name that is already in use At D:\V16 - Modified Code.ps1:72 char:1 + New-ADUser -Name "$Displayname" ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (CN=noel.m,CN=Users,DC=test,DC=com:String) [New-ADUser], ADException + FullyQualifiedErrorId : ActiveDirectoryServer:8305,Microsoft.ActiveDirectory.Management.Commands.NewADUser Get-ADUser : Cannot find an object with identity: 'noel.mFm' under: 'DC=test,DC=com'. At D:\V16 - Modified Code.ps1:98 char:1 + Get-ADUser $SAM | Move-ADObject -TargetPath "OU=Year 7,OU=Student,OU=Users,OU=Bu ... + ~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.m:ADUser) [Get-ADUser], ADIdentityNotFoundException + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Microsoft.ActiveDirectory.Management.Commands.GetADUser Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'noel.m' under: 'DC=test,DC=com'. At D:\V16 - Modified Code.ps1:100 char:1 + Add-ADPrincipalGroupMembership $SAM students + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.m:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'noel.m' under: 'DC=test,DC=com'. At D:\V16 - Modified Code.ps1:101 char:1 + Add-ADPrincipalGroupMembership $SAM "All Years" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.m:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership d---- 28/04/2017 09:57 noel.m Exception calling "AddAccessRule" with "1" argument(s): "Some or all identity references could not be translated." At D:\V16 - Modified Code.ps1:134 char:1 + $acl.AddAccessRule($rule) + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ( [], MethodInvocationException + FullyQualifiedErrorId : IdentityNotMappedException d---- 28/04/2017 09:57 Jake.b New-ADUser : An attempt was made to add an object to the directory with a name that is already in use At D:\V16 - Modified Code.ps1:72 char:1 + New-ADUser -Name "$Displayname" ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (CN=noel.m,CN=Users,DC=test,DC=com:String) [New-ADUser], ADException + FullyQualifiedErrorId : ActiveDirectoryServer:8305,Microsoft.ActiveDirectory.Management.Commands.NewADUser Get-ADUser : Cannot find an object with identity: 'noel.m' under: 'DC=test,DC=com'. At D:\V16 - Modified Code.ps1:98 char:1 + Get-ADUser $SAM | Move-ADObject -TargetPath "OU=Year 7,OU=Student,OU=Users,OU=Bu ... + ~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.m:ADUser) [Get-ADUser], ADIdentityNotFoundException + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Microsoft.ActiveDirectory.Management.Commands.GetADUser Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'noel.m' under: 'DC=test,DC=com'. At D:\V16 - Modified Code.ps1:100 char:1 + Add-ADPrincipalGroupMembership $SAM students + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.m:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'noel.m' under: 'DC=test,DC=com'. At D:\V16 - Modified Code.ps1:101 char:1 + Add-ADPrincipalGroupMembership $SAM "All Years" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.m:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership new-item : An item with the specified name C:\users\noel.m already exists. At D:\V16 - Modified Code.ps1:122 char:1 + new-item "c:\users\$SAM" -ItemType Directory #This line can be replaced with the ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceExists: (C:\users\noel.m:String) [New-Item], IOException + FullyQualifiedErrorId : DirectoryExist,Microsoft.PowerShell.Commands.NewItemCommand Exception calling "AddAccessRule" with "1" argument(s): "Some or all identity references could not be translated." At D:\V16 - Modified Code.ps1:134 char:1 + $acl.AddAccessRule($rule) + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ( [], MethodInvocationException + FullyQualifiedErrorId : IdentityNotMappedException csv import.txt I have attached the csv although I have had to save it as a text file as I couldn't upload a csv file. Thanks for all of the help and time you have put into this. Noel
  8. Firstly can I say thanks for the help. The code now works to create the duplicate account names with a 1 added onto the name however the script now fails to create any account for a SAM that is not already in AD, for example in the csv at the moment I have 5 entries for an account called test.user and 5 accounts are created called test.user1 - test.user5 as you would expect however in the same csv there are 2 accounts called jake.b and noel.m and these are not created however no errors are given. The script is also updating the first and last name of the accounts created with a 1 and I don't know why as these are read from the csv and not reliant upon the SAM (I might be wrong), for example the test.user2 account has the first name test2 and lastname user2. As a potential fix I amended the code to have the same made up of the the firstname.lastname rather than reading it from the csv as a seperate field and set your code to look for the surname as a filter and then add the number onto that however it doesn't work, I'm guessing I have coded it completely wrong.Below are is the way the code looks now, if you can advise as how I can solve this I would be grateful Noel
  9. Hi Pleach85, Thanks for the reply. I have done what you said and used your code and it sort of works however it fails on some parts. If no users already exist with the same SAM then everything runs as normal. If existing users with a matching SAM are found a user is not created with the modified SAM name however a folder is created without the user being added into the permissions, this makes sense as the user account is not actually being created. I don't know why your code would work only for part of the script as it looks like it should apply to all of it. If I run the script when I know there will be existing accounts as a test this is the error I receive New-ADUser : The operation failed because UPN value provided for addition/modification is not unique forest-wide At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:65 char:5 + New-ADUser -Name "$Displayname" ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (CN=Test2.User2,CN=Users,DC=test,DC=com:String) [New-ADUser], ADException + FullyQualifiedErrorId : ActiveDirectoryServer:8648,Microsoft.ActiveDirectory.Management.Commands.NewADUser Get-ADUser : Cannot find an object with identity: 'Test2.User21' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:89 char:5 + Get-ADUser $SAM | Move-ADObject -TargetPath "OU=Year 7,OU=Student,OU=Users,O ... + ~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Test2.User21:ADUser) [Get-ADUser], ADIdentityNotFoundException + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Microsoft.ActiveDirectory.Management.Commands.GetADUser Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'Test2.User21' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:91 char:5 + Add-ADPrincipalGroupMembership $SAM students + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Test2.User21:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'Test2.User21' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:92 char:5 + Add-ADPrincipalGroupMembership $SAM "All Years" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Test2.User21:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership Directory: C:\users Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 27/04/2017 14:17 Test2.User21 Exception calling "AddAccessRule" with "1" argument(s): "Some or all identity references could not be translated." At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:126 char:5 + $acl.AddAccessRule($rule) + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ( [], MethodInvocationException + FullyQualifiedErrorId : IdentityNotMappedException New-ADUser : The operation failed because UPN value provided for addition/modification is not unique forest-wide At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:65 char:5 + New-ADUser -Name "$Displayname" ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (CN=Test3.User3,CN=Users,DC=test,DC=com:String) [New-ADUser], ADException + FullyQualifiedErrorId : ActiveDirectoryServer:8648,Microsoft.ActiveDirectory.Management.Commands.NewADUser Get-ADUser : Cannot find an object with identity: 'Test3.User31' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:89 char:5 + Get-ADUser $SAM | Move-ADObject -TargetPath "OU=Year 7,OU=Student,OU=Users,O ... + ~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Test3.User31:ADUser) [Get-ADUser], ADIdentityNotFoundException + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Microsoft.ActiveDirectory.Management.Commands.GetADUser Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'Test3.User31' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:91 char:5 + Add-ADPrincipalGroupMembership $SAM students + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Test3.User31:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'Test3.User31' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:92 char:5 + Add-ADPrincipalGroupMembership $SAM "All Years" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Test3.User31:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership d---- 27/04/2017 14:17 Test3.User31 Exception calling "AddAccessRule" with "1" argument(s): "Some or all identity references could not be translated." At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:126 char:5 + $acl.AddAccessRule($rule) + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ( [], MethodInvocationException + FullyQualifiedErrorId : IdentityNotMappedException New-ADUser : The operation failed because UPN value provided for addition/modification is not unique forest-wide At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:65 char:5 + New-ADUser -Name "$Displayname" ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (CN=noel.maloney,CN=Users,DC=test,DC=com:String) [New-ADUser], ADException + FullyQualifiedErrorId : ActiveDirectoryServer:8648,Microsoft.ActiveDirectory.Management.Commands.NewADUser Get-ADUser : Cannot find an object with identity: 'noel.maloney1' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:89 char:5 + Get-ADUser $SAM | Move-ADObject -TargetPath "OU=Year 7,OU=Student,OU=Users,O ... + ~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.maloney1:ADUser) [Get-ADUser], ADIdentityNotFoundException + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Microsoft.ActiveDirectory.Management.Commands.GetADUser Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'noel.maloney1' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:91 char:5 + Add-ADPrincipalGroupMembership $SAM students + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.maloney1:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'noel.maloney1' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:92 char:5 + Add-ADPrincipalGroupMembership $SAM "All Years" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.maloney1:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership new-item : An item with the specified name C:\users\noel.maloney1 already exists. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:114 char:5 + new-item "c:\users\$SAM" -ItemType Directory #This line can be replaced with ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceExists: (C:\users\noel.maloney1:String) [New-Item], IOException + FullyQualifiedErrorId : DirectoryExist,Microsoft.PowerShell.Commands.NewItemCommand Exception calling "AddAccessRule" with "1" argument(s): "Some or all identity references could not be translated." At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:126 char:5 + $acl.AddAccessRule($rule) + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ( [], MethodInvocationException + FullyQualifiedErrorId : IdentityNotMappedException New-ADUser : The operation failed because UPN value provided for addition/modification is not unique forest-wide At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:65 char:5 + New-ADUser -Name "$Displayname" ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (CN=noel.maloney,CN=Users,DC=test,DC=com:String) [New-ADUser], ADException + FullyQualifiedErrorId : ActiveDirectoryServer:8648,Microsoft.ActiveDirectory.Management.Commands.NewADUser Get-ADUser : Cannot find an object with identity: 'noel.maloney1' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:89 char:5 + Get-ADUser $SAM | Move-ADObject -TargetPath "OU=Year 7,OU=Student,OU=Users,O ... + ~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.maloney1:ADUser) [Get-ADUser], ADIdentityNotFoundException + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Microsoft.ActiveDirectory.Management.Commands.GetADUser Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'noel.maloney1' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:91 char:5 + Add-ADPrincipalGroupMembership $SAM students + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.maloney1:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership Add-ADPrincipalGroupMembership : Cannot find an object with identity: 'noel.maloney1' under: 'DC=test,DC=com'. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:92 char:5 + Add-ADPrincipalGroupMembership $SAM "All Years" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (noel.maloney1:ADPrincipal) [Add-ADPrincipalGroupMembership], ADIdentityNotFoundException + FullyQualifiedErrorId : SetADPrincipalGroupMembership:ProcessRecordOverride,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership new-item : An item with the specified name C:\users\noel.maloney1 already exists. At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:114 char:5 + new-item "c:\users\$SAM" -ItemType Directory #This line can be replaced with ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceExists: (C:\users\noel.maloney1:String) [New-Item], IOException + FullyQualifiedErrorId : DirectoryExist,Microsoft.PowerShell.Commands.NewItemCommand Exception calling "AddAccessRule" with "1" argument(s): "Some or all identity references could not be translated." At D:\V13 - As previous version plus folder creation with Multiple Permissions applied and check for existing account.ps1:126 char:5 + $acl.AddAccessRule($rule) + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ( [], MethodInvocationException + FullyQualifiedErrorId : IdentityNotMappedException Thanks for your help with this. Noel
  10. Hi everyone, I have been attempting to create my script now for a couple of weeks and with your help I have been able to get it to a working state that I am happy with, now I need to add an If Else loop so that the script will check if the SAM name is already in use in AD. If the SAM already exists in AD I need the script to determine how many variations of the SAM there is and then create a new SAM with a number incremented onto the end e.g. if a new user account for John Smith was to be created and there was already John.smith then the new account would be john.smith2 or if there were 5 John Smiths the new account would be johm.smith6 etc. If the SAM does not exist within AD then my script as it is now should be executed. The working script I have so far is below, I think (I'm probably wrong) that I can leave this script alone and put it inside the else part of the script and in the If part the new script would be identical excpect it would have a check for the user account until a variation is not used and then use this as the SAM. Hopefully I'm explaining this clearly enough for you to understand. Any help would be appreciated. import-module activedirectory $users = Import-Csv .\Userlist-sn.csv ForEach ($User in $Users) { $Displayname = $User.Firstname + "." + $User.Lastname $UserFirstname = $User.Firstname $Lastname = $User.Lastname $OU = $User.OU $SAM = $User.SAM $UPN = $User.Firstname + "." + $User.Lastname + "@test.com" $Description = $User.Description $Password = $User.Password $Email = $UPN $Company = "companyname" New-ADUser -Name "$Displayname" ` -DisplayName "$Displayname" ` -SamAccountName "$SAM" ` -UserPrincipalName "$UPN" ` -GivenName "$UserFirstname" ` -Surname "$Lastname" ` -Description "$Description" ` -AccountPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Enabled $true -ChangePasswordAtLogon $true -PasswordNeverExpires $false ` -Server test.com ` -Email "$Email" ` -Company "$Company" ` -homedrive "u:" -homedirectory \\servername\sharename\$SAM #-homedrive "u:" -homedirectory \\servername\sharename\%username% Get-ADUser $SAM | Move-ADObject -TargetPath "OU=Year 7,OU=Student,OU=Users,OU=companyname,DC=test,DC=com" Add-ADPrincipalGroupMembership $SAM students Add-ADPrincipalGroupMembership $SAM "All Years" # Add-ADPrincipalGroupMembership $SAM - Duplicate this line to add the user into more AD groups new-item "c:\users\$SAM" -ItemType Directory #This line can be replaced with the line below to determine the full unc path of the folder $acl = Get-Acl -Path "c:\users\$SAM" $permission = $SAM, 'FullControl', 'ContainerInherit, ObjectInherit', 'None', 'Allow' $permission2 = 'students', 'FullControl', 'ContainerInherit, ObjectInherit', 'None', 'Allow' $permission3 = 'All Years', 'FullControl', 'ContainerInherit, ObjectInherit', 'None', 'Allow' $rule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $permission $rule2 = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $permission2 $rule3 = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $permission3 $acl.AddAccessRule($rule) $acl.ADDAccessRule($rule2) $acl.ADDAccessRule($rule3) $acl | Set-Acl -Path "c:\users\$SAM" #new-item "\\servername\sharename\foldername" -ItemType Directory } I know that I need to use an if else statement that loops for each of the users in the csv being imported however I have looked at examples and they are a little confusing. Just to clarify the work flow should look like this 1) import csv 2) determine if the SAM variable already exists in AD 3) If SAM variable does exist in AD then a unique SAM name should be created and used 4) If SAM variable does not exists in AD continue with script Any help would be appreciated with this Thanks Noel
  11. Thanks everyone for your help. I now have the script working so that it adds multiple permissions, I'll just need to modify this to fine tune the final permissions. Just for reference the working script is below, i'm sure it could be more elegant but it's working at the moment. My next part of the script is to put an if else loop in so that before any user accounts are created or folders created there is a check to see if identically named users and folders already exist and if they do an an incremental number onto the end of the SAM name. new-item "c:\users\$SAM" -ItemType Directory $acl = Get-Acl -Path "c:\users\$SAM" $permission = $SAM, 'FullControl', 'ContainerInherit, ObjectInherit', 'None', 'Allow' $permission2 = 'students', 'FullControl', 'ContainerInherit, ObjectInherit', 'None', 'Allow' $permission3 = 'All Years', 'FullControl', 'ContainerInherit, ObjectInherit', 'None', 'Allow' $rule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $permission $rule2 = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $permission2 $rule3 = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $permission3 $acl.AddAccessRule($rule) $acl.ADDAccessRule($rule2) $acl.ADDAccessRule($rule3) $acl | Set-Acl -Path "c:\users\$SAM" Thanks everyone Noel
  12. Thanks all for your quick help. I did think it was to do with inheritance but didn't know what I needed to do to solve the issue. I've now got a starting point that I can use. Thanks Noel
  13. Hi everyone,I have been doing a little work on my script with the goal of creating a user directory based on the account name and then applying some permissions to the directory. I have added the following code (see below) into my script and the script works in creating the folder in the test location and assigning the 'students' group full control however it does not add the user into the permissions. I recieve no errors, the script runs as I would expect aprt from it doesn't add the user into the permissions, it's almost like that line is being skipped.I have even entered the account user name manually e.g. test.user2 in place of the $SAM variable as a test however this did not apply the permissions either. Can anyone see what is wrong with the script and how to get it working? I've been scratching my head for a couple of hours with no luck. new-item "c:\users\$SAM" -ItemType Directory $acl = Get-Acl -Path "c:\users\$SAM" $permission = '$SAM', 'FullControl', 'ContainerInherit, ObjectInherit', 'None', 'Allow' $permission = 'students', 'FullControl', 'ContainerInherit, ObjectInherit', 'None', 'Allow' $rule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $permission $acl.SetAccessRule($rule) $acl | Set-Acl -Path "c:\users\$SAM" Thanks for any help you can offer. Noel
  14. Hi howart and Due, and Thanks for the help. I was unable to create the user directly in the OU, I was just receiving an error message saying the OU wasn't initialised however moving the user worked. I may go back and have a look as to why I received the error message as it should have worked. Now I need to get the if else statement working and you have both given me a place to start Noel
  15. Hi Ghanel, Thanks for the reply. I did try that approach but it still failed. I have been able to get the move process to work all I did was reverse the order that I listed the OU's in the script i.e. started with year group OU then listed parent OU etc. I just need to figure out how I can put the check in to see if the user account already exists or not. Thanks Noel
  16. Hi everyone, I have now got the script working so that the user accounts are created within the generic users OU with AD (code for script is below). import-module activedirectory$users = Import-Csv .\Userlist-sn.csvForEach ($User in $Users){ $Displayname = $User.Firstname + "." + $User.Lastname $UserFirstname = $User.Firstname $Lastname = $User.Lastname $OU = $User.OU $SAM = $User.SAM $UPN = $User.Firstname + "." + $User.Lastname + "@test.com" $Description = $User.Description $Password = $User.Password New-ADUser -Name "$Displayname" -DisplayName "$Displayname" -SamAccountName "$SAM" -UserPrincipalName "$UPN" -GivenName "$UserFirstname" -Surname "$Lastname" -Description "$Description" -AccountPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Enabled $true -ChangePasswordAtLogon $true -PasswordNeverExpires $false -Server test.com #Get-ADUser $User | Move-ADObject -TargetPath "OU=schoolname,OU=Users,OU=Student,OU=Year 7,DC=test,DC=com"} What I would like to do from here is introduce 2 new steps into the script, the first would be after the user accounts are created they are then moved into the correct OU. I will have different scripts for each year group so that the path of the OU can be coded into the script. I have used the following line of code in the script Get-ADUser $SAM | Move-ADObject -TargetPath "OU=schoolname,OU=Users,OU=Student,OU=Year 7,DC=test,DC=com" however I receive an error when running the script, if I comment out the line the script works again, the error is as follows Move-ADObject : The operation could not be performed because the object's parent is either uninstantiated or deleted At C:\Users\Administrator\Working Version (before moving user to certain OU).ps1:19 char:23+ Get-ADUser $SAM | Move-ADObject -TargetPath "OU=schoolname,OU=Users,OU=St ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (CN=Test2.User2,CN=Users,DC=test,DC=com:ADUser) [Move-ADObject], ADException + FullyQualifiedErrorId : ActiveDirectoryServer:8329,Microsoft.ActiveDirectory.Management.Commands.MoveADObject The second step would be to introduce a check to see if the user account exists before it is created and if it does export the user details of the proposed new account into a csv so that I can manually update the source csv and run the process again. If the user account does not exist then the script should progress and create the accounts. I am assuming this would be done with an if else statement of some sort but I don't know where to begin with it. Any help or advice would be appreciated.. Thanks Noel
  17. Ok I've just taken out the -Path "$OU" par of the script and it works. The script for some reason is attempting to place the user in a container called test1.user1 and I don't know, as far as I can tell I am not telling it to.
  18. Hi everyone, Thanks for your replies and advice with this. I have now adapted the script from the link above posted by glen_j so it looks like this import-module activedirectory $users = Import-Csv "C:\Users\Administrator\Userlist.csv" ForEach ($User in $Users) { $Displayname = $User.Firstname + "." + $User.Lastname $UserFirstname = $User.Firstname $Lastname = $User.Lastname $OU = $User.OU $SAM = $User.SAM $UPN = $User.Firstname + "." + $User.Lastname + "@test.com" $Description = $User.Description $Password = $User.Password New-ADUser -Name "$Displayname" -DisplayName "$Displayname" -SamAccountName "$SAM" -UserPrincipalName "$UPN" -GivenName "$UserFirstname" -Surname "$Lastname" -Description "$Description" -AccountPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Enabled $true -Path "$OU" -ChangePasswordAtLogon $true -PasswordNeverExpires $false -Server test.com } with the source csv file looking like this Firstname,Lastname,Maildomain,SAM,OU,Password,Description Test1,User1,test.com,Test1.User1,OU=school,OU=Users,OU=Student,OU=Year 7,DC=domain,DC=loc,Password2017,Student Account The problem is now when I run the script I receive the following error message and no user accounts are created CategoryInfo : ObjectNotFound: (CN=Test1.User1,...DC=test,DC=com :String) [New-ADUser], ADIdentityNotFoundException + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Microsoft.ActiveDirectory.Management.Commands.NewADUser Any idea what is causing this error, I’m guessing something simple that I have overlooked. Noel
  19. HI pcstru, I've taken a quick look and the script is beyond m knowledge at the moment so I will need to learn hat it all means. I would like to use he csv for more of the variables rather than hard coding it into the script. Noel
  20. Hi everyone, I'm new to powershell and have attempted to write a script to bulk import users into AD, I have read around a few sites but I'm having trouble with the whole process. I have my test server AD setup as follows domain = test.com OU-School name OU - Site Users OU - Staff OU - Admin OU - Teacher OU - Archive OU - Student OU - Year 7 OU - Year 8 OU - Year 9 OU - Year 10 OU - Year 11 OU - Archive OU- Technical I have the following script and csv that will import users however the users are always imported into the generic users OU within AD, not the OU I am defining within the CSV and the account user details are not populated fully. When the users are imported the account is created the only user information that is completed is the Pre-Windows 200 logon section, the user must change password on next login is ticked (as I would expect as this is set to true) however the account is disabled although I have enabled set to true. Import-Module ActiveDirectory Import-Csv "C:\Users\Administrator\NewUsers.csv" | ForEach-Object { # $userPrincinpal = $_."samAccountName" + "@test.com" New-ADUser -Name $_.Displayname ` #-SamAccountName $_.samAccountName -UserLogonName $samAccountName -UserPrincipalName $userPrincinpal -AccountPassword (ConvertTo-SecureString "Password2017" -AsPlainText -Force) ` -ChangePasswordAtLogon $true ` -Enabled $true -Path $_."ParentOU" ` } CSV Structure Firstname,Surname,name,Display name,SamAccount,Description,Office,email,Enabled Password,Path test,student1,test.student1,test.student1,test.student1,Student Account,school name,[email protected],$True,Password2017,OU=schoolname,OU=Users,OU=Student,OU=Year 7,DC=test,DC=com A couple of questions. How can I populate the fields of the user account that I would like to? Is there anyway to force the users into the exact OU that I want to use? Thanks for any help you can offer. As I have said I am new to Powershell so please keep it simple. Noel
  21. Hi Luke, Thanks for the advice. I'll take a look into what you have advised. Noel
  22. Hi Luke, Thanks for the advice. I'll take a look into what you have advised. Noel
  23. Hi everyone, It's been a while since I did any server work (server 2003) and thought I would take a look at server 2012 to get back into things (I have been given a free license for data centre edition for 2 years). I have been reading around and purchased a couple of books before I dive straight in so that I can have some idea of what I am doing. I am now at a point where I am just about to setup my servers and have come up with the following server plan Server 1: Domain Controller 1 Roles - AD, DHCP, DNS Server 2: Domain Conroller 2 Roles - AD, DHCP, DNS (failover server) Server 3: Roles - File server, Print server, Remote desktop server Server 4: Roles - Backup File and Print server Server 5: Roles - SCCM, WSUS Does this approach look ok or is there something you would change and if so why? This is going to be a long learning process where I am sure many mistakes will be made but that's part of the fun. Thanks for your feedback Noel
  24. We were advised that the laptops did qualify as school owned as the school purchased the laptops and they were still owned by us however this problem has now disappeared as we use office 365 and the students can download a copy to use on the laptop themselves.
  25. We set ours up as standalone devices. Before giving them to the students we install Office, adobe reader and all the normal software applications they will need (licensing allowing) and we then ask their parents to sign a form to say they are responsible for the laptop and any data on it. If the laptop is then brought back into us with a software problem we simply wipe it and start again, if there is hardware problem we will send it back to the manufacturer under warranty and if the warranty has expired we will look into how much the repair will be and try get this done from the students pupil premium funding where possible.
×
×
  • Create New...