Jump to content

jjohnsoncantell

Members
  • Posts

    297
  • Joined

  • Last visited

Everything posted by jjohnsoncantell

  1. Many thanks Jamesb, that was exactly what i needed and i even learned a bit more about scripting, you're a star!
  2. Greetings, I have found a nice simple script which lets me add a local user and puts him into a specified group. I need this script to be able to change options on the account such as password expiry, whether or not the user can change the password and so on. I dont really know anything about scripting so your help would be great. ' ------- TEXT USED ---------- Title = "New User Tools v1.1" strGroup = "Administrators" ' ------ END TEXT USED -------- '---- RETRIEVE COMPUTER NAME --------- Dim objNetwork, strComputerName Set objNetwork = CreateObject("WScript.Network") strComputer = objNetwork.ComputerName '---- END RETRIEVE COMPUTER NAME -------- '------ GET INPUTS FROM USER ---------- Dim strUserName, strFullName, strPassword If Msgbox("Would you Like to Add a User?" , vbYesNo, Title) = vbYes then Call GetInputs Else Call Rename_Computer Sub GetInputs Do strUserName = InputBox("Please Enter User Name.",Title) If strUserName = ""Then If MsgBox("Are you Sure you want to Quit?" , vbYesNo, Title)= VbNo Then Else Call Rename_Computer() End If End if Loop Until strUserName <> "" Do strFullName = InputBox("Please Enter Your Full Name.", Title) If strFullName = "" Then If MsgBox("Are you Sure you want to Quit?" , vbYesNo, Title)= VbNo Then Else Call Rename_Computer End If End If Loop Until strFullName <> "" Do strPassword = InputBox("Please Enter Password.",Title) If strPassword="" Then If MsgBox("Are you Sure you want to Quit?" , vbYesNo, Title)= VbNo Then Else Call Rename_Computer End If End If Loop Until strPassword<>"" Call AddUser() End Sub ' ------ END INPUTS --------------- ' ----- CODE TO ADD USER ---------- Sub AddUser Set objSystem = GetObject("WinNT://" & strComputer) Set objUser = objSystem.Create("user", strUserName) objUser.FullName = strFullName objUser.SetPassword strPassword objUser.SetInfo Call MsgBox ("User Name: " & strUserName & vbCrLf & "Password: " &strPassword & VbCrLf & VbCrLf & "Please Write This Information Down.", 64, Title) Call AddGroup End Sub ' ----- END CODE TO ADD USER ------- ' ----- CODE TO ADD USER TO GROUP ------- Sub AddGroup Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup) objGroup.Add("WinNT://" & strComputer & "/" & strUserName) Call Rename_Computer() End Sub ' ----- END CODE TO ADD USER TO GROUP ----- ' ------ RENAME COMPUTER ------ Sub Rename_Computer Dim strNewComputer, objNetwork, objWMIService, colComputers Set objNetwork = CreateObject("WScript.Network") strComputer = objNetwork.ComputerName Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colComputers = objWMIService.ExecQuery _ ("Select * from Win32_ComputerSystem") If Msgbox("Would you Like to Change the Computer Name?" , vbYesNo, Title) = vbNo Then Call CleanUp() Else Do strNewComputer = InputBox("Please Enter a New Computer Name.",Title) If strNewComputer = "" Then If MsgBox("Are you Sure you want to Quit?" , vbYesNo, Title)= VbYes Then Call CleanUp() End If End If Loop Until strNewComputer <>"" For Each objComputer in colComputers err = objComputer.Rename (strNewComputer) Next End If Call Reboot() End Sub '------ END RENAME COMPUTER ----------- '------ REBOOT MACHINE ------------- Sub Reboot If Msgbox("Your Computer Needs to Reboot Before Changes Can be Made. " & vbCrLf & "Would you Like To Reboot Now?" , vbYesNo, Title) = vbYes then Dim oWMI, oOS, obj Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\.\root\cimv2") On Error GoTo 0 For Each obj in oWMI.ExecQuery("Select * from Win32_OperatingSystem") Set oOS = obj Exit For Next Call ShutDownNow() End If End Sub Sub ShutDownNow Const EWX_LOGOFF = 0 Const EWX_SHUTDOWN = 1 Const EWX_REBOOT = 2 Const EWX_FORCE = 4 Const EWX_POWEROFF = 8 oOS.Win32shutdown EWX_REBOOT '+ EWX_FORCE End Sub ' ------- END ROOT MACHINE --------- '------ EXIT ----- Sub CleanUp Call MsgBox ("Click OK To Exit the Program",0, Title) WScript.quit End Sub End If '----- EXIT ------ This is the code, copied from My First Script - Create New Local User Account and/or Change Local Computer Name as a nod to the creator (hope im not doing anything wrong here). Cheers James
  3. Thanks thats just what i wanted Arthur and it works perfectly, thanks ever so much, and thank you all for answering my question so quickly! James
  4. Thanks for the swift replies everyone. dwhyte85: I have tried your answer as this seems the most simple to do and its just as i'd hoped to find such a setup. However the problem i have come up against is that it doesnt give you wpa2 options nor does it allow you to input the passkey. Have i missed something? or is this by design? powdarrmonkey: I would use this but this is for after i have iamged them during which it autojoins to the domain to save time. Thanks though. keithu: Can this be done after the imaging? Thanks again guys James
  5. Greetings all, Bit of an odd one this. Is there such a beast as a script that can automatically join a laptop to a wireless network (with wpa2+passkeys) to save me having to do it on all 300 odd of our laptops? Many thanks James
  6. Yep have updated to most recent updates, our network has a wsus which pushes them out. Im scratching my head as to what is still causing word to create these folders as i havent made any changes to default settings.
  7. Hi Dom, we're using office 2003 sp3 at the moment. Have checked the options and they are identical to your screenshot.
  8. No it doesnt. I have looked inside the folder and there is always another empty folder inside with a different random name. However, i have just noticed in one of these folders is one called "offline" which contains 3 files. 0x00000001_R 0x00000001_R and HashFile.dat
  9. ive actually watched it happen when a user saved a word document... however, the user didnt actualy create the folder
  10. This now seems to be happening when microsoft word documents are accessed/saved. Any ideas? Is this happening to anyone else? Image attatched.
  11. It doesnt seem to be program specific either, ive had someone tell me paint crashed on them with a DEP error, some were just using internet explorer, media player, just seems random. Im just hoping MS arent stupid enough to release an update that could cause this to happen as DEP is integrated into windows and short of setting up a massive list in the programs to exclude from DEP i dont know what to do.
  12. I dont think this is sophos guys... I read this thread originally the other day and agreed with the idea that sophos was causing this, the majority of people reporting this fault to me do after all have sophos installed. However, I have a test machine in my office which until a week ago had windows xp with sp3 and it had no problems for the 3 months it had been running for. It was rebuilt a week ago and my wsus server reports its now 100% up to date and already today it has had this DEP error 5 times using different programs. This machine has never had sophos installed on it. Therefore i can only assume, one of the updates released in the most recent patch day has caused this DEP error as this machine is only a week old, and the previous incarnation had been kept fully up to date with no issues. If theres any more info on what causes this or a fix i'd love to know as i have near on 500 machines which could be affected by this problem. james
  13. Greetings, Over the last few weeks ive been having reports from users of randomly named empty folders appearing in their my documents folders. The folders are named with just random letters and numbers no more than 8 characters long. They are not as far as i can tell folders created by windows updates. They are much longer names. At first i thought virus, however i have scanned the users pc and the storage box where the documents are redirected to and found nothing. Clients run XPsp3 with latest updates. Any help would be appreciated. James
×
×
  • Create New...