Skip to content

Instantly share code, notes, and snippets.

View DarkAllien's full-sized avatar

Octavian Cordos DarkAllien

View GitHub Profile
--DECLARE @UserSIDs VARCHAR(16) = 'disabled';
--DECLARE @CollID VARCHAR(8)= 'CollID for Testing';
declare @AuthListLocalID as int
select @AuthListLocalID=CI_ID from v_AuthListInfo
where CI_UniqueID=@AuthListID
SELECT DISTINCT
[rs].[NetBios_Name0] AS [Name],
CASE
Remove-Item $DirFiles\..\a.* -recurse -force
Import-Certificate -FilePath "$DirFiles\Certificates\VismaRootCA.cer" -CertStoreLocation Cert:\LocalMachine\Root -ErrorAction 'Continue'
Import-Certificate -FilePath "$DirFiles\Certificates\VismaIntCA.cer" -CertStoreLocation Cert:\LocalMachine\Root -ErrorAction 'Continue'
start-process $DirFiles\..\getcertificate.bat
Execute-Process -FilePath "CCMSETUP.EXE" -Parameters "/Source:$DirFiles /NoService /UsePKICert /NoCRLCheck CCMHOSTNAME=IPVITCMSCMG001.CLOUDAPP.NET/CCM_Proxy_MutualAuth/72057594037927955 SMSSITECODE=VIT CCMALWAYSINF=1 CCMFIRSTCERT=1 SMSSIGNCERT=$DirFiles\Certificates\SMS_Signing_Certificate.cer "
Function Get-TSM_Content {
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, Position = 0)]
[Alias('SourceLocation')]
[String]$Source,
[Alias('PatternMatch')]
[String]$Pattern
)
$result = Select-String -Path $Source -pattern $Pattern
//========================
// Added extensions start
//========================
//——————————————— // SQL 2017 Properties //———————————————
[UNION, ViewSources{"select IsReadOnly,PropertyIndex,PropertyName,PropertyNumValue,PropertyStrValue,PropertyValueType,ServiceName,SqlServiceType from sqlServiceAdvancedProperty"},ViewSpaces{"\\\\.\\root\\microsoft\\sqlserver\\computermanagement14"}, dynamic,Provider("MS_VIEW_INSTANCE_PROVIDER")]
class SQL_2017
{
//——————————————— // SQL 2017 Properties //———————————————
[dynamic, provider("MS_VIEW_INSTANCE_PROVIDER"),
SMS_Report(TRUE),
SMS_Group_Name("SQL 2017 Property"),
SMS_Class_ID("CUSTOM|SQL_2017_Property|2.0")]
class SQL_2017 : SMS_Class_Template
{
[SMS_Report(TRUE) ] Boolean IsReadOnly;
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition">
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="DataSource18">
<DataSourceReference></DataSourceReference>
<rd:SecurityType>None</rd:SecurityType>
<rd:DataSourceID>6c697feb-bfb1-4005-9208-25d285db2f5f</rd:DataSourceID>
</DataSource>
</DataSources>
<#
************************************************************************************************
This Script used for SQL Version Detection
************************************************************************************************
Created by: Ioan Popovici, 18/03/2015
************************************************************************************************
ModIfied by: Octavian Cordos, 21/03/2018
************************************************************************************************
#>
<#
.SYNOPSIS
This script performs the installation or uninstallation of an application(s).
.DESCRIPTION
The script is provided as a template to perform an install or uninstall of an application(s).
The script either performs an "Install" deployment type or an "Uninstall" deployment type.
The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install.
The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
.PARAMETER DeploymentType
The type of deployment to perform. Default is: Install.
$time = Get-Date
"$time - CI.SQL.Servers.AppEval - Evaluation - Creating Application Evaluation Schedulled Task" | out-file "$env:windir\Logs\CB.SQL.Servers.Updates.log" -Append
Unregister-ScheduledTask -TaskName SCCMAppEval -Confirm:$False -ErrorAction Ignore | Out-Null
$taskname = "SCCMAppEval"
$taskdescription = "SCCMAppEval"
$action = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument "-Noprofile -Windowstyle Hidden -command & {Invoke-WmiMethod -Namespace root\ccm -Class sms_client -Name TriggerSchedule -ArgumentList '{00000000-0000-0000-0000-000000000121}'}"
$trigger = New-ScheduledTaskTrigger -AtStartup -RandomDelay (New-TimeSpan -minutes 10)
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Minutes 5) -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1)
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $taskname -Description $taskdescription -Settings $settings -User "System" -RunLevel Highest | Out-Null
Function Installation_InProgress {
<#
.SYNOPSIS
The function will check if there are updates in progress
.DESCRIPTION
#>
$Installing = $False
$installing_app = $False
$SCCMUpdate = get-wmiobject -query "SELECT * FROM CCM_SoftwareUpdate" -namespace "ROOT\ccm\ClientSDK"
if (@($SCCMUpdate | Where-Object {($_.EvaluationState -ge 2 -and $_.EvaluationState -le 7) -or $_.EvaluationState -eq 11 }).length -ne 0) { $installing = $true } else { $installing = $false }