{"id":456544,"date":"2025-04-24T08:39:14","date_gmt":"2025-04-24T08:39:14","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=456544"},"modified":"2025-04-24T08:39:14","modified_gmt":"2025-04-24T08:39:14","slug":"automatisierung-der-connectwise-screenconnect-bereitstellung","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/de\/script-hub\/automatisierung-der-connectwise-screenconnect-bereitstellung\/","title":{"rendered":"Automatisierung der ConnectWise ScreenConnect-Bereitstellung mit PowerShell"},"content":{"rendered":"<h2>Wichtigste Erkenntnisse<\/h2>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><strong>Automatisierte Effizienz<\/strong>: Das PowerShell-Skript f\u00fcr die Installation von ConnectWise ScreenConnect automatisiert und vereinfacht den Bereitstellungsprozess und steigert die betriebliche Effizienz.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><strong>Anpassbare Installation<\/strong>: Es unterst\u00fctzt die dynamische URL-Erstellung f\u00fcr benutzerdefinierte Installationen auf der Grundlage von Parametern wie Organisationsname, Standort und Ger\u00e4tetyp.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><strong>Breite Anwendbarkeit<\/strong>: Ideal f\u00fcr MSPs und IT-Expert:innen, die mehrere Ger\u00e4te an verschiedenen Standorten verwalten.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"4\" data-aria-level=\"1\"><strong>Erweiterte Funktionen<\/strong>: Bietet Funktionen wie \u00dcberpr\u00fcfung des Installationsstatus und Fehlerprotokollierung und \u00fcbertrifft damit herk\u00f6mmliche manuelle oder Batch-Skript-Methoden.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"5\" data-aria-level=\"1\"><strong>Kompatibilit\u00e4t und Beschr\u00e4nkungen<\/strong>: Funktioniert am besten mit Windows 8, Server 2012 und neueren Versionen, mit m\u00f6glichen Einschr\u00e4nkungen bei \u00e4lteren Versionen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"6\" data-aria-level=\"1\"><strong>Sicherheitserw\u00e4gungen<\/strong>: Benutzer:innen m\u00fcssen das Skript \u00fcberpr\u00fcfen und verstehen, um die Sicherheit zu gew\u00e4hrleisten, insbesondere in MSP-Umgebungen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"7\" data-aria-level=\"1\"><strong>NinjaOne-Integration<\/strong>: Dieses Skript passt gut zu NinjaOnes einheitlichem IT-Management-Ansatz und bietet eine zentralisierte L\u00f6sung f\u00fcr IT-Expert:innen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"8\" data-aria-level=\"1\"><strong>Kontinuierliche Anpassung<\/strong>: Regelm\u00e4\u00dfige Updates und \u00c4nderungen des Skripts k\u00f6nnen erforderlich sein, um es an die neuesten Versionen von ConnectWise ScreenConnect anzupassen.<\/li>\n<\/ul>\n<p>In der dynamischen Welt der IT sind Effizienz und Automatisierung der Schl\u00fcssel zur Erhaltung eines Wettbewerbsvorteils. Die Skripterstellung hat sich zu einem wichtigen Werkzeug entwickelt, mit dem IT-Expert:innen komplexe Prozesse rationalisieren k\u00f6nnen. Das PowerShell-Skript zur Installation von ConnectWise ScreenConnect ist ein Beispiel daf\u00fcr und bietet eine ausgefeilte L\u00f6sung f\u00fcr die Fernverwaltung und den Support.<\/p>\n<h2>Kontext<\/h2>\n<p><a href=\"https:\/\/www.ninjaone.com\/de\/integrations\/connectwise-screenconnect\/\">ConnectWise ScreenConnect<\/a>, ein beliebtes Tool f\u00fcr Remote-Support und -Management, wird h\u00e4ufig von IT-Expert:innen und <a href=\"https:\/\/www.ninjaone.com\/de\/was-ist-ein-msp\/\">Managed Service Providern (MSPs)<\/a> eingesetzt. Seine F\u00e4higkeit, den Fernzugriff auf Ger\u00e4te zu erleichtern, ist in den zunehmend dezentralisierten Arbeitsumgebungen von heute unerl\u00e4sslich. Dieses PowerShell-Skript vereinfacht den Bereitstellungsprozess von ScreenConnect und l\u00f6st damit eine h\u00e4ufige Herausforderung f\u00fcr IT-Teams &#8211; eine effiziente, skalierbare und automatisierte Softwareinstallation.<\/p>\n<h2>Das Skript zur Automatisierung der ConnectWise ScreenConnect-Bereitstellung<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">&lt;#\r\n.SYNOPSIS\r\nDownload and Install ConnectWise ScreenConnect from the domain used for ScreenConnect. Supports automatic customization of the device type, location and other ScreenConnect Fields.\r\n\r\n.DESCRIPTION\r\nDownload and Install ConnectWise ScreenConnect from the domain used for ScreenConnect. Supports automatic customization of the device type, location and other ScreenConnect Fields.\r\n\r\n.EXAMPLE\r\n-ScreenConnectDomain \"testscreen.screenconnect.com\" -UseOrgName -UseLocation -UseDeviceType\r\n\r\nInstaller Log File location will be: C:WindowsTEMPtmp9A50.tmp\r\nScreenConnect Client (abcd123456) is not installed and will be installed.\r\nAttempting to build from domain...\r\nURL Built: https:\/\/testscreen.screenconnect.com\/Bin\/Test Company.ClientSetup.msi?e=Access&amp;y=Guest&amp;c=Kyle - OOB&amp;c=Main Office&amp;c=&amp;c=Workstation&amp;c=&amp;c=&amp;c=&amp;c=\r\nURL Given, Downloading the file...\r\nDownload Attempt 1\r\nExit Code: 0\r\nSuccess\r\n\r\nPRESET PARAMETER: -ScreenConnectDomain \"your.domain.com\"\r\nYour ScreenConnect instance's domain name. The script will use this to construct a download URL from scratch with the options you selected.\r\n\r\nPRESET PARAMETER: -UseOrgName\r\nModifies your URL to use the organization name in the Company Name Field in ScreenConnect.\r\n\r\nPRESET PARAMETER: -UseLocation\r\nModifies your URL to use the Location Name in the Site Name Field in ScreenConnect.\r\n\r\nPRESET PARAMETER: -UseDeviceType\r\nModifies your URL to include the type of device in ScreenConnect. (Server, Workstation, Laptop etc.)\r\n\r\nPRESET PARAMETER: -Department \"Your Department Name Here\"\r\nModifies your URL to include your desired department name in ScreenConnect.\r\n\r\nPRESET PARAMETER: -SkipSleep\r\nBy default the script sleeps for a random interval between 3 and 60 seconds prior to downloading the file. This parameter skips the sleep.\r\n\r\nPRESET PARAMETER: -Force\r\nIf ScreenConnect is already installed attempt to install it anyways.\r\n\r\n.NOTES\r\nMinimum OS Architecture Supported: Windows 8, Windows Server 2012\r\nCan work on lower versions of Windows, provided that the OS\/.NET is able to download the file. PowerShell 2.0 might face issues due to its lack of TLS support in .NET 2.0.\r\n\r\nAdapted from Chris White's script: https:\/\/ninjarmm.zendesk.com\/hc\/en-us\/community\/posts\/7549797399821-Connectwise-Control-Installer\r\n\r\nRelease Notes: Initial Release\r\nBy using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https:\/\/www.ninjaone.com\/terms-of-use.\r\n    Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. \r\n    Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. \r\n    Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. \r\n    Warranty Disclaimer: The script is provided \u201cas is\u201d and \u201cas available\u201d, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. \r\n    Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. \r\n    Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. \r\n    EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).\r\n#&gt;\r\n#&gt;\r\n\r\n[CmdletBinding()]\r\nparam (\r\n    # Change the defaults if you don't wish to use parameters when running this script\r\n    [Parameter()]\r\n    [String]$MSI = \"ClientSetup.msi\",\r\n    [Parameter()]\r\n    [String]$DestinationFolder = \"$env:TEMP\",\r\n    [Parameter()]\r\n    [String]$ScreenConnectDomain,\r\n    [Parameter()]\r\n    [String]$InstanceID,\r\n    [Parameter()]\r\n    [Switch]$UseOrgName = [System.Convert]::ToBoolean($env:useNinjaOrganizationName),\r\n    [Parameter()]\r\n    [Switch]$UseLocation = [System.Convert]::ToBoolean($env:useNinjaLocationName),\r\n    [Parameter()]\r\n    [Switch]$UseDeviceType = [System.Convert]::ToBoolean($env:addDeviceType),\r\n    [Parameter()]\r\n    [String]$Department,\r\n    [Parameter()]\r\n    [Switch]$SkipSleep = [System.Convert]::ToBoolean($env:skipSleep),\r\n    [Parameter()]\r\n    [Switch]$Force = [System.Convert]::ToBoolean($env:force)\r\n)\r\nbegin {\r\n    # If Script Form is used replace the parameters with what was filled in.\r\n    if ($env:screenconnectDomainName -and $env:screenconnectDomainName -notlike \"null\") { $ScreenConnectDomain = $env:screenconnectDomainName }\r\n    if ($env:department -and $env:department -notlike \"null\") { $Department = $env:department }\r\n\r\n    # Some means of installing the file is required.\r\n    if (-not ($ScreenConnectDomain)) { Write-Error \"A domain is required to install control.\"; exit 1 }\r\n\r\n    if ($ScreenConnectDomain -match \"^http(s)?:\/\/\") {\r\n        Write-Warning \"http(s):\/\/ is not part of the domain name. Removing http(s):\/\/ from your input....\"\r\n        $ScreenConnectDomain = $ScreenConnectDomain -replace \"^http(s)?:\/\/\"\r\n        Write-Warning \"New Domain Name $ScreenConnectDomain.\"\r\n    }\r\n\r\n    if ($ScreenConnectDomain -match \"^C:\/\") {\r\n        Write-Error \"It looks like you entered in a file path by mistake. We actually need the domain name used to reach your ScreenConnect website for example 'companyname.screenconnect.com'\"\r\n        exit 1\r\n    }\r\n    \r\n    #### Helper functions used throughout the script ####\r\n\r\n    function Test-IsElevated {\r\n        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()\r\n        $p = New-Object System.Security.Principal.WindowsPrincipal($id)\r\n        $p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)\r\n    }\r\n\r\n    # Extract the ProductName from the msi\r\n    function Get-ControlPanelName {\r\n        [CmdletBinding()]\r\n        param (\r\n            [Parameter()]\r\n            [string]$msiPath\r\n        )\r\n        $windowsInstaller = New-Object -ComObject WindowsInstaller.Installer\r\n        $database = $windowsInstaller.GetType().InvokeMember(\"OpenDatabase\", \"InvokeMethod\", $null, $windowsInstaller, @($msiPath, 0))\r\n        $query = \"SELECT `Value` FROM `Property` WHERE `Property` = 'ProductName'\"\r\n\r\n        $view = $database.GetType().InvokeMember(\"OpenView\", \"InvokeMethod\", $null, $database, $query)\r\n        $view.GetType().InvokeMember(\"Execute\", \"InvokeMethod\", $null, $view, $null)\r\n\r\n        $record = $view.GetType().InvokeMember(\"Fetch\", \"InvokeMethod\", $null, $view, $null)\r\n        if ($record) {\r\n            return $record.GetType().InvokeMember(\"StringData\", \"GetProperty\", $null, $record, 1)\r\n        }\r\n\r\n        [System.Runtime.InteropServices.Marshal]::ReleaseComObject($windowsInstaller) | Out-Null\r\n        [System.GC]::Collect()\r\n    }\r\n\r\n    # Is it a Server or Desktop OS?\r\n    function Get-ProductType {\r\n        if ($PSVersionTable.PSVersion.Major -ge 5) {\r\n            $OS = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object ProductType -ExpandProperty ProductType\r\n        }\r\n        else {\r\n            $OS = Get-WmiObject -Class Win32_OperatingSystem | Select-Object ProductType -ExpandProperty ProductType\r\n        }\r\n        \r\n        return $OS\r\n    }\r\n\r\n    # Check the Chassis type to find out if it's a laptop or not.\r\n    function Test-IsLaptop {\r\n        if ($PSVersionTable.PSVersion.Major -ge 5) {\r\n            $Chassis = Get-CimInstance -ClassName win32_systemenclosure | Select-Object ChassisTypes -ExpandProperty ChassisTypes\r\n        }\r\n        else {\r\n            $Chassis = Get-WmiObject -Class win32_systemenclosure | Select-Object ChassisTypes -ExpandProperty ChassisTypes\r\n        }\r\n\r\n        switch ($Chassis) {\r\n            9 { return $True }\r\n            10 { return $True }\r\n            14 { return $True }\r\n            default { return $False }\r\n        }\r\n    }\r\n\r\n    # Check's the two uninstall registry keys to see if the app is installed. Needs the name as it would appear in Control Panel.\r\n    function Find-UninstallKey {\r\n        [CmdletBinding()]\r\n        param (\r\n            [Parameter(ValueFromPipeline = $True)]\r\n            [String]$DisplayName,\r\n            [Parameter()]\r\n            [Switch]$UninstallString\r\n        )\r\n        process {\r\n            $UninstallList = New-Object System.Collections.Generic.List[Object]\r\n\r\n            $Result = Get-ChildItem HKLM:SoftwareWow6432NodeMicrosoftWindowsCurrentVersionUninstall* | Get-ItemProperty | Where-Object { $_.DisplayName -like \"*$DisplayName*\" }\r\n            if ($Result) { $UninstallList.Add($Result) }\r\n\r\n            $Result = Get-ChildItem HKLM:SoftwareMicrosoftWindowsCurrentVersionUninstall* | Get-ItemProperty | Where-Object { $_.DisplayName -like \"*$DisplayName*\" }\r\n            if ($Result) { $UninstallList.Add($Result) }\r\n\r\n            # Programs don't always have an uninstall string listed here so to account for that I made this optional.\r\n            if ($UninstallString) {\r\n                $UninstallList | Select-Object -ExpandProperty UninstallString -ErrorAction SilentlyContinue\r\n            }\r\n            else {\r\n                $UninstallList\r\n            }\r\n        }\r\n    }\r\n\r\n    # Handy download function\r\n    function Invoke-Download {\r\n        param(\r\n            [Parameter()]\r\n            [String]$URL,\r\n            [Parameter()]\r\n            [String]$Path,\r\n            [Parameter()]\r\n            [Switch]$SkipSleep\r\n        )\r\n        Write-Host \"URL given; downloading the file...\"\r\n\r\n        $SupportedTLSversions = [enum]::GetValues('Net.SecurityProtocolType')\r\n        if ( ($SupportedTLSversions -contains 'Tls13') -and ($SupportedTLSversions -contains 'Tls12') ) {\r\n            [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol::Tls13 -bor [System.Net.SecurityProtocolType]::Tls12\r\n        }\r\n        elseif ( $SupportedTLSversions -contains 'Tls12' ) {\r\n            [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12\r\n        }\r\n        else {\r\n            # Not everything requires TLS 1.2, but we'll try anyways.\r\n            Write-Warning \"TLS 1.2 and or TLS 1.3 isn't supported on this system. This download may fail!\"\r\n            if ($PSVersionTable.PSVersion.Major -lt 3) {\r\n                Write-Warning \"PowerShell 2 \/ .NET 2.0 doesn't support TLS 1.2.\"\r\n            }\r\n        }\r\n\r\n        $i = 1\r\n        While ($i -lt 4) {\r\n            if (-not ($SkipSleep)) {\r\n                $SleepTime = Get-Random -Minimum 3 -Maximum 30\r\n                Start-Sleep -Seconds $SleepTime\r\n            }\r\n\r\n            Write-Host \"Download Attempt $i\"\r\n\r\n            try {\r\n                $WebClient = New-Object System.Net.WebClient\r\n                $WebClient.DownloadFile($URL, $Path)\r\n                $File = Test-Path -Path $Path -ErrorAction SilentlyContinue\r\n            }\r\n            catch {\r\n                Write-Warning \"An error has occurred while downloading!\"\r\n                Write-Warning $_.Exception.Message\r\n            }\r\n\r\n            if ($File) {\r\n                $i = 4\r\n            }\r\n            else {\r\n                $i++\r\n            }\r\n        }\r\n\r\n        if (-not (Test-Path $Path)) {\r\n            Write-Error \"Failed to download file!\"\r\n            Exit 1\r\n        }\r\n    }\r\n\r\n    # This will build our screenconnect download url if only given a domain name or if modification is needed to include the device type, location, org name etc.\r\n    function Build-URL {\r\n        param(\r\n            [Parameter()]\r\n            [String]$BaseURL,\r\n            [Parameter()]\r\n            [String]$Domain,\r\n            [Parameter()]\r\n            [String]$MSI,\r\n            [Parameter()]\r\n            [String]$Department,\r\n            [Parameter()]\r\n            [Switch]$UseOrgName,\r\n            [Parameter()]\r\n            [Switch]$UseLocation,\r\n            [Parameter()]\r\n            [Switch]$UseDeviceType\r\n        )\r\n\r\n        Write-Host \"Attempting to build from domain...\"\r\n        $URL = \"https:\/\/$Domain\/Bin\/$env:NINJA_COMPANY_NAME.ClientSetup.msi`?e=Access&amp;y=Guest\"\r\n\r\n        if ($UseOrgName) { $URL = $URL + \"&amp;c=$env:NINJA_ORGANIZATION_NAME\" }else { $URL = $URL + \"&amp;c=\" }\r\n        if ($UseLocation) { $URL = $URL + \"&amp;c=$env:NINJA_LOCATION_NAME\" }else { $URL = $URL + \"&amp;c=\" }\r\n        if ($Department) { $URL = $URL + \"&amp;c=$Department\" }else { $URL = $URL + \"&amp;c=\" }\r\n        if ($UseDeviceType) {\r\n            switch (Get-ProductType) {\r\n                1 { if (Test-IsLaptop) { $URL = $URL + \"&amp;c=Laptop&amp;c=&amp;c=&amp;c=&amp;c=\" }else { $URL = $URL + \"&amp;c=Workstation&amp;c=&amp;c=&amp;c=&amp;c=\" } }\r\n                2 { $URL = $URL + \"&amp;c=Domain Controller&amp;c=&amp;c=&amp;c=&amp;c=\" }\r\n                3 { $URL = $URL + \"&amp;c=Server&amp;c=&amp;c=&amp;c=&amp;c=\" }\r\n            }\r\n        }\r\n        else {\r\n            $URL = $URL + \"&amp;c=&amp;c=&amp;c=&amp;c=&amp;c=\"\r\n        }\r\n\r\n        Write-Host \"URL Built: $URL\"\r\n\r\n        return $URL\r\n    }\r\n\r\n    if (-not (Test-IsElevated)) {\r\n        Write-Error -Message \"Access Denied. Please run with Administrator privileges.\"\r\n        exit 1\r\n    }\r\n\r\n    if (-not (Test-Path $DestinationFolder -ErrorAction SilentlyContinue)) {\r\n        Write-Host \"Destination Folder does not exist! Creating directory...\"\r\n        New-Item $DestinationFolder -ItemType Directory\r\n    }\r\n\r\n    #Set the log file as a temporary file, it will be created in the temp folder of the context the script runs in (c:windowstemp or c:usersusernameappdatatemp)\r\n    $InstallerLogFile = [IO.Path]::GetTempFileName()\r\n    Write-Host \"Installer Log File location will be: $InstallerLogFile\"\r\n}\r\nprocess {\r\n    # Arguments required to download the file\r\n    $DownloadArgs = @{ Path = \"$DestinationFolder$MSI\" }\r\n    if ($SkipSleep) { $DownloadArgs[\"SkipSleep\"] = $True }\r\n\r\n    # Build the arguments needed to create the url\r\n    $ArgumentList = @{ Domain = $ScreenConnectDomain }\r\n    if ($UseOrgName) { $ArgumentList[\"UseOrgName\"] = $True }\r\n    if ($UseLocation) { $ArgumentList[\"UseLocation\"] = $True }\r\n    if ($UseDeviceType) { $ArgumentList[\"UseDeviceType\"] = $True }\r\n    if ($Department) { $ArgumentList[\"Department\"] = $Department }\r\n\r\n    # Build the URL and get it ready for download\r\n    $DownloadArgs[\"URL\"] = Build-Url @ArgumentList\r\n\r\n    # Download the installer\r\n    Invoke-Download @DownloadArgs\r\n\r\n    # Grab the installer file\r\n    $InstallerFile = Join-Path -Path $DestinationFolder -ChildPath $MSI -Resolve\r\n\r\n    # Define the name of the software we are searching for and look for it in both the 64 bit and 32 bit registry nodes\r\n    $ProductName = \"$(Get-ControlPanelName -msiPath $InstallerFile)\".Trim()\r\n    if (-not $ProductName) { \r\n        Write-Error \"Failed to fetch the product name from the MSI at path '$InstallerFile'. Ensure the MSI path is correct and the MSI contains the necessary product information.\"\r\n        exit 1\r\n    }\r\n\r\n    # If already installed, exit.\r\n    $IsInstalled = Find-UninstallKey -DisplayName $ProductName\r\n    if ($IsInstalled -and -not ($Force)) {\r\n        Write-Host \"$ProductName is already installed; exiting...\"\r\n        exit 0\r\n    }\r\n\r\n    # ScreenConnect install arguments\r\n    $Arguments = \"\/c msiexec \/i \"\"$InstallerFile\"\" \/qn \/norestart \/l \"\"$InstallerLogFile\"\" REBOOT=REALLYSUPPRESS\"\r\n\r\n    # Install and let the user know the exit code\r\n    $Process = Start-Process -Wait cmd -ArgumentList $Arguments -PassThru\r\n    Write-Host \"Exit Code: $($Process.ExitCode)\";\r\n\r\n    # Interpret the exit code\r\n    switch ($Process.ExitCode) {\r\n        0 { Write-Host \"Success\" }\r\n        3010 { Write-Host \"Success. Reboot required to complete installation\" }\r\n        1641 { Write-Host \"Success. Installer has initiated a reboot\" }\r\n        default {\r\n            Write-Error \"Exit code does not indicate success\"\r\n            Get-Content $InstallerLogFile -ErrorAction SilentlyContinue | Select-Object -Last 50 | Write-Host\r\n        }\r\n    }\r\n\r\n    exit $Process.ExitCode\r\n    \r\n}\r\nend {\r\n    \r\n    \r\n    \r\n}<\/pre>\n<p>&nbsp;<\/p>\n\n<div class=\"in-context-cta\"><p>Greifen Sie auf \u00fcber 300 Skripte im NinjaOne Dojo zu.<\/p>\n<p><a href=\"https:\/\/www.ninjaone.com\/freetrialform\/\">Zugang erhalten<\/a><\/p>\n<\/div>\n<h2>Detailansicht<\/h2>\n<p>Das Skript funktioniert auf unkomplizierte Weise:<\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><strong>Initialisierung der Parameter<\/strong>: Zu Beginn werden Parameter wie MSI-Dateiname, Zielordner und ScreenConnect-Domain festgelegt.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><strong>Pr\u00fcfungen vor der Ausf\u00fchrung<\/strong>: Es wird gepr\u00fcft, ob Sie \u00fcber Administratorrechte verf\u00fcgen und ob der Zielordner vorhanden ist.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><strong>Dynamische URL-Erstellung<\/strong>: Eine wichtige Funktion ist die F\u00e4higkeit, eine Download-URL auf der Grundlage von Parametern wie Unternehmensnamen, Standort und Ger\u00e4tetyp dynamisch zu erstellen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><strong>Download-Prozess<\/strong>: Das Skript l\u00e4dt dann das ScreenConnect-Installationsprogramm von der erstellten URL herunter.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><strong>Installation<\/strong>: Nach dem Herunterladen wird gepr\u00fcft, ob ScreenConnect bereits installiert ist. Ist dies nicht der Fall oder wird der Force-Parameter verwendet, wird mit der Installation fortgefahren.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><strong>Protokollierung<\/strong>: W\u00e4hrend des gesamten Prozesses werden Protokolle zur Fehlerbehebung gef\u00fchrt.<\/li>\n<\/ul>\n<h2>Potenzielle Anwendungsf\u00e4lle<\/h2>\n<p>Stellen Sie sich einen MSP vor, der f\u00fcr die Verwaltung der IT-Infrastruktur an mehreren Kundenstandorten verantwortlich ist. Die manuelle Installation von ScreenConnect auf jedem Ger\u00e4t w\u00e4re sehr zeitaufw\u00e4ndig. Mit diesem Skript kann der MSP Installationen automatisieren und Einstellungen wie Standort und Ger\u00e4tetyp f\u00fcr jeden Kunden anpassen, was Zeit spart und Fehler reduziert.<\/p>\n<h2>Vergleiche<\/h2>\n<p>Traditionell kann die Softwareinstallation das manuelle Herunterladen und Einrichten auf jedem Ger\u00e4t oder die Verwendung einfacher Batch-Skripte ohne Anpassungsm\u00f6glichkeiten beinhalten. Dieses PowerShell-Skript \u00fcbertrifft solche Methoden, indem es erweiterte Funktionen wie dynamische URL-Erstellung und Installationsstatuspr\u00fcfungen bietet, was zu effizienteren und fehlerfreien Bereitstellungen f\u00fchrt.<\/p>\n<h2>FAQs<\/h2>\n<p><strong>F: Ist das Skript mit allen Windows-Versionen kompatibel?\u00a0<\/strong><br \/>\nA: Es unterst\u00fctzt Windows 8, Server 2012 und neuere Versionen, obwohl \u00e4ltere Versionen mit einigen Einschr\u00e4nkungen funktionieren k\u00f6nnen.<\/p>\n<p><strong>F: Kann es Installationen in gro\u00dfem Ma\u00dfstab bew\u00e4ltigen?\u00a0<\/strong><br \/>\nA: Ja, es ist skalierbar und kann auf zahlreichen Ger\u00e4ten installiert werden.<\/p>\n<p><strong>F: Ist es sicher, dieses Skript zu verwenden?\u00a0<\/strong><br \/>\nA: Das Skript ist sicher, aber Sie sollten jedes Skript \u00fcberpr\u00fcfen und verstehen, bevor Sie es in Ihrer Umgebung einsetzen.<\/p>\n<h2>Folgen<\/h2>\n<p>Dieses Skript vereinfacht zwar den Installationsprozess erheblich, aber die Benutzer:innen m\u00fcssen sich der Sicherheitsaspekte bewusst sein. Eine unsachgem\u00e4\u00dfe Verwendung oder \u00c4nderung kann zu Schwachstellen f\u00fchren, insbesondere in MSP-Umgebungen, wo sich eine einzige Sicherheitsverletzung auf mehrere Kunden auswirken kann.<\/p>\n<h2>Empfehlungen<\/h2>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"4\" data-aria-level=\"1\"><strong>\u00dcberpr\u00fcfen und testen Sie<\/strong>: Pr\u00fcfen und testen Sie das Skript immer gr\u00fcndlich in einer kontrollierten Umgebung.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"5\" data-aria-level=\"1\"><strong>Passen Sie das Skript sorgf\u00e4ltig an<\/strong>: \u00c4ndern Sie die Skriptparameter entsprechend Ihren spezifischen Anforderungen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"6\" data-aria-level=\"1\"><strong>Bleiben Sie auf dem Laufenden<\/strong>: Halten Sie sich \u00fcber Updates von ConnectWise ScreenConnect auf dem Laufenden und passen Sie das Skript bei Bedarf an.<\/li>\n<\/ul>\n<h2>Abschlie\u00dfende \u00dcberlegungen<\/h2>\n<p>NinjaOne, mit seinem Fokus auf <a href=\"https:\/\/www.ninjaone.com\/de\/\">einen einheitlichen IT-Betrieb<\/a>, erg\u00e4nzt solche Skripting-L\u00f6sungen. Es bietet eine Plattform, auf der solche Skripte integriert und effizient verwaltet werden k\u00f6nnen, was die IT-Managementf\u00e4higkeiten von Expert:innen weiter verbessert. Dieses PowerShell-Skript zusammen mit Tools wie NinjaOne zeigt, dass Automatisierung und intelligente Tools im modernen IT-Management unverzichtbar sind.<\/p>\n","protected":false},"author":35,"featured_media":193965,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_lmt_disableupdate":"no","_lmt_disable":""},"operating_system":[4212],"use_cases":[4307],"class_list":["post-456544","script_hub","type-script_hub","status-publish","has-post-thumbnail","hentry","script_hub_category-windows","use_cases-allgemeine-konfiguration"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub\/456544","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/comments?post=456544"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media\/193965"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media?parent=456544"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/operating_system?post=456544"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/use_cases?post=456544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}