Customizing Windows PowerShell command prompt

Windows PowerShell is a great tool and, if you are using it frequently, one of the things you might want to do is to customize the default command prompt. This is actually a quite common activity among Linux users; hence, there are many tutorials on doing that as well. In case you want to do this kind of customization to Windows PowerShell, please follow the guidance below.

The text displayed as the prompt for each line in the PowerShell is defined with Prompt() function. You are free to override this function (hence, change the command prompt) the same way you can override any other function – by defining the function in the default user profile script. The profile scripts can be defined at one of the following locations: Continue reading

Creating ZIP archive from a Batch script

While writing a data collection script, I had a requirement to compress some files into a single archive. At first, it did not sound too challenging (Windows has integrated ZIP supported via Send To Compressed (zipped) folder since Windows XP), but it seems it is not so easy if you throw few extra requirements for this task:

After reading some Microsoft documentation, many online forums and trying many differing things, I finally came up with the solution. Continue reading

Creating a workflow for SharePoint Foundation 2010 to automatically copy new documents to organized archive

As I’ve mentioned in my previous post, currently I’m doing some work with SharePoint 2010 and SharePoint Learning Kit. One of the tasks I had to do is to create an archive of all documents (reports) learners had submitted. If we were using SharePoint Server, I could use one of the new SharePoint 2010 Server features – Virtual Folders based on metadata . Problem is that this feature isn’t supported on Foundation version of SharePoint 2010 therefore I had to implement something similar myself.

After doing some searching, I’ve decided to workflows for that task. After some trying I’ve saw that I won’t be able to do that using SharePoint Designer. I needed to write a custom workflow using Visual Studio.
Continue reading

Compiling and localizing SharePoint Learning Kit v1.5

This weak I’ve started to work with SharePoint Learning Kit (SLK). As it says on the page:

SharePoint Learning Kit is a SCORM 2004 certified e-learning delivery and tracking application built as a Windows SharePoint Services 3.0 solution.Памятники

Since we using “SharePoint 2010 Foundation” for our project, I was lucky, that 1.5 version which is compatible with SharePoint 2010, was released this month. I’ve managed to install and try SLK but there still were some problems:

Continue reading

Count number of users who logged on to workstation in the last month (with Batch script)

Recently, at my job, I had a task to write script/program to count how many users had logged to workstation in the last month. While my colleague tried to complete this task with C#, I’ve decided to use old good Batch. In fact, I was thinking about using PowerShell at first, but since all computers this script will be run in are running Windows XP and do not have PowerShell installed.

To accomplish what I want I’ve found out about VBS script called EVENTQUERY which exists in Windows XP. After reading documentation I’ve decided that it would allow me to do exactly what I need. Though the script that relies on EVENTQUERY.VBS file, it wouldn’t work on newer Windows OS (Vista, Windows XP), but it wouldn’t cause any problems since, as I’ve mentioned before, all computers this script will be deployed to runs on Windows XP. If I would need it to work on Windows 7 later, I’m probably gonna use PsLogList from SysInternals. Continue reading