Showing posts with label vbscript. Show all posts
Showing posts with label vbscript. Show all posts

Friday, September 5, 2014

Uninstall Dropbox Script

The script simply searches for DropboxUninstaller.exe and if found, runs is with the /S switch. Time consuming script as it searches the hard drive. This could be done better...but meh.

UninstallDropbox.vbs


' Search computer for Dropbox installation and uninstall Dropbox if found.
' Created by Andrew Zbikowski  
' Version: 2013-06-10_01
' Tested against Dropbox version 2.0.23 
Option Explicit

' Objects
Dim objShell, objWMI, objFile
' Collections
Dim colFiles
' Strings
Dim strFileQuery, strComputer, strUninstallCmd


Set objShell = WScript.CreateObject("WScript.Shell") 

strComputer = "."
Set objWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")


strFileQuery = "SELECT Name FROM CIM_DataFile WHERE filename = 'DropboxUninstaller' AND extension = 'exe'"

Set colFiles = objWMI.ExecQuery(strFileQuery)

if colFiles.Count > 0 Then
For Each objFile in colFiles
On Error Resume Next
strUninstallCmd = Chr(34) & objFile.Name & Chr(34) & " /S"
objShell.Run strUninstallCmd,0,True ' Run uninstaller, wait for it to finish. 
Next
End If

WScript.Quit

Thursday, April 2, 2009

Windows Vista – Day 1

I finally took the plunge and upgraded my work laptop to Windows Vista. I opted for Windows Vista Business 64-bit when I ordered this laptop, tried it, and promptly downgraded to Windows XP 32-bit. Now 8 months and some change later, I’m back to Vista 64. Day one was mostly install and patch patch patch, but I was able to be productive. Wrote a pair of scripts to help with some things.

First one checks to see if my network home directory is available, and if so it launches SyncToy to sync my network home with my local files. I set it javascript:void(0)up as a scheduled task that runs at log on and then runs every hour. That's working well so far. Much better than Offline Files did in Windows XP. More SyncToy stuff in a forthcoming post...

The other script uses the same logic to check to see if my laptop is at work or if I’m out of the office. If it detects that I’m in the office it will launch Office Communicator. If I’m out of the office Office Communicator doesn’t start. This is handy as Office Communicator can’t do anything if if can’t reach the internal Live Communications Server. Before the script I was always closing Office Communicator when I wasn’t using the VPN. It’s much less annoying now. Download PersonalLogonScript.vbs


The other challenge so far is that a few applications are not 100% happy under 64-bit Windows. Specifically, Exchange 2003 admin tools and our helpdesk software. The helpdesk software mostly works, but has the occasional odd quirk. To work around the quirks I have Windows XP setup in a virtual machine. I’ll have the Exchange admin tools running under the VM soon, but getting the WinXP VM going was another install and patch fest.
Hopefully tomorrow goes well...

Monday, March 9, 2009

Apple Computers in the Enterprise Environment: Almost There Part 3

Being the proactive kind of administrator, I created a great VB script that goes through my OUs and marks computer that haven't updated their password as disabled, and modifies the description of of the computer to show why it was disabled (Disabled after 90 days of inactivity.) The goal was to cleanup stale computer accounts, and it worked spledlidly.

Fast forward about a year, it's time to run the script again. This time around we've joined about 25 OS X 10.4 clients to Active Directory. The script disabled every, single, 10.4 computer object. Picture me pulling my hair out. Somewhere in the back of my mind I remember something:

Tiger (10.4) doesn't update it's computer password in AD, but Apple fixed this in Leopard (10.5).

Yeah I knew it, but slipped my mind completely. Argh. Eenable the accounts in ADUC and removed the scripts comments and all is fine.

Possible work around using Samba's net use command to update the password periodically. Need to try it on a test computer one of these days. Or just upgrade all the clients to Leopard, but that costs money.

Monday, March 3, 2008

Check status of a user's password

Thanks to PCI requirements we recently formalized the the password aging policy in our Active Directory domain and unchecked the Password does not expire flag on all users accounts. I quickly found that I needed a way other than using Active Directory Users and Computers to check to see if a user's password is expired as users ignored the message to change their password.

I also found it helpful to see when the password was last changed and how long until the password expired. It seems the "Your password will expire in X days..." message was causing the odd issue with Outlook Web Access and Entourage (Mac Exchange Client) and having the user change their password resolved the issues.

So instead of always turning to Active Directory Users and Computers, I turned to scripting. Turns out you need the full LDAP distinguished name of the user in order to query password information. Typing in the full DN is a chore, but a bit of searching turned up a method for finding the a DN using the logon name.

And thus a simple script was born.



Script Username prompt.



Script Output.

Download VB Script Code

Tuesday, February 5, 2008

Find and Disable Inactive Computer Objects in Active Directory

I like my Active Directory, or at least the OUs in AD that I manage, to not have stale objects hanging around. Over time computers come and go, but they often leave behind their accounts in your Active Directory. I like to automate things as much as possible, so to go through AD and find inactive computers I wrote a VB Script to find stale computer accounts and disable them for me. As this is a mostly automated process, I wrote the script to update the object description in Active Directory so that it is clear why the computer object is disabled.

View and Download ADInactiveComputers.vbs on GitHub:Gist