
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2013 06:26 PM
Hi,
Can someone assist me with setting some AD attributes using custom actions? I've got the below script, which, by itself, works well at setting the city and state attribute. How can I take this script and apply it to Lansweeper? I understand where to save the file, and where to set up the action within Lansweeper, I just need some syntax help. For example, at the top of my script, you'll see that it specifies the user that I wish to modify. I would like to change this so that whichever user I have selected in Lansweeper will be the user that this action gets applied to. (Ideally, so I can run this action against multiple users at once and streamline our Active Directory cleanup.) Any help would be greatly appreciated!
Can someone assist me with setting some AD attributes using custom actions? I've got the below script, which, by itself, works well at setting the city and state attribute. How can I take this script and apply it to Lansweeper? I understand where to save the file, and where to set up the action within Lansweeper, I just need some syntax help. For example, at the top of my script, you'll see that it specifies the user that I wish to modify. I would like to change this so that whichever user I have selected in Lansweeper will be the user that this action gets applied to. (Ideally, so I can run this action against multiple users at once and streamline our Active Directory cleanup.) Any help would be greatly appreciated!
Set objUser = GetObject _
("LDAP://cn=User1,ou=MyUsers,ou=MySite,dc=MyDomain")
strCity = InputBox("Please enter the name of the city:", _
"Active Directory City Attribute")
If strCity = "" Then
Wscript.Quit
End If
strState = InputBox("Please enter the name of the state:", _
"Active Directory State Attribute")
If strState = "" Then
Wscript.Quit
End If
objUser.Put "l", strCity
objUser.Put "st", strState
objUser.SetInfo
Labels:
- Labels:
-
Archive
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2013 09:21 PM
Awesome, it looks like that did the trick.
Thank you for the help!
Thank you for the help!

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2013 01:26 PM
You are missing a space after .vbs
{actionpath}ModCityState.vbs "{cn}"

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2013 07:40 PM
Ok, so the script now looks like this:
The script has been moved to \\myserver\c$\Program Files (x86)\Lansweeper\Actions
And the action path looks like this:
But when I run it, I get the following error:
"File Not Found.
\\myserver\lansweeper$\ModCityState.vbs"CN=User1,OU=Users,OU=Site1,DC=Domain"
Note that I replaced the actual AD values with User1, Site1, and Domain in this case.
struser= WScript.Arguments(0)
Set objUser = GetObject("LDAP://" & struser)
strCity = InputBox("Please enter the name of the city:", _
"Active Directory City Attribute")
If strCity = "" Then
Wscript.Quit
End If
strState = InputBox("Please enter the name of the state:", _
"Active Directory State Attribute")
If strState = "" Then
Wscript.Quit
End If
objUser.Put "l", strCity
objUser.Put "st", strState
objUser.SetInfo
The script has been moved to \\myserver\c$\Program Files (x86)\Lansweeper\Actions
And the action path looks like this:
{actionpath}ModCityState.vbs"{cn}"
But when I run it, I get the following error:
"File Not Found.
\\myserver\lansweeper$\ModCityState.vbs"CN=User1,OU=Users,OU=Site1,DC=Domain"
Note that I replaced the actual AD values with User1, Site1, and Domain in this case.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2013 07:25 PM
Please have a look at the built-in user actions in the Lansweeper web console under Configuration\Website Management\User Pages and the related scripts found in Program Files (x86)\Lansweeper\Actions on your Lansweeper server. You should include the following in your script and add the {cn} parameter to your custom action to pass the user to the script:
Note that there is no built-in functionality in Lansweeper for applying custom actions to multiple users at once.
struser= WScript.Arguments(0)
Set objUser = GetObject("LDAP://" & struser)
Note that there is no built-in functionality in Lansweeper for applying custom actions to multiple users at once.
