<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeviceManagement",
  "identifier" : "/documentation/DeviceManagement/LoginWindowScripts",
  "metadataVersion" : "0.1.0",
  "role" : "Device Management Profile",
  "symbol" : {
    "kind" : "Device Management Profile",
    "modules" : [
      "Device Management"
    ],
    "preciseIdentifier" : "mdm-profiles:LoginWindowScripts"
  },
  "title" : "LoginWindowScripts"
}
-->

# LoginWindowScripts

The payload that configures scripts to run at login and logout.

```
object LoginWindowScripts
```

## Discussion

Specify `com.apple.mcxloginscripts` as the payload type.

The MCX login and logout managed-scripts payload contains information about executable scripts that can run at user login and logout. To use this payload, set `EnableMCXLoginScripts` to `true` in `/var/root/Library/Preferences/com.apple.loginwindow.plist`; otherwise, the system ignores this payload.

`Loginwindow` uses the `LoginHook` and `LogoutHook` string keys in `/var/root/Library/Preferences/com.apple.loginwindow.plist` to indicate a path to the executable script files, which run during user login and logout. The system passes the current user name as an argument to the file.

### Profile availability

|||
|--------------------------|-----|
|Device channel            |macOS|
|User channel              |N/A  |
|Allow manual install      |macOS|
|Requires supervision      |N/A  |
|Requires user-approved MDM|N/A  |
|Allowed in user enrollment|N/A  |
|Allow multiple payloads   |N/A  |

### Profile example

```plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>PayloadContent</key>
    <array>
        <dict>
            <key>loginscripts</key>
            <array>
                <dict>
                    <key>filedata</key>
                    <data>ExampleD</data>
                    <key>filename</key>
                    <string>ping.sh</string>
                </dict>
            </array>
            <key>skipLoginHook</key>
            <true/>
            <key>skipLogoutHook</key>
            <true/>
            <key>PayloadIdentifier</key>
            <string>com.example.myloginwindowscriptspayload</string>
            <key>PayloadType</key>
            <string>com.apple.mcxloginscripts</string>
            <key>PayloadUUID</key>
            <string>2bcd5563-f44d-4f74-b706-050a628c0caf</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
        </dict>
    </array>
    <key>PayloadDisplayName</key>
    <string>Login Window Scripts</string>
    <key>PayloadIdentifier</key>
    <string>com.example.myprofile</string>
    <key>PayloadType</key>
    <string>Configuration</string>
    <key>PayloadUUID</key>
    <string>5cbf617d-16a5-4564-ba2c-728fd7f7d732</string>
    <key>PayloadVersion</key>
    <integer>1</integer>
</dict>
</plist>
```

## Topics

### Objects

[`LoginWindowScripts.ScriptsItems`](/documentation/DeviceManagement/LoginWindowScripts/ScriptsItems)

A dictionary of login scripts.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)