Skip to main content

Posts

Showing posts with the label CodeSnippet

Register/Deregister ADO agents using PowerShell

 here is the script you can use to register/deregister ADO agents PARAM( [int] $NoofAgents, [string] $vsts_url = "https://dev.azure.com/name", [string] $vsts_pat, [string] $svcUserName = "domain\user", [string] $svcPassword, [string] $agentAction ) $agent_pool = 'Poolname'; $ErrorActionPreference="Stop"; If(-NOT (Test-Path $env:SystemDrive\'agents')) {mkdir $env:SystemDrive\'agents'}; Cd $env:SystemDrive\'agents'; if($agentAction -eq "register"){ Write-Host "Download Agent Zip from ADO..." -NoNewline $agentZip="$PWD\agent.zip"; $DefaultProxy=[System.Net.WebRequest]::DefaultWebProxy; $securityProtocol=@(); $securityProtocol+=[Net.ServicePointManager]::SecurityProtocol; $securityProtocol+=[Net.SecurityProtocolType]::Tls12; [Net.ServicePointManager]::SecurityProtocol=$securityProtocol; $WebClient=New-Object N...

Form (UI) for your excel sheet

  What is VBA, Why Should You Care? Visual Basic  for Applications (VBA) is the programming language behind Microsoft Office Products. It enables a programmer to automate these products. For example, you could write VBA code that enables the user to simply click a button.  The code could then take the graphs, tables, etc. that were automatically created in Excel and produce a slide deck. This slide deck could then be emailed to a set group of users within Outlook. All this can be completely automated. The applications of VBA are mind-blowing, in fact, I have had automated my job using VBA.  What Do You Need You only need Microsoft Excel. A great feature about VBA is that you do not need any other standalone editor, the editor is included within Excel. You can start  creating user forms to get yourself familiar with VBA. I chose a UserForm as an introduction to VBA because it showcases how you can turn an otherwise boring Excel spreadsheet into a Graphical User I...

Enable Trace on Dynamcis 365 on premise using PowerShell

Enable trace settings through Windows PowerShell Note These changes made in Windows PowerShell do not update the Registry. These changes update the DeploymentProperties and ServerSettingsProperties tables in the MSCRM_CONFIG database. Register the cmdlets 1.      Log in to the administrator account on your Microsoft Dynamics CRM server. 2.      In a Windows PowerShell window, type the following command: Add-PSSnapin Microsoft.Crm.PowerShell To obtain a list of the current settings, type the following command: Get-CrmSetting TraceSettings Set the trace settings 1.      Type the following command: $setting = Get-CrmSetting TraceSettings 2.      Type the following command to enable tracing: $setting.Enabled=$True 3.      Type the following command to set the trace settings: Set-CrmSetting $setting 4.      Type the following command...

Check and Create a Node in XML, if it does not existing using PowerShell

Here is a quick code snippet to Add a Node in XML from from the XPath, the following PowerShell function will search for the node hierarchy, if it does not exist then it will create it. function   CheckForXMLNode  {      param  (          $File , # File Path of XML to search the node          $NodePath     )      $nodes  =  $NodePath  -split  "/"      $path  =  "//Configuration"      # My Sample Node Path is like this # //Configuration/Farm/CustomParent/CustomChild      foreach  ( $node   in   $nodes ) {          if  ( ( $node  -ne  "" ) -and ( $node  -ne  "Configuration" ) ) {   ...