how to encryp function trigger of sqlserver.

Welcome Forums General PowerShell Q&A how to encryp function trigger of sqlserver.

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
2 years, 1 month ago.

  • Author
    Posts
  • #62824

    Participant
    Points: 0
    Rank: Member

    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

  • #62848

    Keymaster
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    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.

The topic ‘how to encryp function trigger of sqlserver.’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort