Jump to content

squirrelc0de

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by squirrelc0de

  1. Hi there, I have a question as to how the drivemapdel and drivemapadd works. I am trying to remove a drive after setting it as persistent. When I added an else statement to delete a mapped drive after a user is removed out of an AD group, it seemed to remove the mapped drive even if a user was in a group. Could someone point out what i am doing wrong? #include <AD\AD.au3> _AD_open() if _AD_IsMemberOf("Security Group") Then MapDrive() Else DriveMapDel("T:") EndIf _AD_Close() EndFunc Func MapDrive() DriveMapDel("T:") DriveMapAdd("T:","\\server\fileshare",1) Endfunc
  2. Hi there, So i have a couple of drives that dont want to map. I have the same code for 7 drives and 2 just dont want to map. The script says its mapping them, but they dont show up. My user accounts have access to the shares but they dont show up in explorer. What could i possibly be doing wrong if all the other drives work but 2 dont map? Thanks
  3. Hi there, I tried that and that doesn't seem to delete the drive mapping. I've taken a test account out of the group and the mapped drive still shows up. Any other Ideas?
  4. Hi there, I have been racking my brain about how to get persitent drives to delete with a login script. My scenario is that Say a user is added to a network drive and its mapped persistently. If that user is moved out of that AD security group i want a piece of code to delete and remove the previously mapped persistent drive. I cant seem to get the sequence right for removing the drive, and thats what i need help with. Heres my code: #include <AD\AD.au3> func mapdrives() _AD_Open() if _AD_IsMemberOf("Security Group") Then MapDrive() EndIf _AD_Close() EndFunc ;map drive functions Func MapDrive() DriveMapDel("Q:") DriveMapAdd("Q:","\\server\mapdrive",$DMA_PERSISTENT) EndFunc Do i need to add in a different else statement for drivemapdel to clear off the old persistent drive?
  5. thats exactly what i was looking for! Thank you @Subz
  6. Thank you for your help, however i still need help trying to get this to work. the while loop is a good idea and taskkill will solve killing the application in question on the one machine. However I still need the application to run on every other machine but computer1. That;s why I had thought of using the crude if,elseif statement up at the top. i am using the AD scriptlets, but I cannot seem to get this to work properly: #include <AD.au3> func testfunction() _AD_Open() If _AD_IsMemberOf("included computers") then Run(@ComSpec & " /c " & "\\server\directory\program.exe","", @SW_HIDE) ElseIf _AD_IsMemberOf("excluded computers") then Run('taskkill /IM program.exe /F') EndIf _AD_Close() EndFunc What am i missing to kill the software from starting on the excluded computer ( just one computer)
  7. Hi there, I only have one computer Computer1 in this case that i need to exclude. I would just need the login script to check if a user is logging ionto computer1 to block the installation of that one specific file. I could however use an array to exclude that machine but how would i get the login script to close the program if a user is logging onto that specific computer im trying to block file access to?
  8. Hi there, Im working on trying to exclude one computer from getting a file to run when a user logs onto it. I cant seem to figure out how to properly create a function to do this. What am I missing to get the .exe to not run if a user signs into a specific computer? Func testfunction() if (@ComputerName <> "computer1") Then Run(@ComSpec & " /c " & "\\server\directory\program.exe","", @SW_HIDE) ElseIf (@ComputerName = "computer1") then Exit EndIf EndFunc
  9. thank you, i will give that a shot and get back to you in a day or so.
  10. Hi there, I dont want a message box to pop up when a user signs in, but to have the script detect whether they are apart of a specific ou, and if they were moved into a different ou then the script would remove the previous persistent drive. I think I got the code right, but need to double check it with someone. Thanks
  11. Hi there, I have a question about persistent drives and AD. I am playing around with a script but I'm missing something. What i want to do is if a user is part of an OU, it will map a network drive and be persistent. However if a user is moved out of that OU, they will need to have the persistent drive removed. I'm using the ad plugin script, and i can map the drives if a user is in a specific ou, but i cannot seem to delete the drive if the user is out of the OU. Here's an example of code I'm using: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Res_Fileversion=1.0.0 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <AD\AD.au3> func MapDrives() _AD_Open() if _AD_RecursiveIsMemberOf(OU) Then Mapdrive1() Elseif _AD_RecursiveIsMemberOf(different ou) drivemapdel EndIf _AD_Close() EndFunc Func MapDrive1() Drivemapdel ("Z:") DriveMapAdd ("Z:"."\\server\share",$DMA_PERSISTENT,0) EndFunc
  12. Hi there, I'm learning a lot about autoit, but I'm getting weird errors when I run my script in a test environment. From what I can see in the helpfile I can suppress msgbox popups using the @error flag. What I'm not sure about is the proper syntax I'm supposed to be using. I have a couple of drive mappings that map network drives when the script starts. My code is below: func main() MapDrives() MapAdditionalDrives() EndFunc What I want to do is add an exit loop if the @error flag is set so that the script is killed silently if an error is thrown ( say for instance if a user profile doesn't have a home drive) I figure that the code below will work, but I'm not sure if I have to create an if, else statement If @error Then Exit Would someone be able to help me figure out the proper syntax for this?
×
×
  • Create New...