Script Tips

Remote Scripting Trick

With permissions configured correctly, you can make a script load and go on the server at your script's discretion.

You’re doubtless familiar with the VBScript CreateObject() function, which instantiates (loads into memory) a DLL and makes it available to your script. For example:

Set objFSO = CreateObject("Scripting.FileSystemObject")

But did you know that CreateObject has an often-overlooked, optional second argument? Check this out:

Set objFSO = CreateObject("Scripting.FileSystemObject", _
  "Server1")

This version of CreateObject() instantiates the same COM object, but it does so through Distributed COM (DCOM), loading and executing the object on the remote computer Server1. Obviously, you’ll need appropriate permissions to pull this off (configured in the Component Services console), but imagine the possibilities: This remote FileSystemObject instance would be working directly with the server’s local storage, but you’d be controlling everything through your script. It’s a creative twist on remote scripting.

Hey, be sure to check out my new "Scripting News" podcast, available on Apple iTunes and at http://www.ScriptingAnswers.com. News, interviews, and more, all about Windows administrative scripting.

About the Author

Don Jones is a multiple-year recipient of Microsoft’s MVP Award, and is Curriculum Director for IT Pro Content for video training company Pluralsight. Don is also a co-founder and President of PowerShell.org, a community dedicated to Microsoft’s Windows PowerShell technology. Don has more than two decades of experience in the IT industry, and specializes in the Microsoft business technology platform. He’s the author of more than 50 technology books, an accomplished IT journalist, and a sought-after speaker and instructor at conferences worldwide. Reach Don on Twitter at @concentratedDon, or on Facebook at Facebook.com/ConcentratedDon.

comments powered by Disqus
Most   Popular