- FirstLogonCommands
- Child Elements
- Valid Configuration Passes
- Parent Hierarchy
- Applies To
- XML Example
- Команда Log Command Window Output Log Command window output command
- Синтаксис Syntax
- Аргументы Arguments
- Коммутаторы Switches
- Комментарии Remarks
- Примеры Examples
- Windows Setup Log Files and Event Logs
- WindowsВ Setup Event Logs
- To view the WindowsВ Setup event logs
- To Export the log to a file
- Windows : logoff from command line
- Get-Event Log
- Syntax
- Description
- Examples
- Example 1: Get event logs on the local computer
- Example 2: Get recent entries from an event log on the local computer
- Example 3: Find all sources for a specific number of entries in an event log
- Example 4: Get error events from a specific event log
- Example 5: Get events from an event log with an InstanceId and Source value
- Example 6: Get events from multiple computers
- Example 7: Get all events that include a specific word in the message
- Example 8: Display the property values of an event
- Example 9: Get events from an event log using a source and event ID
- Example 10: Get events and group by a property
- Example 11: Get events that occurred during a specific date and time range
- Parameters
- Inputs
- Outputs
- Notes
FirstLogonCommands
FirstLogonCommands specifies commands to run the first time a user logs on to the computer. These commands run only once. FirstLogonCommands are not supported in Windows 10 in S mode.
Windows 10 doesn’t support setting a custom shell prior to OOBE. If you do, you won’t be able to deploy the resulting image.
When a user with administrative privileges logs in for the first time, these commands are run with elevated access privileges.
If you create a user account that does not include administrative privileges, the following commands may not run:
- If User Account Control is enabled, then when that user logs in for the first time, a dialog box appears, prompting the user with an option to allow an administrator to apply the commands. If the user selects Cancel, these commands don’t run.
- If User Account Control is disabled, these commands don’t run.
The commands run after logon, prior to showing the desktop.
If the command launches a separate system process, the system process will run independently of the commands. This enables you to create commands that terminate quickly, allowing the user to reach the desktop faster.
Other processes, such as services, are not restricted by FirstLogonCommands and will continue to start or to terminate independently.
This command now works like Microsoft-Windows-Shell-Setup-LogonCommands-AsynchronousCommand: all commands using these unattend settings are now started at the same time, and no longer wait for the previous command to finish.
When you add a script using FirstLogonCommands, it will be triggered on the next boot, even if you boot into audit mode using Ctrl+Shift+F3. If you plan to use audit mode later, add the following setting to skip this script automatically: Microsoft-Windows-Deployment-Reseal-Mode = Audit.
Child Elements
Setting | Description |
---|---|
SynchronousCommand | Specifies a command to run the first time a user logs on to the computer, its description, and the order in which it is run. |
Valid Configuration Passes
Parent Hierarchy
Applies To
For a list of the Windows editions and architectures that this component supports, see Microsoft-Windows-Shell-Setup.
XML Example
The following XML output shows how to specify two commands to run after first logon.
Команда Log Command Window Output Log Command window output command
Копирует все входные и выходные данные из окна Команда в файл. Copies all input and output from the Command window into a file.
Синтаксис Syntax
Аргументы Arguments
filename
Необязательный элемент. Optional. Имя файла журнала. The name of the log file. По умолчанию этот файл создается в папке профиля пользователя. By default, the file is created in the user’s profile folder. Если такое имя файла уже существует, журнал добавляется в конец имеющегося файла. If the file name already exists, the log is appended to the end of the existing file. Если файл не указан, используется последний указанный файл. If no file is specified, the last file specified is used. Если предыдущий файл отсутствует, создается файл журнала по умолчанию с именем cmdline.log. If no previous file exists, a default log file is created, called cmdline.log.
Чтобы изменить расположение для сохранения файла журнала, введите полный путь. Если этот путь содержит пробелы, заключите его в кавычки. To change the location where the log file is saved, enter the full path of the file, surrounded by quotation marks if the path contains any spaces.
Коммутаторы Switches
/on /on
Необязательный параметр. Optional. Запускает ведение журнала для окна Команда в указанном файле, добавляя в него новые данные. Starts the log for the Command window in the specified file and appends the file with the new information.
/off /off
Необязательный параметр. Optional. Останавливает ведение журнала для окна Команда. Stops the log for the Command window.
/overwrite /overwrite
Необязательный параметр. Optional. Если указанный в аргументе filename файл совпадает с существующим файлом, он перезаписывается. If the file specified in the filename argument matches an existing file, the file is overwritten.
Комментарии Remarks
Если файл не указан, создается файл по умолчанию cmdline.log. If no file is specified, the file cmdline.log is created by default. По умолчанию эта команда имеет псевдоним Log. By default, the alias for this command is Log.
Примеры Examples
Этот пример создает файл журнала cmdlog и запускает ведение журнала команд. This example creates a new log file, cmdlog, and starts the command log.
Этот пример останавливает ведение журнала команд. This example stops logging commands.
Этот пример возобновляет ведение журнала команд в ранее использовавшемся файле. This example resumes the logging of commands in the previously used log file.
Windows Setup Log Files and Event Logs
Windows® Setup creates log files for all actions that occur during installation. If you are experiencing problems installing Windows, consult the log files to troubleshoot the installation.
WindowsВ Setup log files are available in the following directories:
Log file location | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Type: | DateTime |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Indicates that this cmdlet returns a standard System.Diagnostics.EventLogEntry object for each event. Without this parameter, Get-EventLog returns an extended PSObject object with additional EventLogName, Source, and InstanceId properties.
To see the effect of this parameter, pipe the events to the Get-Member cmdlet and examine the TypeName value in the result.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Indicates that this cmdlet returns the output as strings, instead of objects.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Gets events that occurred before a specified date and time. The Before parameter date and time are excluded from the output. Enter a DateTime object, such as the value returned by the Get-Date cmdlet.
Type: | DateTime |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
This parameter specifies a remote computer’s NetBIOS name, Internet Protocol (IP) address, or a fully qualified domain name (FQDN).
If the ComputerName parameter isn’t specified, Get-EventLog defaults to the local computer. The parameter also accepts a dot ( . ) to specify the local computer.
The ComputerName parameter doesn’t rely on Windows PowerShell remoting. You can use Get-EventLog with the ComputerName parameter even if your computer is not configured to run remote commands.
Type: | String [ ] |
Aliases: | Cn |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies, as a string array, the entry type of the events that this cmdlet gets.
The acceptable values for this parameter are:
- Error
- Information
- FailureAudit
- SuccessAudit
- Warning
Type: | String [ ] |
Aliases: | ET |
Accepted values: | Error, Information, FailureAudit, SuccessAudit, Warning |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the index values to get from the event log. The parameter accepts a comma-separated string of values.
Type: | Int32 [ ] |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the Instance IDs to get from the event log. The parameter accepts a comma-separated string of values.
Type: | Int64 [ ] |
Position: | 1 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Displays the list of event logs on the computer.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the name of one event log. To find the log names use Get-EventLog -List . Wildcard characters are permitted. This parameter is required.
Type: | String |
Aliases: | LN |
Position: | 0 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Specifies a string in the event message. You can use this parameter to search for messages that contain certain words or phrases. Wildcards are permitted.
Type: | String |
Aliases: | MSG |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Begins with the newest events and gets the specified number of events. The number of events is required, for example -Newest 100 . Specifies the maximum number of events that are returned.
Type: | Int32 |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies, as a string array, sources that were written to the log that this cmdlet gets. Wildcards are permitted.
Type: | String [ ] |
Aliases: | ABO |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Specifies, as a string array, user names that are associated with events. Enter names or name patterns, such as User01 , User* , or Domain01\User* . Wildcards are permitted.
Type: | String [ ] |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Inputs
None
You cannot pipe input to Get-EventLog .
Outputs
System.Diagnostics.EventLogEntry. System.Diagnostics.EventLog. System.String
If the LogName parameter is specified, the output is a collection of System.Diagnostics.EventLogEntry objects.
If only the List parameter is specified, the output is a collection of System.Diagnostics.EventLog objects.
If both the List and AsString parameters are specified, the output is a collection of System.String objects.
Notes
The cmdlets Get-EventLog and Get-WinEvent are not supported in the Windows Preinstallation Environment (Windows PE).