{"id":456618,"date":"2025-04-24T13:29:11","date_gmt":"2025-04-24T13:29:11","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=456618"},"modified":"2025-04-24T13:29:11","modified_gmt":"2025-04-24T13:29:11","slug":"konfiguration-von-pop-up-meldungen-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/de\/script-hub\/konfiguration-von-pop-up-meldungen-powershell\/","title":{"rendered":"Verbesserung der IT-Kommunikation: Verst\u00e4ndnis von PowerShell-Pop-up-Meldungen"},"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>Verbesserte Benutzerkommunikation:<\/strong> Das Skript bringt erhebliche Verbesserungen in die Art und Weise, wie <a href=\"https:\/\/www.ninjaone.com\/de\/blog\/it-kommunikation-verbessern\/\">IT-Abteilungen Benutzer:innen wichtige Aktionen mitteilen<\/a>.<\/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 Pop-Ups:<\/strong> Bietet umfangreiche Anpassungsoptionen f\u00fcr Pop-up-Meldungen, einschlie\u00dflich Text, Schaltfl\u00e4chen und Bilder.<\/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>Anpassbar an verschiedene Windows-Versionen:<\/strong> Kompatibel mit modernen und \u00e4lteren Windows-Systemen, was eine breite Anwendbarkeit gew\u00e4hrleistet.<\/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>Integration von Base64-Bildern:<\/strong> Einzigartige Funktion zur Verwendung von base64-kodierten Bildern, sodass keine externen Dateien erforderlich sind.<\/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>Automatisierte Benutzer-Aktionen:<\/strong> Erm\u00f6glicht automatisierte Benutzerreaktionen wie Systemneustarts und verbessert so die Compliance und die 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=\"6\" data-aria-level=\"1\"><strong>\u00dcberlegen gegen\u00fcber traditionellen Methoden:<\/strong> Effektiver und weniger zeitaufw\u00e4ndig als E-Mails oder manuelle Erinnerungen.<\/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>Vielseitigkeit im Einsatz:<\/strong> Kann f\u00fcr eine Reihe von Benachrichtigungen und Handlungsaufforderungen jenseits von Neustarterinnerungen angepasst werden.<\/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>Benutzerfreundliche Schnittstelle:<\/strong> Verbessert die Benutzerfreundlichkeit mit benutzerdefinierten Symbolen und Schnittstellen.<\/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=\"9\" data-aria-level=\"1\"><strong>Verantwortung beim Gebrauch:<\/strong> Eine verantwortungsvolle Nutzung ist ratsam, um eine Erm\u00fcdung der Benutzer:innen durch zu viele Benachrichtigungen zu vermeiden.<\/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=\"10\" data-aria-level=\"1\"><strong>Integrationspotenzial mit <a href=\"https:\/\/www.ninjaone.com\/de\/blog\/beste-msp-software\/\">MSP-Tools<\/a>:<\/strong> Kann mit Tools wie NinjaOne integriert werden, um IT-Managementprozesse zu optimieren.<\/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=\"11\" data-aria-level=\"1\"><strong>Wichtigkeit von Tests und Updates:<\/strong> Es ist wichtig, das Skript gr\u00fcndlich zu testen und es f\u00fcr neue Windows-Versionen zu aktualisieren.<\/li>\n<\/ul>\n<p>In der dynamischen Welt des IT-Managements ist eine effektive Kommunikation mit den Endbenutzer:innen essenziell. Dazu geh\u00f6rt auch die M\u00f6glichkeit, sie umgehend \u00fcber notwendige Ma\u00dfnahmen wie Systemneustarts oder Updates zu informieren. <a href=\"https:\/\/www.ninjaone.com\/de\/script-hub\/\">PowerShell-Skripte<\/a>, die eine Mischung aus Flexibilit\u00e4t und Effizienz bieten, werden zunehmend zur bevorzugten L\u00f6sung f\u00fcr solche Aufgaben.<\/p>\n<h2>Kontext<\/h2>\n<p>Das mitgelieferte PowerShell-Skript ist ein fortschrittliches Tool, das f\u00fcr <a href=\"https:\/\/www.ninjaone.com\/de\/was-ist-ein-msp\/\">Managed Service Provider (MSPs)<\/a> und IT-Expert:innen entwickelt wurde. Es erm\u00f6glicht die Anzeige von anpassbaren Pop-up-Meldungen auf den Benutzerbildschirmen. Dieses Skript ist besonders n\u00fctzlich, um Benutzer:innen an bestimmte Aktionen zu erinnern oder sie anzuweisen, zum Beispiel ihre Computer nach Updates oder Wartungsarbeiten neu zu starten.<\/p>\n<h2>Das PowerShell-Skript zur Konfiguration von Pop-up-Meldungen<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">&lt;#\r\n.SYNOPSIS\r\n    Displays a popup on the end user's screen. The script needs to be run as the 'Current Logged In User'. Use \"Restart Reminder\" to display a request to the end user to restart their computer.\r\n.DESCRIPTION\r\n    Displays a popup on the end user's screen. The script needs to be run as the 'Current Logged In User'. Use \"Restart Reminder\" to display a request to the end user to restart their computer. \r\n    See the comment block in this script's code for extra options such as changing the logo or the window title.\r\n    Uses Windows Presentation Framework to accommodate different DPIs and image scaling. On Windows 7 and Server 2008, the script will use the older Windows Form UI.\r\n\r\n    You can also convert an image to base64 and replace either lines 164 or 168 if you'd prefer to not have to download an image to a machine. \r\n.EXAMPLE\r\n    (No Parameters on Windows 11)\r\n\r\n    Result: Success\r\n\r\nPARAMETER: -RestartReminder\r\n    Displays a generic prompt requesting the user restart their machine. \r\n    This parameter is equivalent to the below options.\r\n    -Text \"Your IT Administrator is requesting that you restart your computer. Click 'Restart Now' after saving your work.\"\r\n    -ButtonLText \"Restart Now\"\r\n    -ButtonLaction \"shutdown.exe \/r \/t 30\"\r\n    -ButtonRText \"Ignore\"\r\n    -ButtonRcountdown 900\r\n    -ButtonRDefault\r\n.EXAMPLE\r\n    -RestartReminder (Server 2008)\r\n    \r\n    WARNING: PowerShell 2 cannot import the presentation framework switching to winform...\r\n    Ignore (895) Button Clicked!\r\n\r\nPARAMETER: -ApplicationID \"ReplaceWithWindowTitle\/ApplicationID\"\r\n    This will replace the window title and it will also change the taskbar overlay icon and logo\/image used in the popup \r\n    with the Notification Icon used by that Application ID  if it exists and is not overridden by another parameter. \r\n    This is the same application ID used by the Send-UserPrompt and the built-in Windows notification system.\r\n.EXAMPLE\r\n    -ApplicationID \"Contoso Inc\"\r\n    \r\n    Application ID with Icon found! Checking if the icon and logo were supplied elsewhere...\r\n    The icon was not specified elsewhere in the script switching from the default icon to the Applications Notification Icon.\r\n    The logo\/image was not specified elsewhere in the script switching from the default image to the Applications Notification Icon.\r\n    You can also switch the default Application ID on line 128\r\n\r\nPARAMETER: -LogoPath \"C:ReplaceThisPath.png\"\r\n    The location of an image you would like to use in the large image window.\r\n    This script is running as the end-user so their account will need permission to this path.\r\n    Can be given a URL. Just keep in mind that Ninja doesn't support these special characters: &amp;|;$&gt;&lt;`!.\r\n    Can be given any size image however the script will center it and then scale it into a 250px x 125px rectangle. \r\n    The image will always be centered and a square 1:1 ratio will work.\r\n    Scaling is not done on Server 2008 and Windows 7 (The image is simply centered and you may see it cut off the image if the image is too large).\r\n    \r\n    Supported image formats: .png, .jpg, .ico, .gif (GIFs will be static and not animated.)\r\n    \r\n    You can also convert an image to base64 and replace either lines 165 or 169 if you'd prefer to not have to download an image and give the script a path to it. \r\n\r\nPARAMETER: -IconPath \"C:ReplaceThisPath.png\"\r\n    The location of an icon you would like to use for the taskbar overlay and window title bar. \r\n    This script is running as the end-user so their account will need permission to this path.\r\n    Can be given a URL. Just keep in mind that Ninja doesn't support these special characters: &amp;|;$&gt;&lt;`!.\r\n    Can be given any icon size however the script will convert it to 64px x 64px so it is recommended to keep to the 1:1 ratio so that the image is not squished.\r\n    \r\n    Supported image formats: .png, .jpg, .ico, .gif (GIFs will be static and not animated.)\r\n    \r\n    You can also convert an image to base64 and replace either lines 164 or 168 if you'd prefer to not have to download an image and give the script a path to it.\r\n\r\nPARAMETER: -Text \"ReplaceMeWithTextYouWantInsideThePopUp\"\r\n    The text you would like displayed inside the popup. \r\n    If too much text is written, a scrollbar will automatically appear, allowing the end-user to view all the text.\r\n\r\nPARAMETER: -AllowResize\r\n    By default, resizing the popup is not allowed. Use -AllowResize to allow resizing the window.\r\n\r\nPARAMETER: -ButtonR\r\n    Add a button to the bottom right (can only be specified once).\r\n\r\nPARAMETER: -ButtonRdefault\r\n    Set the right button as the default button. This will allow end-users to simply hit the enter key when the window is in focus to perform a click.\r\n\r\nPARAMETER: -ButtonRtext \"TextYouWouldLikeInsideTheButton\"\r\n    Change the text from 'Right Button' to whatever you put encased in quotes.\r\n.EXAMPLE\r\n    -ButtonRtext \"Later\"\r\n\r\n    Later Button Clicked!\r\n\r\nPARAMETER: -ButtonRaction \"ReplaceWithAnyCMDcommand\"\r\n    This will set the action the right button performs when clicked. Can be given any command that will work in cmd.exe as well as parameters. ex. logoff.exe \r\n\r\nPARAMETER: -ButtonRcountdown \"160\"\r\n    This will add a countdown to the right button with your input in seconds. When the countdown reaches 0 it'll click the button for the end user.\r\n    The left and right button countdown cannot be used at the same time.\r\n\r\nPARAMETER: -ButtonL\r\n    Add a button to the bottom left (can only be specified once).\r\n\r\nPARAMETER: -ButtonLdefault\r\n    Set the left button as the default button. This will allow end-users to simply hit the enter key when the window is in focus to perform a click.\r\n\r\nPARAMETER: -ButtonLtext \"TextYouWouldLikeInsideTheButton\"\r\n    Change the text from 'Left Button' to whatever you put encased in quotes.\r\n.EXAMPLE\r\n    -ButtonLtext \"Later\"\r\n\r\n    Later Button Clicked!\r\n\r\nPARAMETER: -ButtonLaction \"ReplaceWithAnyCMDcommand\"\r\n    This will set the action the left button performs when clicked. Can be given any command that will work in cmd.exe as well as parameters. ex. logoff.exe \r\n\r\nPARAMETER: -ButtonLcountdown\r\n    This will add a countdown to the left button with your input in seconds. When the countdown reaches 0 it'll click the button for the end user.\r\n    The left and right button countdown cannot be used at the same time.\r\n\r\nPARAMETER: -Verbose\r\n    More verbose output (useful for troubleshooting).\r\n.OUTPUTS\r\n  None\r\n.NOTES\r\n  Minimum OS Architecture Supported: Windows 7+, Server 2008+\r\n  Release Notes:\r\n  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\r\n[CmdletBinding()]\r\nparam (\r\n    [Parameter()]\r\n    [Switch]$AllowResize = [System.Convert]::ToBoolean($env:allowEnduserToResizeWindow),\r\n    # You can set line 127 to [String]$ApplicationID = \"$env:NINJA_COMPANY_NAME\" to automatically use your company name.\r\n    [Parameter()]\r\n    [String]$ApplicationID = \"NinjaOne RMM\",\r\n    [Parameter()]\r\n    [Switch]$ButtonR,\r\n    [Parameter()]\r\n    [Switch]$ButtonRdefault,\r\n    [Parameter()]\r\n    [String]$ButtonRtext,\r\n    [Parameter()]\r\n    [String]$ButtonRaction,\r\n    [Parameter()]\r\n    [int]$ButtonRcountdown,\r\n    [Parameter()]\r\n    [Switch]$ButtonL,\r\n    [Parameter()]\r\n    [Switch]$ButtonLDefault,\r\n    [Parameter()]\r\n    [String]$ButtonLtext,\r\n    [Parameter()]\r\n    [String]$ButtonLaction,\r\n    [Parameter()]\r\n    [int]$ButtonLcountdown,\r\n    [Parameter()]\r\n    [String]$IconPath,\r\n    [Parameter()]\r\n    [String]$LogoPath,\r\n    [Parameter()]\r\n    [String]$Text,\r\n    [Parameter()]\r\n    [Switch]$winForm,\r\n    [Parameter()]\r\n    [Switch]$RestartReminder = [System.Convert]::ToBoolean($env:restartReminder)\r\n)\r\n\r\nbegin {\r\n\r\n    # You can replace the below line with $IconBase64 = \"ReplaceThisWithYourBase64encodedimageEncasedInQuotes\" and the script will decode the image and use it \r\n    # for the taskbar overlay icon and title bar icon.\r\n    $IconBase64 = \"iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAJFBMVEUARF0Apc0AmL8ApM0Aos0Aps7\/\/\/8Am8ia1ug9rtLd8\/jw+\/2tMDHwAAAABXRSTlMBrBTIcce4nvwAAAIeSURBVHic7dvrcoMgEAXgiOAivv\/7Fm+JBpCLwk7bsz86rcNkPw+Y0Gl5vd4lGtbLKSG7vmF18mwQnWpe3YcghP2Z1svU8OtbIOihm8op25M2gWBov9UqYJj\/vSRzAGsEkhMglxngWINbdbxLAAAAAAAAAAAAAKAI8Oz2KRtApPWThEyAbT8NZwDZGpeav6sLIKXNMBwAtuGotTGTvTpMRms9qkxEBsDe\/dz+A7B3rufeS\/utrCKPkAywzfYmK8BeOHY+lBkzBImALfwDgA4XnNLphCTA4e43AKmL9vNMJD8pCQAna20nP5D+SfkQgJyp1qS9PYsEKQDnpVP627WYJCgBmGj+GRmUAFIraSXWBAwDcwJJk1AXMIzcgHgElQHxCGoDohHcBsybgIvPpei70S2A0csuaNkTBRBTbA7uAOb271E0+gWxOSgHfG87yD+wGsCz7fGONNf9iwGTb89DnlkwkUVQCPD2t1sXz9A6gMDT5YsgsggKARljI\/vTMkDo7cU3B1USCL+oOwdVAMGF5RlcAxB+tBoBwq\/JDlDcAPYEAGgDuPiNBwkgASSABJAAEkACSAAJIAEkgASQABL4JwlcA9w\/9N4GTOZcl1OQMTgRoEannhv9O\/+PCAAAAAAAAAAAAACAPwhgP+7HeOCR1jOfjBHI9dBrz9W\/34\/d9jyHLvvPweP2GdCx\/3zyvLlAfZ8+l13LktJzAJ+nfgAP50EVLvPsRgAAAABJRU5ErkJggg==\"\r\n    \r\n    # You can replace the below line with $LogoBase64 = \"ReplaceThisWithYourBase64encodedimageEncasedInQuotes\" and the script will decode the image and use it \r\n    # for the main large image \/ logo\r\n    $LogoBase64 = \"iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAJFBMVEUARF0Apc0AmL8ApM0Aos0Aps7\/\/\/8Am8ia1ug9rtLd8\/jw+\/2tMDHwAAAABXRSTlMBrBTIcce4nvwAAAIeSURBVHic7dvrcoMgEAXgiOAivv\/7Fm+JBpCLwk7bsz86rcNkPw+Y0Gl5vd4lGtbLKSG7vmF18mwQnWpe3YcghP2Z1svU8OtbIOihm8op25M2gWBov9UqYJj\/vSRzAGsEkhMglxngWINbdbxLAAAAAAAAAAAAAKAI8Oz2KRtApPWThEyAbT8NZwDZGpeav6sLIKXNMBwAtuGotTGTvTpMRms9qkxEBsDe\/dz+A7B3rufeS\/utrCKPkAywzfYmK8BeOHY+lBkzBImALfwDgA4XnNLphCTA4e43AKmL9vNMJD8pCQAna20nP5D+SfkQgJyp1qS9PYsEKQDnpVP627WYJCgBmGj+GRmUAFIraSXWBAwDcwJJk1AXMIzcgHgElQHxCGoDohHcBsybgIvPpei70S2A0csuaNkTBRBTbA7uAOb271E0+gWxOSgHfG87yD+wGsCz7fGONNf9iwGTb89DnlkwkUVQCPD2t1sXz9A6gMDT5YsgsggKARljI\/vTMkDo7cU3B1USCL+oOwdVAMGF5RlcAxB+tBoBwq\/JDlDcAPYEAGgDuPiNBwkgASSABJAAEkACSAAJIAEkgASQABL4JwlcA9w\/9N4GTOZcl1OQMTgRoEannhv9O\/+PCAAAAAAAAAAAAACAPwhgP+7HeOCR1jOfjBHI9dBrz9W\/34\/d9jyHLvvPweP2GdCx\/3zyvLlAfZ8+l13LktJzAJ+nfgAP50EVLvPsRgAAAABJRU5ErkJggg==\"\r\n\r\n    # If script form is used replace the parameters\r\n    if ($env:applicationId -and $env:applicationId -notlike \"null\") { $ApplicationID = $env:applicationId }\r\n    if ($env:logoPath -and $env:logoPath -notlike \"null\") { $LogoPath = $env:logoPath }\r\n    if ($env:iconPath -and $env:iconPath -notlike \"null\") { $IconPath = $env:iconPath }\r\n    if ($env:popupMessage -and $env:popupMessage -notlike \"null\") { $Text = $env:popupMessage }\r\n    if ($env:rightButtonText -and $env:rightButtonText -notlike \"null\") { $ButtonRtext = $env:rightButtonText }\r\n    if ($env:rightButtonAction -and $env:rightButtonAction -notlike \"null\") { $ButtonRaction = $env:rightButtonAction }\r\n    if ($env:rightButtonCountdown -and $env:rightButtonCountdown -notlike \"null\") { $ButtonRcountdown = $env:rightButtonCountdown }\r\n    if ($env:leftButtonText -and $env:leftButtonText -notlike \"null\") { $ButtonLText = $env:leftButtonText }\r\n    if ($env:leftButtonAction -and $env:leftButtonAction -notlike \"null\") { $ButtonLaction = $env:leftButtonAction }\r\n    if ($env:leftButtonCountdown -and $env:leftButtonCountdown -notlike \"null\") { $ButtonLcountdown = $env:leftButtonCountdown }\r\n    if ($env:defaultButton -and $env:defaultButton -notlike \"null\") {\r\n        if ($env:defaultButton -eq \"Right Button\") { $ButtonRdefault = $True }\r\n        if ($env:defaultButton -eq \"Left Button\") { $ButtonLdefault = $True }\r\n    }\r\n\r\n    # Sets the parameters for a generic restart prompt\r\n    if ($RestartReminder) {\r\n        if (-not $ButtonLtext) { $ButtonLtext = \"Restart Now\" }\r\n        if (-not $ButtonLaction) {\r\n            if (([System.Environment]::OSVersion.Version).Major -ge 10) {\r\n                $ButtonLaction = \"shutdown.exe \/r \/soft \/t 30\"\r\n            }\r\n            else {\r\n                $ButtonLaction = \"shutdown.exe \/r \/t 30\"\r\n            } \r\n        }\r\n        if (-not $ButtonRtext) { $ButtonRtext = \"Ignore\" }\r\n        if (-not $ButtonRcountdown) { $ButtonRcountdown = 900 }\r\n        if (-not $Text) { $Text = \"Your IT Administrator is requesting that you restart your computer. Click 'Restart Now' after saving your work.\" }\r\n    }\r\n\r\n    # These Assemblies are needed to prepare the images for the form\r\n    Write-Verbose \"Adding required assemblies...\"\r\n    Add-Type -AssemblyName System.Windows.Forms\r\n    Add-Type -AssemblyName System.Drawing\r\n\r\n    # Check if the script was run as the default System User\r\n    function Test-IsSystem {\r\n        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()\r\n        return $id.Name -like \"NT AUTHORITY*\" -or $id.IsSystem\r\n    }\r\n\r\n    function Test-PSVersion {\r\n        return ($PSVersionTable.PSVersion.Major)\r\n    }\r\n\r\n    function ConvertFrom-Base64 {\r\n        param(\r\n            $Base64,\r\n            $Path\r\n        )\r\n        $bytes = [Convert]::FromBase64String($Base64)\r\n\r\n        # This section of code will error out when ran multiple times in the same session. This is from wpf holding onto the file after closing. \r\n        # The file is unlocked when the powershell session is closed.\r\n        $ErrorActionPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue\r\n        [IO.File]::WriteAllBytes($Path, $bytes)\r\n        $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Continue\r\n    }\r\n\r\n    # There's a lot of ways to create icon files the below method creates a png and then creates an ico file in binary form by creating the header and adding the png's binary at the bottom.\r\n    # Once this has been done we can simply write all the bytes to our new file.\r\n    function ConvertFrom-Image {\r\n        param(\r\n            $ImagePath,\r\n            $Path\r\n        )\r\n\r\n        # Grab an instance of the image and blank bitmap\r\n        $image = [Drawing.Image]::FromFile($ImagePath)\r\n\r\n        # Resize the image to 255px by 255px while maintaining quality.\r\n        # If you want transparency you'll need an Alpha channel in the pixel format\r\n        $bitmap = New-Object System.Drawing.Bitmap (64, 64, [system.drawing.imaging.PixelFormat]::Format32bppArgb)\r\n        $bitmap.SetResolution(64, 64)\r\n\r\n        # Create a graphics object which will be used to resize the image to 255px by 255px\r\n        $graphics = [System.Drawing.Graphics]::FromImage($bitmap)\r\n\r\n        # Set some quality settings for the resize operation\r\n        $graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::HighQuality\r\n        $graphics.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic\r\n        $graphics.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality\r\n\r\n        # Draw the image onto the bitmap\r\n        $graphics.DrawImage($Image, 0, 0, 64, 64)\r\n        \r\n        # Temporarily save the image as a png\r\n        $RandomNumber = Get-Random -Maximum 1000000\r\n        $bitmap.Save(\"$env:TEMPimage-$RandomNumber.png\", [System.Drawing.Imaging.ImageFormat]::Png)\r\n        $png = \"$env:TEMPimage-$RandomNumber.png\"\r\n\r\n        # Build the ico file using the png binary.\r\n        if ($PSVersionTable.PSVersion.Major -gt 5) {\r\n            $pngBytes = Get-Content -Path $png -AsByteStream\r\n        }\r\n        elseif ($PSVersionTable.PSVersion.Major -gt 2) {\r\n            $pngBytes = Get-Content -Path $png -Encoding Byte -Raw\r\n        }\r\n        else {\r\n            $pngBytes = [System.IO.File]::ReadAllBytes($png)\r\n        }\r\n        $icoHeader = [byte[]] @(0, 0, 1, 0, 1, 0)\r\n        $imageDataSize = $pngBytes.Length\r\n        $icoDirectory = [byte[]] @(\r\n            64, 64, # icon size\r\n            0, 0, # color count\r\n            0, 0, # reserved\r\n            0, 0, # hotspot x, hotspot y\r\n            ($imageDataSize -band 0xFF),\r\n            ([Math]::Floor($imageDataSize \/ [Math]::Pow(2, 8)) -band 0xFF),\r\n            ([Math]::Floor($imageDataSize \/ [Math]::Pow(2, 16)) -band 0xFF),\r\n            ([Math]::Floor($imageDataSize \/ [Math]::Pow(2, 24)) -band 0xFF),\r\n            22, 0, 0, 0  # offset to image data\r\n        )\r\n        $iconData = $icoHeader + $icoDirectory + $pngBytes\r\n\r\n        # Save the completed icon file and clean up any temporary files.\r\n        # This section of code will error out when ran multiple times in the same session. This is from wpf holding onto the file after closing. \r\n        # The file is unlocked when the powershell session is closed.\r\n        $ErrorActionPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue\r\n        if (Test-Path $Path -ErrorAction SilentlyContinue) { Remove-Item $Path -Force }\r\n        [System.IO.File]::WriteAllBytes($Path, $iconData)\r\n\r\n        if (Test-Path $png -ErrorAction SilentlyContinue) { Remove-Item $png -Force }\r\n        $bitmap.Dispose()\r\n        $image.Dispose()\r\n        $graphics.Dispose()\r\n        [System.GC]::Collect()\r\n\r\n        $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Continue\r\n    }\r\n\r\n    function Invoke-Download {\r\n        param(\r\n            [Parameter()]\r\n            [String]$URL,\r\n            [Parameter()]\r\n            [String]$BaseName,\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                $Response = $WebClient.OpenRead($Url)\r\n                $MimeType = $WebClient.ResponseHeaders[\"Content-Type\"]\r\n                $DesiredExtension = switch -regex ($MimeType) {\r\n                    \"image\/jpeg|image\/jpg\" { \"jpg\" }\r\n                    \"image\/png\" { \"png\" }\r\n                    \"image\/gif\" { \"gif\" }\r\n                    \"image\/bmp|image\/x-windows-bmp|image\/x-bmp\" { \"bmp\" }\r\n                    \"image\/x-icon\" { \"ico\" }\r\n                    default { \r\n                        Write-Error \"The URL you provided does not provide a supported image type. Image Types Supported: jpg, jpeg, ico, bmp, png and gif. Image Type detected: $MimeType\"\r\n                        Exit 1 \r\n                    }\r\n                }\r\n                $Path = \"$BaseName.$DesiredExtension\"\r\n                $WebClient.DownloadFile($URL, $Path)\r\n                $File = Test-Path -Path $Path -ErrorAction SilentlyContinue\r\n                $Response.Close()\r\n            }\r\n            catch {\r\n                if ($Response) { $Response.Close() }\r\n                Write-Warning \"An error has occured 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        $Path\r\n    }\r\n\r\n    function Build-WPFform {\r\n        # This is xml I created using visual studio community edition https:\/\/visualstudio.microsoft.com\/downloads\/ I removed some of the lines in \"Window\" so PowerShell could load it.\r\n        [XML]$form = @\"\r\n&lt;Window\r\n\r\nxmlns_x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\"\r\nWidth=\"350\" WindowStartupLocation=\"CenterScreen\" SizeToContent=\"Height\" ResizeMode=\"CanMinimize\" Topmost=\"True\"\r\n&gt;\r\n    &lt;Window.TaskbarItemInfo&gt;\r\n        &lt;TaskbarItemInfo\/&gt;\r\n    &lt;\/Window.TaskbarItemInfo&gt;\r\n    &lt;Grid&gt;\r\n        &lt;Grid x_Name=\"ImageGrid\" Margin=\"25,25,25,0\" Height=\"125\" MinWidth=\"250\" VerticalAlignment=\"Top\"&gt;\r\n        &lt;Image x_Name=\"Logo\" HorizontalAlignment=\"Center\" \/&gt;\r\n        &lt;\/Grid&gt;\r\n        &lt;Grid x_Name=\"ContentGrid\" Margin=\"25,188,25,25\"&gt;\r\n            &lt;Grid.RowDefinitions&gt;\r\n                &lt;RowDefinition MinHeight=\"65\" \/&gt;\r\n                &lt;RowDefinition Height=\"30\" \/&gt;\r\n            &lt;\/Grid.RowDefinitions&gt;\r\n            &lt;ScrollViewer x_Name=\"ScrollBox\" VerticalScrollBarVisibility=\"Auto\" Grid.RowSpan=\"1\" MaxHeight=\"100\" &gt;\r\n                &lt;TextBlock x_Name=\"TextBlock\" TextWrapping=\"Wrap\" FontFamily=\"Microsoft Sans Serif\" FontSize=\"14\" \/&gt;\r\n            &lt;\/ScrollViewer&gt;\r\n            &lt;Button x_Name=\"ButtonR\" FontFamily=\"Lucida Sans Unicode\" FontSize=\"12\" Content=\"Accept\" Margin=\"0,0,0,0\" Height=\"30\" Width=\"114\" HorizontalAlignment=\"Right\" VerticalAlignment=\"Bottom\" Grid.RowSpan=\"2\" Visibility=\"Hidden\" \/&gt;\r\n            &lt;Button x_Name=\"ButtonL\" FontFamily=\"Lucida Sans Unicode\" FontSize=\"12\" Content=\"Close\" Margin=\"0,0,0,0\" Height=\"30\" Width=\"114\" HorizontalAlignment=\"Left\" VerticalAlignment=\"Bottom\" Grid.RowSpan=\"2\" Visibility=\"Hidden\" \/&gt;\r\n        &lt;\/Grid&gt;\r\n    &lt;\/Grid&gt;\r\n&lt;\/Window&gt;\r\n\"@\r\n\r\n        $NR = (New-Object System.Xml.XmlNodeReader $form)\r\n        # Informs powershell that this xml is actually Xaml (Presentation Framework is needed to load it)\r\n        $Window = [Windows.Markup.XamlReader]::Load($NR)\r\n\r\n        # Set's the details of the form (How many buttons? Is One Default? All the options set by parameters)\r\n        if ($ApplicationID) {\r\n            Write-Verbose \"Setting window title to $ApplicationID\"\r\n            $Window.Title = $ApplicationID\r\n        }\r\n\r\n        if ($AllowResize) {\r\n            Write-Verbose \"Allowing ReSizing of window...\"\r\n            $Window.ResizeMode = \"CanResize\"\r\n        }\r\n\r\n        if ($LogoPath) {\r\n            Write-Verbose \"Adding Logo...\"\r\n            $Logo = $window.FindName(\"Logo\")\r\n            $Logo.Source = $LogoPath\r\n        }\r\n\r\n        if ($IconPath) {\r\n            Write-Verbose \"Overlaying tasbar icon and setting icon for window...\"\r\n            $Window.Icon = $IconPath\r\n            $Window.TaskbarItemInfo.Overlay = $IconPath\r\n        }\r\n\r\n        if ($Text) {\r\n            Write-Verbose \"Adding Text Block...\"\r\n            $TextBlock = $window.FindName(\"TextBlock\")\r\n            $TextBlock.Text = $Text\r\n        }\r\n\r\n        if ($ButtonR -or $ButtonRtext) {\r\n            Write-Verbose \"Adding Right Button...\"\r\n            $RightButton = $window.FindName(\"ButtonR\")\r\n\r\n            if ($ButtonRtext) { \r\n                Write-Verbose \"Setting Right Button Text...\"\r\n                $RightButton.Content = $ButtonRtext \r\n            }\r\n            else {\r\n                Write-Warning \"It looks like you forgot to enter in button text using -ButtonRtext 'replaceMeWithText' \"\r\n            }\r\n\r\n            # To set the timer we'll need to create a timer but on the $Script level \r\n            if ($ButtonRcountdown) {\r\n                Write-Verbose \"Adding a countdown...\"\r\n                $ButtonText = $RightButton.Content\r\n                $Script:Timer = New-Object System.Windows.Forms.Timer\r\n                $Timer.Interval = 1000\r\n\r\n                Function Timer_Tick() {\r\n                    # Add text with countdown value in the button\r\n                    $RightButton.Content = \"$ButtonText ($Script:CountDown)\"\r\n                    --$Script:CountDown\r\n                    If ($Script:CountDown -lt 0) {\r\n                        $Script:Timer.Stop()\r\n                        # Once the timer is complete we'll send a click event\r\n                        $RightButton.RaiseEvent((New-Object -TypeName System.Windows.RoutedEventArgs -ArgumentList $([System.Windows.Controls.Button]::ClickEvent)))\r\n                        $Script:Timer.Dispose() \r\n                    }\r\n                }\r\n                $Script:CountDown = $ButtonRcountdown\r\n                $Script:Timer.Add_Tick({ Timer_Tick })\r\n                $Script:Timer.Start()\t\r\n            }\r\n\r\n            if ($ButtonRdefault) { $RightButton.IsDefault = $True }\r\n\r\n            $RightButton.Visibility = \"Visible\"\r\n\r\n            $RightButton.add_click(\r\n                {\r\n                    # I figured the actual button text would be more informative when looking back\r\n                    Write-Host \"$($RightButton.Content) Button Clicked!\"\r\n                    if ($buttonRaction) { Start-Process cmd.exe -ArgumentList \"\/c $buttonRaction\" -NoNewWindow }\r\n                    $window.Close()\r\n                }\r\n            )\r\n        }\r\n\r\n        if ($ButtonL -or $ButtonLtext) {\r\n            Write-Verbose \"Adding Left Button...\"\r\n\r\n            $LeftButton = $window.FindName(\"ButtonL\")\r\n\r\n            if ($ButtonLtext) { \r\n                Write-Verbose \"Adding Left Button Text...\"\r\n                $LeftButton.Content = $ButtonLtext \r\n            }\r\n            else {\r\n                Write-Warning \"It looks like you forgot to enter in button text using -ButtonLtext 'replaceMeWithText' \"\r\n            }\r\n\r\n            if ($ButtonLcountdown) {\r\n                Write-Verbose \"Adding Countdown...\"\r\n                $ButtonText = $LeftButton.Content\r\n                $Script:Timer = New-Object System.Windows.Forms.Timer\r\n                $Timer.Interval = 1000\r\n\r\n                Function Timer_Tick() {\r\n                    # Add text with countdown value in the button\r\n                    $LeftButton.Content = \"$ButtonText ($Script:CountDown)\"\r\n                    --$Script:CountDown\r\n                    If ($Script:CountDown -lt 0) {\r\n                        $Script:Timer.Stop()\r\n                        $LeftButton.RaiseEvent((New-Object -TypeName System.Windows.RoutedEventArgs -ArgumentList $([System.Windows.Controls.Button]::ClickEvent)))\r\n                        $Script:Timer.Dispose()\r\n                    }\r\n                }\r\n                $Script:CountDown = $ButtonLcountdown\r\n                $Script:Timer.Add_Tick({ Timer_Tick })\r\n                $Script:Timer.Start()\t\r\n            }\r\n\r\n            if ($ButtonLdefault) { $LeftButton.IsDefault = $True }\r\n            $LeftButton.Visibility = \"Visible\"\r\n\r\n            $LeftButton.add_click(\r\n                {\r\n                    Write-Host \"$($LeftButton.Content) Button Clicked!\"\r\n                    if ($buttonLaction) { Start-Process cmd.exe -ArgumentList \"\/c $buttonLaction\" -NoNewWindow }\r\n                    $window.Close()\r\n                }\r\n            )\r\n        }\r\n\r\n        # Actually displays the form here\r\n        $window.ShowDialog() | Out-Null\r\n    }\r\n\r\n    function Build-WinForm {\r\n        # Legacy Windows Form UI. It doesn't scale but looks similar to the one I built with WPF\r\n        Write-Verbose \"Legacy System Detected switching to windows forms...\"\r\n        Write-Verbose \"Building initial window...\"\r\n        $form = New-Object System.Windows.Forms.Form\r\n        $form.Height = 360\r\n        $form.Width = 350\r\n        $form.AutoSize = $false\r\n        $form.MaximizeBox = $False\r\n        $form.StartPosition = \"CenterScreen\"\r\n        $form.AutoScaleMode = [System.Windows.Forms.AutoScaleMode]::Dpi\r\n        if ($ApplicationID) { $form.Text = $ApplicationID }\r\n        if (-not $AllowResize) { $form.FormBorderStyle = \"FixedDialog\" }\r\n\r\n        Write-Verbose \"Setting window icon to $IconPath\"\r\n        if ($IconPath) {\r\n            $form.Icon = New-Object System.Drawing.Icon $IconPath\r\n        }\r\n        \r\n        Write-Verbose \"Building Logo...\"\r\n        $Logo = New-Object System.Windows.Forms.PictureBox\r\n        $Logo.Location = New-Object System.Drawing.Point(40, 25)\r\n        $Logo.Height = 125\r\n        $Logo.Width = 250\r\n        $Logo.BackColor = [System.Drawing.Color]::Transparent\r\n        $Logo.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::CenterImage\r\n        $Logo.ImageLocation = $LogoPath\r\n        $form.Controls.Add($Logo)\r\n\r\n        Write-Verbose \"Adding TextBox...\"\r\n        $TextBox = New-Object System.Windows.Forms.RichTextBox\r\n        $TextBox.Height = 75\r\n        $TextBox.Width = 275\r\n        $TextBox.Text = $Text\r\n        $TextBox.Font = \"Microsoft Sans Serif\"\r\n        $TextBox.ShowSelectionMargin = $False\r\n        $TextBox.Tabstop = $False\r\n        $TextBox.ReadOnly = $True\r\n        $TextBox.Location = New-Object System.Drawing.Point(30, 175)\r\n        $form.Controls.Add($TextBox)\r\n\r\n        Write-Verbose \"Adding Left Button...\"\r\n        $LeftFormButton = New-Object System.Windows.Forms.Button\r\n        $LeftFormButton.Location = New-Object System.Drawing.Point(30, 275)\r\n        $LeftFormButton.Height = 25\r\n        $LeftFormButton.Width = 114\r\n        $LeftFormButton.Font = \"Lucida Sans Unicode\"\r\n        if (-not $ButtonLtext) { $LeftFormButton.Text = \"Close\" }else { $LeftFormButton.Text = $ButtonLtext }\r\n        $LeftFormButton.Add_Click(\r\n            {\r\n                Write-Host \"$($LeftFormButton.Text) Button Clicked!\"\r\n                if ($buttonLaction) { Start-Process cmd.exe -ArgumentList \"\/c $buttonLaction\" -NoNewWindow }\r\n                $form.Close()\r\n            }\r\n        )\r\n        if ($ButtonLcountdown) {\r\n            $ButtonText = $LeftFormButton.Text\r\n            $Script:Timer = New-Object System.Windows.Forms.Timer\r\n            $Timer.Interval = 1000\r\n\r\n            Function Timer_Tick() {\r\n                # Add text with countdown value in the button\r\n                $LeftFormButton.Text = \"$ButtonText ($Script:CountDown)\"\r\n                --$Script:CountDown\r\n                If ($Script:CountDown -lt 0) {\r\n                    $Script:Timer.Stop(); \r\n                    $LeftFormButton.PerformClick();\r\n                    $Script:Timer.Dispose(); \r\n                }\r\n            }\r\n            $Script:CountDown = $ButtonLcountdown\r\n            $Script:Timer.Add_Tick({ Timer_Tick })\r\n            $Script:Timer.Start()\t\r\n        }\r\n        if ($ButtonL) { $form.Controls.Add($LeftFormButton) }\r\n\r\n        Write-Verbose \"Adding Right Button...\"\r\n        $RightFormButton = New-Object System.Windows.Forms.Button\r\n        $RightFormButton.Location = New-Object System.Drawing.Point(190, 275)\r\n        $RightFormButton.Height = 25\r\n        $RightFormButton.Width = 114\r\n        $RightFormButton.Font = \"Lucida Sans Unicode\"\r\n        if (-not $ButtonRtext) { $RightFormButton.Text = \"Accept\" }else { $RightFormButton.Text = $ButtonRtext }\r\n        $RightFormButton.Add_Click(\r\n            {\r\n                Write-Host \"$($RightFormButton.Text) Button Clicked!\"\r\n                if ($buttonRaction) { Start-Process cmd.exe -ArgumentList \"\/c $buttonRaction\" -NoNewWindow }\r\n                $form.Close()\r\n            }\r\n        )\r\n        if ($ButtonRcountdown) {\r\n            $ButtonText = $RightFormButton.Text\r\n            $Script:Timer = New-Object System.Windows.Forms.Timer\r\n            $Timer.Interval = 1000\r\n\r\n            Function Timer_Tick() {\r\n                # Add text with countdown value in the button\r\n                $RightFormButton.Text = \"$ButtonText ($Script:CountDown)\"\r\n                --$Script:CountDown\r\n                If ($Script:CountDown -lt 0) {\r\n                    $Script:Timer.Stop(); \r\n                    $RightFormButton.PerformClick();\r\n                    $Script:Timer.Dispose(); \r\n                }\r\n            }\r\n            $Script:CountDown = $ButtonRcountdown\r\n            $Script:Timer.Add_Tick({ Timer_Tick })\r\n            $Script:Timer.Start()\t\r\n        }\r\n        if ($ButtonR) { $form.Controls.Add($RightFormButton) }\r\n\r\n        $form.Add_Load(\r\n            {\r\n                $form.Activate()\r\n            }\r\n        )\r\n\r\n        Write-Verbose \"Displaying PopUp...\"\r\n        $form.ShowDialog() | Out-Null\r\n        $form.Dispose()\r\n    }\r\n\r\n    # If it was we'll error out and enform the technician they should run it as the \"Current Logged on User\"\r\n    if (Test-IsSystem) {\r\n        Write-Error \"This script does not work when ran as system. Use Run As: 'Current Logged on User'.\"\r\n        exit 1\r\n    }\r\n\r\n    # Windows Presentation Framework cannot be imported by PowerShell 2.0.\r\n    if ((Test-PSVersion) -lt 3) {\r\n        Write-Warning \"PowerShell 2 cannot import the presentation framework switching to winform...\"\r\n        $winForm = $True\r\n    }\r\n\r\n    # Inform the technician that having two simultaneous countdowns isn't really a good idea (it would technically work but doesn't really make sense)\r\n    if ($ButtonLcountdown -and $ButtonRcountdown) {\r\n        Write-Error \"[Error] -ButtonLcountdown and -ButtonRcountdown cannot be used at the same time!\"\r\n        exit 1\r\n    }\r\n\r\n    # Informing the technician that this doesn't make sense but I will allow it.\r\n    if ($ButtonRdefault -and $ButtonLdefault) {\r\n        Write-Warning \"Looks like you've made both buttons the default?\"\r\n    }\r\n\r\n    # If the technician forgot to set a button we'll set one.\r\n    if (-not $ButtonL -and ($ButtonLtext -or $ButtonLaction -or $ButtonLDefault -or $ButtonLcountdown)) { $ButtonL = $True }\r\n    if (-not $ButtonR -and ($ButtonRtext -or $ButtonRaction -or $ButtonRDefault -or $ButtonRcountdown)) { $ButtonR = $True }\r\n    \r\n    # If no default button was selected I'll pick for you.\r\n    if (-not $ButtonRDefault -and -not $ButtonLDefault) {\r\n        if ($ButtonL -and $ButtonR) { $ButtonRDefault = $True }\r\n        if ($ButtonL -and -not $ButtonR) { $ButtonLDefault = $True }\r\n        if ($ButtonR -and -not $ButtonL) { $ButtonRDefault = $True }\r\n    }\r\n\r\n    # This is where Send-UserPrompt (and the default notification system) store's the icon's path\r\n    $iconUri = Get-ItemProperty \"HKLM:SOFTWAREClassesAppUserModelId$($ApplicationId -replace 's+','.')\" -ErrorAction SilentlyContinue | Select-Object IconUri -ExpandProperty IconUri -ErrorAction SilentlyContinue\r\n    \r\n    # The base64 we set by default. If someone manually entered in their own base64 we'll prefer it over the application ID.\r\n    $defaultImg = \"iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAJFBMVEUARF0Apc0AmL8ApM0Aos0Aps7\/\/\/8Am8ia1ug9rtLd8\/jw+\/2tMDHwAAAABXRSTlMBrBTIcce4nvwAAAIeSURBVHic7dvrcoMgEAXgiOAivv\/7Fm+JBpCLwk7bsz86rcNkPw+Y0Gl5vd4lGtbLKSG7vmF18mwQnWpe3YcghP2Z1svU8OtbIOihm8op25M2gWBov9UqYJj\/vSRzAGsEkhMglxngWINbdbxLAAAAAAAAAAAAAKAI8Oz2KRtApPWThEyAbT8NZwDZGpeav6sLIKXNMBwAtuGotTGTvTpMRms9qkxEBsDe\/dz+A7B3rufeS\/utrCKPkAywzfYmK8BeOHY+lBkzBImALfwDgA4XnNLphCTA4e43AKmL9vNMJD8pCQAna20nP5D+SfkQgJyp1qS9PYsEKQDnpVP627WYJCgBmGj+GRmUAFIraSXWBAwDcwJJk1AXMIzcgHgElQHxCGoDohHcBsybgIvPpei70S2A0csuaNkTBRBTbA7uAOb271E0+gWxOSgHfG87yD+wGsCz7fGONNf9iwGTb89DnlkwkUVQCPD2t1sXz9A6gMDT5YsgsggKARljI\/vTMkDo7cU3B1USCL+oOwdVAMGF5RlcAxB+tBoBwq\/JDlDcAPYEAGgDuPiNBwkgASSABJAAEkACSAAJIAEkgASQABL4JwlcA9w\/9N4GTOZcl1OQMTgRoEannhv9O\/+PCAAAAAAAAAAAAACAPwhgP+7HeOCR1jOfjBHI9dBrz9W\/34\/d9jyHLvvPweP2GdCx\/3zyvLlAfZ8+l13LktJzAJ+nfgAP50EVLvPsRgAAAABJRU5ErkJggg==\"\r\n    if ($iconUri) {\r\n        Write-Host \"Application ID with Icon found! Checking if the icon and logo were supplied elsewhere...\"\r\n\r\n        if (-not $IconPath -and $IconBase64 -eq $defaultImg) {\r\n            Write-Host \"The icon was not specified elsewhere in the script switching from the default icon to the Applications Notification Icon.\"\r\n            $IconPath = $iconUri\r\n        }\r\n        else {\r\n            Write-Warning \"The icon was already specified either by script parameters or by replacing the default base64. Using that instead.\" \r\n        }\r\n\r\n        if (-not $LogoPath -and $LogoBase64 -eq $defaultImg) {\r\n            Write-Host \"The logo\/image was not specified elsewhere in the script switching from the default image to the Applications Notification Icon.\"\r\n            $LogoPath = $iconUri\r\n        }\r\n        else {\r\n            Write-Warning \"The Logo\/image was already specified either by script parameters or by replacing the default base64. Using that instead.\"\r\n        }\r\n    }\r\n\r\n    # An actual path to an image is prefered over the base64 encoding\r\n    if ($LogoBase64 -and -not $LogoPath) {\r\n        $LogoPath = \"$env:TEMPninjarmm-popup-logo.png\"\r\n        Write-Verbose \"Converting Logo base64 to image and saving to $LogoPath\"\r\n        ConvertFrom-Base64 -Base64 $LogoBase64 -Path $LogoPath\r\n    }\r\n\r\n    # Windows Forms and Wpf will follow a url for the logo but not the taskbar icon. We'll download it and then set the path for the rest of the script here.\r\n    if ($IconPath -match \"^http(.?):\/\/(.*)\") {\r\n        $IconPath = Invoke-Download -URL $IconPath -BaseName \"$env:TEMPninjarmm-popup-icon\"\r\n    }\r\n\r\n    # This will convert the base64 into an image and save it to the temp folder\r\n    if ($IconBase64 -and -not $IconPath) {\r\n        $IconPath = \"$env:TEMPninjarmm-popup-icon.png\"\r\n        Write-Verbose \"Converting Icon base64 to original image and saving to $IconPath...\"\r\n        ConvertFrom-Base64 -Base64 $IconBase64 -Path $IconPath\r\n    }\r\n\r\n    # An IconPath should now exist whether or not base64 was used or not. This will convert the image to a bitmap image and then into a usable icon\r\n    if ($IconPath) {\r\n        Write-Verbose \"Converting image to icon and saving to $env:TEMPninjarmm-popup-icon.ico ...\"\r\n        ConvertFrom-Image -ImagePath $IconPath -Path \"$env:TEMPninjarmm-popup-icon.ico\"\r\n        $IconPath = \"$env:TEMPninjarmm-popup-icon.ico\"\r\n    }\r\n}\r\nprocess {\r\n    # The -winForm parameter is both for testing purposes and for older os's\r\n    if (-not $winForm) {\r\n\r\n        # Time to start creating the form\r\n        Add-Type -AssemblyName PresentationFramework\r\n\r\n        # This section of code will error out when ran multiple times in the same session.\r\n        # This is because you can only enable dpi awareness prior to creating gui objects (DPI awareness should be preserved from the previous running).\r\n        $ErrorActionPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue\r\n        \r\n        [System.Windows.Forms.Application]::EnableVisualStyles()\r\n        [System.Windows.Forms.Application]::SetCompatibleTextRenderingDefault($True)\r\n\r\n        $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Continue\r\n        \r\n        Write-Verbose \"WPF imported successfully using WPF to display PopUp.\"\r\n        \r\n        Build-WPFform\r\n    }\r\n    else {\r\n        Build-WinForm\r\n    }\r\n\r\n    # To prevent the timer from sticking around after the script is done we'll stop it, dispose it and then set it as $null\r\n    Write-Verbose \"Cleaning up timer...\"\r\n    if ($ButtonRcountdown -or $ButtonLcountdown) {\r\n        $Script:Timer.Stop(); \r\n        $Script:Timer.Dispose();\r\n        $Script:Timer = $null\r\n        $Script:CountDown = $null\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\/de\/kostenlosetestversionformular\/\">Zugang erhalten<\/a><\/p>\n<\/div>\n<h2>Detailansicht<\/h2>\n<p><strong>Kernfunktionalit\u00e4t:<\/strong> Das Skript verwendet das Windows Presentation Framework f\u00fcr moderne Windows-Versionen und greift auf Windows Forms f\u00fcr \u00e4ltere Systeme wie Windows 7 oder Server 2008 zur\u00fcck. Es zeigt ein Pop-up mit anpassbaren Optionen wie Schaltfl\u00e4chen, Countdown-Timer und benutzerdefiniertem Text an.<\/p>\n<p><strong>Anpassungsf\u00e4higkeit und Flexibilit\u00e4t:<\/strong> Das Skript bietet verschiedene Parameter zur Anpassung, einschlie\u00dflich Text, Schaltfl\u00e4chen, Aktionen f\u00fcr jede Schaltfl\u00e4che und Countdown-Timer. Es erm\u00f6glicht auch die Verwendung von benutzerdefinierten Bildern und Symbolen, die die Benutzeroberfl\u00e4che verbessern.<\/p>\n<p><strong>Base64-Kodierung f\u00fcr Bilder:<\/strong> Eine innovative Funktion ist die M\u00f6glichkeit, base64-kodierte Bilder f\u00fcr Icons und Logos zu verwenden, wodurch externe Bilddateien \u00fcberfl\u00fcssig werden.<\/p>\n<p><strong>Umgebungsvariablen und Standardeinstellungen:<\/strong> Das Skript kann Umgebungsvariablen f\u00fcr Einstellungen und Standardwerte verwenden, was den Einsatz auf mehreren Systemen vereinfacht.<\/p>\n<h2>Potenzielle Anwendungsf\u00e4lle<\/h2>\n<p>Stellen Sie sich eine IT-Abteilung vor, die Hunderte von Benutzer:innen daran erinnern muss, ihre Computer nach einem wichtigen Update neu zu starten. Mit diesem Skript k\u00f6nnen sie eine Pop-up-Meldung mit einem Countdown-Timer und einer Schaltfl\u00e4che &#8218;Jetzt neu starten&#8216; einblenden, um St\u00f6rungen zu minimieren und die Compliance zu gew\u00e4hrleisten.<\/p>\n<h2>Vergleiche<\/h2>\n<p>Herk\u00f6mmliche Methoden wie E-Mail-Nachrichten oder manuelle Erinnerungen sind weniger effektiv und zeitaufw\u00e4ndiger als dieser automatisierte Ansatz. Im Vergleich zu Tools von Drittanbietern bietet dieses Skript mehr Anpassungsm\u00f6glichkeiten und l\u00e4sst sich nahtlos in bestehende PowerShell-Workflows integrieren.<\/p>\n<h2>FAQs<\/h2>\n<p><strong>F: Kann dieses Skript unter jeder Windows-Version verwendet werden?<\/strong><br \/>\n<strong>A:<\/strong> Es ist f\u00fcr Windows 7 und neuere Versionen, einschlie\u00dflich Server-Editionen, konzipiert.<\/p>\n<p><strong>F: Ist es m\u00f6glich, das Erscheinungsbild des Pop-up-Fensters individuell zu gestalten?<\/strong><br \/>\n<strong>A:<\/strong> Ja, Sie k\u00f6nnen den Text und die Schaltfl\u00e4chen anpassen und sogar Bilder und Symbole hinzuf\u00fcgen.<\/p>\n<p><strong>F: Kann ich dieses Skript auch f\u00fcr andere Aktionen als Neustart-Erinnerungen verwenden?<\/strong><br \/>\n<strong>A:<\/strong> Absolut. Das Skript ist vielseitig und kann f\u00fcr verschiedene Benachrichtigungen und Aktionen angepasst werden.<\/p>\n<h2>Folgen<\/h2>\n<p>Dieses Skript verbessert zwar die Kommunikation und die Compliance durch Benutzer:innen, aber es birgt auch die Verantwortung f\u00fcr eine angemessene Nutzung. Eine \u00fcberm\u00e4\u00dfige oder missbr\u00e4uchliche Nutzung kann zu einer Erm\u00fcdung der Benutzer:innen f\u00fchren und die Wirksamkeit wichtiger Warnmeldungen verringern.<\/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=\"1\" data-aria-level=\"1\"><strong>Gr\u00fcndlich testen:<\/strong> Testen Sie das Skript vor dem weit verbreiteten Einsatz 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=\"2\" data-aria-level=\"1\"><strong>Benutzerschulung:<\/strong> Informieren Sie Benutzer:innen \u00fcber diese Benachrichtigungen und ihre Bedeutung.<\/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>Aktualisierung und Wartung:<\/strong> Aktualisieren Sie das Skript regelm\u00e4\u00dfig und stellen Sie die Kompatibilit\u00e4t mit neuen Windows-Versionen sicher.<\/li>\n<\/ul>\n<h2>Abschlie\u00dfende \u00dcberlegungen<\/h2>\n<p>Im Kontext von MSPs und IT-Abteilungen k\u00f6nnen Tools wie NinjaOne von der Integration solcher PowerShell-Skripte stark profitieren. Dies rationalisiert Prozesse und gew\u00e4hrleistet eine effiziente und effektive Benutzerkommunikation, was ein Eckpfeiler des modernen <a href=\"https:\/\/www.ninjaone.com\/de\/it-management-fuer-unternehmen\/infrastruktur\/\">IT-Infrastrukturmanagements<\/a> darstellt. Dieses PowerShell-Pop-up-Meldungsskript ist ein Beispiel f\u00fcr einen Schritt hin zu interaktiveren und reaktionsf\u00e4higeren IT-Systemen, die die Gesamtproduktivit\u00e4t und Compliance verbessern.<\/p>\n","protected":false},"author":35,"featured_media":193937,"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-456618","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\/456618","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=456618"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media\/193937"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media?parent=456618"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/operating_system?post=456618"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/use_cases?post=456618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}