SQL Server 2016 Database Mail not working
paul | Friday, 30 November 2018 | SQL Server | mail

After configuring SQL Server 2016 Database Mail then running a test the server fails to transmit the emails.

If you go to the binn folder for the SQL Server and then double click on the DatabaseMail.exe it displays the error message below:

Using Add/Remove roles, in Server Manager, to install .NET Framework 3.5 Features\.NET Framework 3.5 (includes .NET 2.0 and 3.0).

Once the framework has installed then Database Mail works when tested.

Display Comments...
Backup of Windows Certificate Authority
paul | Thursday, 29 November 2018 | Windows | Powershell

To backup the data for a Windows Certificate Authority you can run the powershell command below on the server with the role installed.

Backup-CARoleService "c:\backupfolder" -Password (Read-Host -prompt "Password:" -AsSecureString)

This will create a backup of the database and the certificate in case something goes wrong. To restore use the following command:

Restore-CARoleService "c:\backupfolder" -Password (Read-Host -Prompt "Password:" -AsSecureString)

To run as a scheduled task you can create a secure password file and feed that into the script below:

# Backup Certificate Authority
# To create password file run: (Get-Credential).Password | ConvertFrom-SecureString | Out-File "Password.txt"
$pass = Get-Content "Password.txt" | ConvertTo-SecureString
 
$date = Get-Date
$date = $date.ToString("dd-MM-yyyy")
Backup-CARoleService "c:\backups\$date" -Password $pass
 
Then the data can be restored easily if something goes wrong with your certificate authority server.
 
Display Comments...
Kace client msi set language
paul | Tuesday, 27 November 2018 | Kace | MSI

Before deploying the Kace client MSI via group policy it is neccessary to change the language setting from Chinese to English US.

This can be done by running the following vbs:

cscript setlang.vbs ampagent-9.0.167-x86_kace01.msi 1033

 

setlang.vbs

Dim argCount : argCount = Wscript.Arguments.Count
If (argCount < 2) Then
Wscript.Echo "setlang.vbs - Modify the package language field of an MSI installer file" & vbNewLine & vbNewLine & _
"usage: cscript setlang.vbs <msi_file_path> <lcid>" & vbNewLine & vbNewLine & _
"example: cscript setlang.vbs C:\temp\ampagent-5.4.1000-x86.msi 1033" & vbNewLine & vbNewLine & _
"Copyright (C) 2012 Dell Inc.  All rights reserved."
Wscript.Quit 1
End If
 
Dim dbPath : dbPath = Wscript.Arguments(0)
Dim lcid : lcid = Wscript.Arguments(1)
 
On Error Resume Next
Dim installer : Set installer = Nothing
Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError
Dim database : Set database = installer.OpenDatabase(dbPath, 1) : CheckError
Dim sumInfo : Set sumInfo = database.SummaryInformation(1) : CheckError
Dim template : template = sumInfo.Property(7) : CheckError
Dim iDelim : iDelim = InStr(1, template, ";", vbTextCompare)
Dim platform : If iDelim = 0 Then platform = ";" Else platform = Left(template, iDelim)
sumInfo.Property(7) = platform & lcid
sumInfo.Persist : CheckError
database.Commit : CheckError
Set database = nothing
Wscript.Echo "Successfully set package language = " & lcid
Wscript.Quit 0
 
Sub CheckError
Dim msg, errRec
If Err = 0 Then Exit Sub
msg = Err.Source & " " & Hex(Err) & ": " & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then msg = msg & vbNewLine & errRec.FormatText
End If
Wscript.Echo msg
Wscript.Quit 2
End Sub

Now a software distribution policy can be created in group policy and applied to your machines.

Display Comments...
Copy Distribution List membership with Powershell
paul | Thursday, 22 November 2018 | Office365 | Powershell

To copy a distribution list in Exchange Online use the following commands to list the membership of one group (GROUP1) and add them to another group (GROUP2):

Get-DistributionGroupMember -Identity "GROUP1" | % {Add-DistributionGroupMember -Identity "GROUP2" -Member $_.PrimarySmtpAddress}

To verify the member numbers, after the copy, run the following commands:

$total= Get-DistributionGroupMember -Identity "GROUP2"; $total.count

Display Comments...
Attaching Onedrive file to Outlook 2016 email fails
paul | Tuesday, 20 November 2018 | Outlook | Onedrive

In Outlook 2016 when attaching a file from OneDrive it fails with the error "The operation failed".

Setting the Internet Explorer Advanced 11 Option (Internet Options->Advanced tab->Security section) to untick "Do not save encrypted pages to disk"  fixed it for me. 

Display Comments...
Page 1 of 70 (352 Articles) << 1 2 3 4 5  Next >>