how to encryp function trigger of sqlserver.

hi,

Any documentation linke would be helpfull. i want to encrypt functions and triggers

$db = (new-Object Microsoft.SqlServer.Management.Smo.Server(“[DataBase Engine Name]”)).Databases.Item(“[DataBase Name]”)

Foreach ($sp in $db.StoredProcedures){
if(!$sp.IsSystemObject){
if (!$sp.IsEncrypted){
$sp.TextMode = $false;
$sp.IsEncrypted = $true;
$sp.TextMode = $true;
try{
$sp.Alter();
}catch{
Write-Host “$sp.Name fail to encrypted.”
}
}
}
}

yours scinelrey

You’d likely get a better answer from a SQL Server-specific forum. You’re not really “using PowerShell,” here, you’re using SQL Server Management Objects. Consider StackExchange, or perhaps the PASS forums, to find folks who are a bit more specialized in SQL Server and SMO.