Jump to content

Recommended Posts

Posted

Hi Guys,

 

Wanted to know if anyone has paid for Net2ADSyncServer/COSMO AD2Paxton? i am looking at this but costs around 1K however im pretty sure i can AI it on a whim. Has anyone done either yet?

 

 

I haevnt tested yet but will be doing soon if anyone is interested then a basic app to run as service and then run on regular intervals. be keen to hear peoples throughts. the aim of this is so Inventry also registers a staff badge on AD too so inventry is the single point of contact for all cards. let me know!

 

# --- CONFIGURATION ---
$SQLServer   = "YOUR-NET2-SERVER\NET2"  # Change to your Net2 SQL Instance
$Database    = "Net2"
$ADAttribute = "pager"                  # Change to your target AD attribute (e.g., extensionAttribute1)

# --- SQL QUERY TO FETCH NET2 CARDS ---
# This query matches Net2 users to their active token numbers
$SqlQuery = @"
SELECT 
    u.RegistrationField_Username AS Username,
    t.TokenNumber AS CardNumber
FROM dbo.Viewing_Users u
JOIN dbo.Viewing_Tokens t ON u.UserID = t.UserID
WHERE t.Status = 1 -- 1 means the token is active/enabled
AND u.RegistrationField_Username IS NOT NULL
AND u.RegistrationField_Username != ''
"@

# --- EXECUTE ENGINE ---
Write-Output "Connecting to Net2 SQL Server: $SQLServer..."

try {
    # Connect and fetch data using SqlServer module or standard .NET SqlClient
    $ConnectionString = "Server=$SQLServer;Database=$Database;Trusted_Connection=True;Timeout=30;"
    $SqlConnection = New-Object System.Data.SqlClient.SqlConnection($ConnectionString)
    $SqlCmd = New-Object System.Data.SqlClient.SqlCommand($SqlQuery, $SqlConnection)
    $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter($SqlCmd)
    $DataTable = New-Object System.Data.DataTable
    
    $SqlConnection.Open()
    $SqlAdapter.Fill($DataTable) | Out-Null
    $SqlConnection.Close()
    
    Write-Output "Successfully retrieved $($DataTable.Rows.Count) active card mappings from Net2."
}
catch {
    Write-Error "Failed to connect or query Net2 SQL Server. Error: $_"
    if ($SqlConnection.State -eq "Open") { $SqlConnection.Close() }
    Exit
}

# --- WRITE BACK TO ACTIVE DIRECTORY ---
Import-Module ActiveDirectory

foreach ($Row in $DataTable) {
    $Username   = $Row.Username.Trim()
    $CardNumber = $Row.CardNumber.ToString().Trim()

    Write-Output "Processing User: $Username (Card: $CardNumber)..."

    # Verify user exists in Active Directory
    $ADUser = Get-ADUser -Filter "SamAccountName -eq '$Username'" -Properties $ADAttribute

    if ($ADUser) {
        # Check if the attribute already matches to prevent unnecessary AD writes
        if ($ADUser.$ADAttribute -eq $CardNumber) {
            Write-Output " -> Match found. AD is already up to date."
        }
        else {
            try {
                # Construct hash table dynamically for the target attribute
                $ReplaceHash = @{ $ADAttribute = $CardNumber }
                Set-ADUser -Identity $ADUser.SamAccountName -Replace $ReplaceHash
                Write-Output " -> SUCCESS: Updated AD attribute '$ADAttribute' with Card '$CardNumber'."
            }
            catch {
                Write-Error " -> ERROR: Failed to update AD for $Username. Error: $_"
            }
        }
    }
    else {
        Write-Warning " -> WARNING: Username '$Username' found in Net2 but does not exist in Active Directory."
    }
}

Write-Output "Sync task complete."

Posted
3 minutes ago, thebatman said:

I know this is not the area you are looking at, but do you have SalamanderSoft? if so, they can do this for you.

 

I have asked and said they couldn't do it a few months back?

Posted

As long as the data is AD and you know how the conversion is done, they are able to do this.

(thow I know they do have an issue with the latest version of Paxton(v7) software, but i belive there is a fix in the pipeline)

Posted

We've been using Net2ADSyncServer for several years now.  Does the job for us quite nicely.

 

The process for us is that a user (be it staff or student) is given their badge which they have to register on a MFD (running PaperCut) using the AD account.  This creates the Card ID number in PaperCut.  I have a script that runs automatically every 30 mins of so that dumps a userlist with their card ID number and this is copied into the Fax number of their AD account.  The Net2ADSyncServer system then generates the necessary user account in Net2 based on their User Groupings in AD.

 

However.... Net2ADSyncServer has recently been acquired by another company and are moving over to a subscription based version of the software to support the newer version of Net2 (2.7 I believe?) and claim their current version won't necessarily work on the newer Net2 installs.  Before that it was just a perpertual license with free updates.... remember those days? ;)

 

I'm looking to rethink this now in the future, as we use Locker and I know we should be able to use this to create accounts in Net2 which will mean that we will have to manually register the cards against the user - just something I won't enjoy doing for the influx of Sixth Form students each year.

 

Pete

 

Posted
1 hour ago, FragglePete said:

We've been using Net2ADSyncServer for several years now.  Does the job for us quite nicely.

 

The process for us is that a user (be it staff or student) is given their badge which they have to register on a MFD (running PaperCut) using the AD account.  This creates the Card ID number in PaperCut.  I have a script that runs automatically every 30 mins of so that dumps a userlist with their card ID number and this is copied into the Fax number of their AD account.  The Net2ADSyncServer system then generates the necessary user account in Net2 based on their User Groupings in AD.

 

However.... Net2ADSyncServer has recently been acquired by another company and are moving over to a subscription based version of the software to support the newer version of Net2 (2.7 I believe?) and claim their current version won't necessarily work on the newer Net2 installs.  Before that it was just a perpertual license with free updates.... remember those days? ;)

 

I'm looking to rethink this now in the future, as we use Locker and I know we should be able to use this to create accounts in Net2 which will mean that we will have to manually register the cards against the user - just something I won't enjoy doing for the influx of Sixth Form students each year.

 

Pete

 

Do you use Inventry? we have MIS SIMS > Inventry > Paxton so its throwing in somehwere and looking for a script or AI a little too for regular sync.

man i miss the days of perpetual!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...