Pages

Friday, April 10, 2020

Convert UserName to SID and SID to UserName

Convert UserName to SID and SID to UserName

Here is a simple PowerShell Script to convert a UserName to SID and SID to UserName. 
It can also be used to convert Local User Name to SID and Local SID to Local User Name.

######################################################################################
# Use this script to translate UserName to SID,                                
# SID to UserName and Local user to SID.                                       
# Script Written by Prakash Kumar (6th April 2020)                
######################################################################################

param($SID,
$ADUSER,
$LOCALUSER)

#Enter Your Domain Name Here:
$DOMAIN = "DomainName"

if ($SID)
    {
        $UserSID = New-Object System.Security.Principal.SecurityIdentifier("$SID")
        $UserID = $UserSID.Translate( [System.Security.Principal.NTAccount])
        Write-output "$SID `t : $UserID"
    }
ElseIf ($ADUSER)
    {
        $UserID = New-Object System.Security.Principal.NTAccount("$DOMAIN", "$ADUSER")
        $strSID = $UserID.Translate([System.Security.Principal.SecurityIdentifier])
        Write-output "$ADUSER `t : $strSID"
       
    }
ElseIf ($LOCALUSER)
    {
        $UserID = New-Object System.Security.Principal.NTAccount("$LOCALUSER")
        $strSID = $UserID.Translate([System.Security.Principal.SecurityIdentifier])
        Write-output "$LOCALUSER `t : $strSID"

    }

 Here is the screenshot from the above script:



Friday, January 24, 2020

Creating a Custom Catalog for Dell PowerEdge Servers using Dell Repository Manager


Create a Custom Firmware Update bundle using Dell Repository Manager Version 2.2.0

To update firmware of Dell servers, Dell provides many methods like SUU (Server Update Utility), Bootable ISO, Individual firmware packages etc.

Sometimes we need to install some specific version of firmwares for different components on our Dell servers and for that we need to create a Custom firmware repository for which Dell has published a utility called Dell Repository Manager.

I am going to show the steps required for creating a custom Firmware Bundle along with a Catalog file (catalog.xml) using Dell Repository Manager.

We will be using Data Center Version because we need to build a repository for Enterprise Devices (PowerEdge Servers).


Wednesday, January 15, 2020

Install a bat file or cmd script as service on a Windows Server machine.

Install a bat file or cmd script as service on a Windows Server machine.

To install a Bat file or CMD script as a Service we would need a small Microsoft utility called srvany.exe which is part of the Windows Server 2003 Resource Kit tools and can be downloaded free from Microsoft Download center here.

Steps:

·        Download Windows Server 2003 Resource Kit tools from here and install it on any server.

·        Create a folder on your server ex C:\YourServiceName

·        Just copy srvany.exe to C:\YourServiceName from the location where Resource Kit tools were installed (usually C:\Program Files (x86)\Windows Resource Kits\Tools\), after this step Windows Server 2003 Resource Kit tools can be uninstalled as it is no longer needed.

·        Launch CMD as Administrator.

·        Type following Command which will install a service named YourServiceName on the server

 sc create YourServiceName binpath= C:\YourServiceName\srvany.exe DisplayName= "Your Service Name"

·        Open Registry editor by Clicking Start > regedit

·        Navigate to following location and right click and create a New key named YourServiceName

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\YourServiceName

·        Right Click on YourServiceName  and Create another key named Parameters under that.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\YourServiceName\Parameters

·        Under Parameters Right Click in the righthand pane and select New String Value named Application Under that.

·        Double Click the String Value named Application mention the Path of your bat file/cmd script there.

At this point we are done and we can now start the service and set the mode of the service to Automatic/Manual or whatever we want as per our need and the service will keep running which in background will run the Batch file/CMD Script continuously.