Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Create a GUID Using a Script?

Hey, Scripting Guy! We have items that we need to track using unique identification numbers. My boss suggested that we use GUIDs for this purpose. Is there any way to create a GUID using a script?-- DX Hey, DX. GUIDs (globally unique identifiers) are a good choice for a job like this; we don’t pretend to understand the algorithm behind ...

How Can I List the Files in a Folder and All Its Subfolders?

Hey, Scripting Guy! How can I list all of the files in a folder, as well as all the files in any subfolders of that folder?-- MA Hey, MA. This is a question we get asked quite a bit, and one which have avoided answering up till now. That’s because there is no nice, simple answer to this one: a script that can carry out this task is bound ...

How Can I Count the Number of Times a User has Logged on to a Computer?

Hey, Scripting Guy! How can I count the number of times a user has logged on to a computer?-- DE Hey, DE. How can you count the number of times a user has logged on to a computer? Good question and, ultimately, the answer might be: you can’t. But let’s at least explore some possible solutions and see if any of them will help. First of ...

How Can I List Open Sessions and Open Files on a Computer?

  Hey, Scripting Guy! Is there a way to export the information found in the Shared Folders portion of the Computer Management snap-in (in particular, the list of sessions and the list of open files)?-- PP Hey, PP. Funny you should ask; this very issue came up the other day, and while we assumed that there was a way to get at this ...

How Can I Add a Hyperlink to a Word Document?

Hey, Scripting Guy! How can I add a hyperlink to a Word document?-- BA Hey, BA. Interesting question; in thinking about common tasks for scripting Microsoft Office applications we never even considered adding a hyperlink to a document. (Needless to say, that’s why we rely on people like you to let us know about the tasks people really ...