Login Script to create custom text file for a user

25 Aug

While I look to centrally manage everything, there are a few things that still require some attention and some configuration settings that needs to be fully tested before deployment

For now, a simple solution was to create a text file and place it the desktop of all users, however, this text file needed to be customised. For example, I wanted to include URL’s specific to that user as some of them have their username in the URL etc.

To achieve this I ran the following as login script for the user:

'D Harris
'Login Script to create desktop text file

Dim objNet 
Set objNet = CreateObject("WScript.NetWork") 

Dim objFSO, outFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Open write stream

Set outFile = objFSO.CreateTextFile("\\server\userdata\"&objNet.UserName&"\desktop\IT Information.txt")

'Write each command line
outFile.WriteLine "Company Name."
outFile.WriteLine "IT Information"
outFile.WriteLine "--------------------"
outFile.WriteLine ""
outFile.WriteLine "OneDrive for Business URL: https://company-my.sharepoint.com/personal/"&objNet.UserName&"_company_co_uk/documents"

'Close write stream
outFile.Close

Once everything is setup correctly, I can just remove this file using Group Policy.