• Tag Archives Sysadmin
  • Ceol FM – Internet Radio station for Irish Traditional and Folk Music

    I have been busy lately working on a new project that I’m finding very interesting.  It’s called Ceol FM.  It’s an Internet radio station like no other.  It’s aim is to provide the highest quality Irish Traditional and Folk Music using the medium of Internet radio to listeners anywhere in the world at any time of the day or night.

    What also sets this apart from any other service that might be similar is the growing choice of streams.  Listen to back to back Traditional Irish and Folk Music in a randem order or choose to focus on a specific mood or category.  For example, the first two new streams allow you to play Energetic or soothing music.  More streams will be made available very shortly.

    Ceol.FM was recently featured in the Drogheda Leader on the 5th of April 2017.  The article is provided below.  Please visit Ceol.FM and make it one of your regular sources of high quality Irish Traditional and Folk Music.


     

    When Darragh Ó Héiligh decided to fuse his passion for traditional Irish music and technology to set up Ceol.FM – an Internet radio station featuring a diverse range of traditional styles and streaming them across the world, little did he know it would become so popular so quickly.

     

    The thirty-four-year-old father of two is a highly-accomplished musician in his own right playing the Uilleann pipes and has travelled the world with his skill.  He spoke to the Drogheda leader about the decision to set up the new radio site.

     

    “It all started when I posted to my Facebook page asking if people would be interested in a new Internet radio site featuring solely traditional music and at the end of the day a hundred-people responded positively and by that weekend four hundred people had replied.”

     

    “I work as a senior system administrator in Dublin City University and I have a passion for technology and music so I decided to create the radio site and start streaming music.  There has been a great response to it, for example on St. Patrick’s Day there was three hundred and fifty unique listeners on the site from places like England, America and Holland!” Darragh explained.

     

    While the site provides a non-stop music stream free of charge and without any interruptions, Darragh has bigger plans

     

    “The site streams music at a higher rate than other radio sites so the sound quality is much better and I want to continue this. I am going to create more playlists to put up on the site so people can choose what type of traditional music they want to listen to. I am adding to it all of the time.”

     

    “The good thing about Ceol.Fm is that when people visit the site they can go directly to the music stream and choose to listen to this rather than an interview that they might not want to hear – you can’t do this on regular streams,” he explained.

     

    Creating the site was the easy part as Darragh explained while now it is a case of expanding on what the site has to offer and he is hoping to hear from people who may want to help or contribute to it.

     

    “I do this out of my passion for traditional Irish music and I am taken aback at how many people have already visited and tuned in. I’m not looking for profit and it costs €150 per month to host the site so if people want to contribute that would be great. I would also welcome anyone who had an interest in broadcasting to get in touch with me,” he added.

     

    To find out more go to www.ceol.fm.

     


     

    A screen shot of the article follows:

    A picture of the article taken from the Drogheda Leader.


  • Logon script to migrate users to a new file server and remove and recreate mapped network drives

    I’m migrating a few hundred users over to a new file server.

    The paths will be different. It’s not just the server name that’s changing.

    1. I have run into several problems.
    2. Although I’m a domain admin, I don’t have access to most of the folders. In the worst case scenario I need to take ownership to gain access.
    3. Inheritance is disabled on some of the sub folders.
    4. Permissions are sometimes configured on the fifth or even tenth sub folder.
    5. There are drive paths distributed using group policy but 99% of the paths are mapped directly on the PC.
    6. Five minutes of down time causes untold problems.
    7. The tool that is used to replicate the files isn’t replicating the permissions in all cases. It is also having the same problem that I’m encountering in terms of access to some files and folders.
    8. Permissions aren’t given to groups. Each person is added to the folder directly.
    9. There are often eight different drive maps. Some of these are even pointing to duplicate locations.

    Here’s what I’ve tried.

    1. Section shares will be mapped to S. However, the policy is set to update. IT isn’t changing locally mapped drives. This is ok. It allows users to come to support if they can’t access their files. The benefit of this is support are noting down what S was previously mapped to.
    2. I’m using powershell to level the permissions on all sub directories.
    3. I’m talking to section heads to determine the permissions that each person needs.
    4. I’m adding these people to groups based on the section and directory name and applying access to the group.
    5. I’m marking the old files as hidden. Mainly so that if someone continues using the old path they will think the drive is empty. That will result in a call to support where they can tell the user to use the new drive and then also delete the old map.

    There are far too many manual steps in this.

    There’s also too many remaining drive maps that aren’t needed.

    Here is what the script does to automate most of these manual steps.
    This is run at log in and targets one or more groups.

    1. List the currently mapped network drives.
    2. Check the groups that the user is a member of.
    3. Remove all drive maps
    4. Map drives based on assigned groups.
    5. Show a message to the user to inform them that the migration has completed.

    The main remaining problem is that if I move Drive Q that is used by ApplicationX to the letter Y, all the users who used the old letter will probably have problems opening files. There’s nothing I can really do about this. However, so far, the instances where this has been encountered has been managed easily by support.

    One choice I also made was to remove all existing permissions from the folder and reapply the permissions on the new file server so that only groups that should have access are applied to each folder. Of course, this requires that staff speak to their section heads to in turn ask me for access but this removes the potential that people have access to folders that they no longer need. It also helps to promote a more structured method of processing access requests. I could implement a form for tracking these requests but this overhead would be justifiably resisted by section heads.

    The script follows:

    Option Explicit
    Dim objShell,grouplistD,ADSPath,userPath,listGroup,WshNetwork,objFSO,objFile,strComputer,objWMIService,IPConfigSet,strIPAddress,colItems,strDrives,mappedDrives,objNetwork,x
    dim objTS, sReadLine, bReturn, strOutputFile, RunBefore, WshShell, IPConfig,i,objItem, objOutputFile
    strOutputFile = “\\spd-adc01.spd.dcu.ie\RemainingComputer\SharedFolders.txt”
    On Error Resume Next
    Set objShell = CreateObject(“WScript.Shell”)
    Const ForAppending = 8
    Set WshShell = CreateObject(“WScript.Shell”)
    Set WshNetwork = CreateObject(“WScript.Network”)
    Set objFSO = CreateObject(“Scripting.FileSystemObject”)
    Set objFile = objFSO.OpenTextFile(strOutputFile, ForAppending)

    ScriptNotRunBefore
    if (RunBefore = “False”) Then
    objFile.WriteLine WshNetwork.ComputerName & “,” & WshNetwork.UserName & “,” & GetIpAddress & “,” & GetMappedNetworkDrives

    DeleteMappedDrives
    If isMember(“SPD President”) Then
    MapPresidentsDrive
    End If
    End If
    objFile.Close

    Function GetIPAddress
    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
    Set IPConfigSet = objWMIService.ExecQuery _
    (“Select IPAddress from Win32_NetworkAdapterConfiguration WHERE IPEnabled = ‘True'”)

    For Each IPConfig in IPConfigSet
    If Not IsNull(IPConfig.IPAddress) Then
    For i = LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
    If Not Instr(IPConfig.IPAddress(i), “:”) > 0 Then
    strIPAddress = strIPAddress & IPConfig.IPAddress(i) & ” ”
    End If
    Next
    End If
    Next
    GetIPAddress = strIPAddress
    End Function

    Function GetMappedNetworkDrives
    On Error Resume Next
    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)
    Set colItems = objWMIService.ExecQuery(“Select * from Win32_MappedLogicalDisk”)

    For Each objItem in colItems
    strDrives = strDrives & “,” & objItem.Name & ” ” & objItem.ProviderName
    Next
    GetMappedNetworkDrives = strDrives
    End Function

    Function DeleteMappedDrives
    On Error Resume Next
    Set objNetwork = CreateObject(“Wscript.Network”)
    Set mappedDrives = objNetwork.EnumNetworkDrives
    For x = 0 to mappedDrives.Count
    objNetwork.RemoveNetworkDrive mappedDrives.Item(x), True, True
    Next
    End Function

    Function MapPresidentsDrive
    DeleteMappedDrives
    If isMember(“SPD President”) Then
    Set objNetwork = WScript.CreateObject(“WScript.Network”)
    objNetwork.MapNetworkDrive “S:” , “\\ad.dcu.ie\data\dept\spd\college admin\President”
    MsgBox”Drive S added successfully.” & vbcrlf & “The presidents section share is available in this new location.” & vbcrlf & vbcrlf & “Please contact the helpdesk if you have any questions.”,64,”Migration successfull”
    Else
    WMsgBox”False”
    End If

    End Function

    Function IsMember(groupName)
    If IsEmpty(groupListD) then
    Set groupListD = CreateObject(“Scripting.Dictionary”)
    groupListD.CompareMode = 1
    ADSPath = EnvString(“userdomain”) & “/” & EnvString(“username”)
    Set userPath = GetObject(“WinNT://” & ADSPath & “,user”)
    For Each listGroup in userPath.Groups
    groupListD.Add listGroup.Name, “-”
    Next
    End if
    IsMember = CBool(groupListD.Exists(groupName))
    End Function

    Function EnvString(variable)
    variable = “%” & variable & “%”
    EnvString = objShell.ExpandEnvironmentStrings(variable)
    End Function
    Set objShell = Nothing

    Function ScriptNotRunBefore
    Set WshNetwork = CreateObject(“WScript.Network”)
    RunBefore = “False”
    strComputer = WshNetwork.ComputerName
    set objFSO = CreateObject(“Scripting.FileSystemObject”)
    set objOutputFile = objFSO.GetFile(strOutputFile)
    set objTS = objOutputFile.OpenAsTextStream(1)

    ‘Loop through the output file to see if “Computer name in STRComputer” is found,
    ‘if it is then the script has run before.
    do while objTs.AtEndOfStream <> true
    sReadLine = objTs.ReadLine
    if instr(sReadLine, strComputer) > 0 then
    RunBefore = “True”
    exit do
    end if
    loop

    ‘Close output file and release objects
    objTS.close
    set objTS = nothing
    set strOutputFile = nothing
    set objFSO = nothing
    end function


  • VBS to inventory your workstations or servers

    Sometimes you just need a clear picture of what is in your environment.

    Sometimes you just need to see how much disk space, RAM and CPU capacity a few dozen workstations have available.

    Sometimes you walk into an office and you haven’t a clue what’s live, what’s turned off and what is very out of date.

    This script fixes all of that. Give it a text file with as many Windows workstations or servers as you like and let it go off and get the version of Windows, the license type, the RAM, CPU, Hard disk capacity, the software and hardware serial number and the Windows installation directory. It saves this into a CSV file that you can then open in Excel to sort and play with as much as you want.

    I wrote this to create an inventory of the servers in use here so I could see what version of windows they have, ensure they are using the most recent service pack and ensure they were all using the enterprise skew. I then expanded it to give me more information. Mainly so I can save it somewhere for use on a later date.

    On Error Resume Next

    Const ForReading = 1
    Const ForWriting = 2
    Const Forappend = 8
    filecomputer = “.\computer.txt” ‘ -> File that contains the computers list
    strComputer = “.”
    Star = “*”
    InventoryOutputFile = “inventory.txt”
    logfilename = “.\inventory.log”

    Dim hostname,OSType,CSDVersion,WinSerialNumber,Version,Windir,Timewritten,sw,Make,Model,CPU,Drives,TotalMemory,SerialNumber

    sw = 0

    ‘—————————————
    ‘ Call the routine for log file creation
    ‘—————————————

    createlogfile logfilename

    ‘————————
    ‘ Read computer.txt file
    ‘————————

    Set objFSO = CreateObject(“Scripting.FileSystemObject”)
    Set objTextFile = objFSO.OpenTextFile(filecomputer,ForReading)
    Do While objTextFile.AtEndOfStream <> True
    strLinetoParse = objTextFile.ReadLine
    First_char = Left(strLinetoParse, 1)
    if (First_char <> star) And (First_char <> ” “) then ‘ Bypass the row starting with * and blank char
    hostname = Trim(strLinetoParse)

    Get_user_info hostname
    If WinSerialNumber > 0 then ‘ If the computer exist or is UP
    hostname = strLinetoParse

    AddLineToOutputFile hostname,OSType,CSDVersion,WinSerialNumber,Version,Windir,TotalMemory,Make,Model,CPU,Drives,SerialNumber,Forappend
    WinSerialNumber = 0
    Else
    msg = “=====> Hostname ” & hostname & ” not found or Down”

    writetofile msg,Forappend
    End if
    End if
    Loop
    objTextFile.Close

    ‘————————————————–
    ‘ Retrieve the information from the remote computer
    ‘————————————————–

    Function Get_user_info(strComputer)
    Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)

    Set colItems = objWMIService.ExecQuery(“Select * from Win32_OperatingSystem”,,48)
    For Each objItem in colItems
    OSType = objItem.Caption
    CSDVersion = objItem.CSDVersion
    WinSerialNumber = objItem.SerialNumber
    Version = objItem.Version
    Windir = objItem.WindowsDirectory
    TotalMemory = Round(Trim(objItem.TotalVisibleMemorySize) / 1024, 2 /1024) /1024
    Next

    Set colItems = objWMIService.ExecQuery(“SELECT * FROM Win32_Processor”,,48)
    For Each objItem in colItems
    CPU = Trim(objItem.Name)
    Next

    Set colItems = objWMIService.ExecQuery(“SELECT * FROM Win32_LogicalDisk WHERE DriveType=3″,,48)
    For Each objItem in colItems
    Drives = Drives & Trim(objItem.DeviceID) & ” ” & Round(Trim(objItem.Size) / (1024^2), 2) & “;”
    Next

    Set colItems = objWMIService.ExecQuery(“SELECT * FROM Win32_ComputerSystem”,,48)
    For Each objItem in colItems
    Make = Trim(objItem.Manufacturer)
    Model = Trim(objItem.Model)
    Next

    Set colItems = objWMIService.ExecQuery(“SELECT * FROM Win32_BIOS”,,48)
    For Each objItem in colItems
    SerialNumber = Trim(objItem.SerialNumber)
    Next
    End function

    ‘————————
    ‘ Add/Update the records
    ‘————————

    function AddLineToOutputFile(hostname,OSType,CSDVersion,WinSerialNumber,Version,Windir,TotalMemory,Make,Model,CPU,Drives,SerialNumber,forwriting)
    ‘WScript.Echo hostname
    Set objFSO = CreateObject(“Scripting.FileSystemObject”)
    Set WriteInventory = objFSO.OpenTextFile(InventoryOutputFile,forwriting, True)
    WriteInventory.WriteLine(hostname & “,” & OSType & “,” & CSDVersion & “,” & WinSerialNumber & “,” & Version & “,” & Windir & “,” & TotalMemory & “,” & Make& “,” & Model & “,” & CPU & “,” & Drives & “,” & SerialNumber)
    WriteInventory.Close
    End function

    ‘———————
    ‘ Create the log file
    ‘———————

    function createlogfile(logfilename)
    Dim objFileSystem, objOutputFile
    Dim strOutputFile
    strOutputFile = logfilename
    Set objFileSystem = CreateObject(“Scripting.fileSystemObject”)
    Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE)
    objOutputFile.WriteLine(“——————— Inventory Report ” & now() & ” ———————“)
    objOutputFile.WriteLine(” “)
    objOutputFile.Close
    Set objFileSystem = Nothing
    End function

    ‘——————-
    ‘ Write to log file
    ‘——————-

    function writetofile(msg,forwriting)
    Set myFSO = CreateObject(“Scripting.FileSystemObject”)
    Set WriteStuff = myFSO.OpenTextFile(logfilename,forwriting, True)
    WriteStuff.WriteLine(“—————————————————————————“)
    WriteStuff.WriteLine(” “)
    WriteStuff.WriteLine(msg)
    WriteStuff.WriteLine(” “)
    WriteStuff.Close
    End function


  • Script to delete Chrome cache on all PC’s listed in a text file

    Another problem that could be fixed with a script today. Moving machines and users to a different domain resulted in a problem for some people. Chrome is a very popular browser but a number of people have reported to support that Chrome takes a very long time to start and then open the first page after log in to windows.

    It was determined that deleting the cache directory from within the users Chrome application data folder resolved this.

    Waiting for every effected user to report the problem wouldn’t be a great course of action of course. It would be a lot better to proactively go after all Chrome installations and remove the cache directory.

    So that’s what I’ve done. The script does the following:

    1. Check to see if the computer is on the network by pinging it.
    2. List all the user directories in c:\users on each computer.
    3. Check to see if the Chrome cache directory exists.
    4. Deletes the cache directory.
    5. Logs the result including any encountered errors to a file called results.txt.

    I could have searched Active Directory directly of course but I want to be able to easily add and remove computers when needed. It also allows me to run the script on 10 computers to start off and ramp up to a few thousand by the end.

    It should go without saying that as the script uses the admin share, you need to have access to the workstations that you intend to administer.

    Option Explicit
    Const ForReading = 1
    Const ForAppending = 8
    Dim objFSO : Set objFSO = CreateObject(“Scripting.FileSystemObject”)
    Dim objFile : Set objFile = objFSO.OpenTextFile(“Z:\Scripts\Chrome cleanup\AccountingsectionComputers.txt”, ForReading, False)
    Dim objWriteFile : Set objWriteFile = objFSO.OpenTextFile(“Z:\Scripts\Chrome cleanup\Result.txt”, ForAppending)

    Do Until objFile.AtEndOfStream
    Dim strComputer : strComputer = Trim(objFile.ReadLine)
    If PingMachine(strComputer) Then
    ‘Computer is pinging
    Dim objFolder : Set objFolder = objFSO.GetFolder(“\\” & strComputer & “\c$\users\”)
    Dim strUserParentPath : Set strUserParentPath = objFolder.SubFolders
    Dim strUserFolder
    For Each strUserFolder in strUserParentPath
    Dim strRemoteBasePath : strRemoteBasePath = “\\” & strComputer & “\c$\users\” & strUserFolder.name & “\AppData\Local\Google\Chrome\User Data\Default\Cache”
    If objFSO.FolderExists(strRemoteBasePath) Then
    On Error Resume Next
    objFSO.DeleteFolder strRemoteBasePath, True
    If Err.Number = 0 Then
    objWriteFile.WriteLine strRemoteBasePath & vbTab & ” DELETE SUCCESSFUL”
    Else
    objWriteFile.WriteLine strRemoteBasePath & vbTab & ” DELETE FAILED: ” & Err.Number & ” ” & Err.Description
    End If
    On Error GoTo 0
    Else
    objWriteFile.WriteLine strRemoteBasePath & vbTab & ” FOLDER DOES NOT EXIST”
    End If
    Next
    Else
    objWriteFile.WriteLine strComputer & vbTab & ” PING FAILED”
    End If
    Loop
    objFile.Close

    Function PingMachine(device_name)
    PingMachine = False
    Dim colItems : Set colItems = GetObject(“winmgmts:root\cimv2”).ExecQuery _
    (“Select StatusCode from Win32_PingStatus Where Address = ‘” & device_name & “‘”)
    Dim objItem
    For Each objItem in colItems
    If objItem.StatusCode = 0 Then PingMachine = True
    Next
    End Function

    If there are other scripts that you would like to see, please let me know in the comments section.