Module for managing windows systems.
depends: |
|
---|
Support for reboot, shutdown, etc
salt.modules.win_system.
get_computer_desc
()¶Get the Windows computer description
Returns: | Returns the computer description if found. Otherwise returns False |
---|
CLI Example:
salt 'minion-id' system.get_computer_desc
salt.modules.win_system.
get_computer_name
()¶Get the Windows computer name
Returns: | Returns the computer name if found. Otherwise returns False |
---|
CLI Example:
salt 'minion-id' system.get_computer_name
salt.modules.win_system.
get_domain_workgroup
()¶Get the domain or workgroup the computer belongs to.
New in version 2015.5.7.
New in version 2015.8.2.
Returns: | The name of the domain or workgroup |
---|---|
Return type: | str |
salt.modules.win_system.
get_pending_computer_name
()¶Get a pending computer name. If the computer name has been changed, and the
change is pending a system reboot, this function will return the pending
computer name. Otherwise, None
will be returned. If there was an error
retrieving the pending computer name, False
will be returned, and an
error message will be logged to the minion log.
Returns: | Returns the pending name if pending restart. Returns none if not pending restart. |
---|
CLI Example:
salt 'minion-id' system.get_pending_computer_name
salt.modules.win_system.
get_system_date
()¶Get the Windows system date
Returns: | Returns the system date. |
---|---|
Return type: | str |
CLI Example:
salt '*' system.get_system_date
salt.modules.win_system.
get_system_info
()¶Get system information.
Returns: | Returns a Dictionary containing information about the system to include name, description, version, etc... |
---|---|
Return type: | dict |
salt.modules.win_system.
get_system_time
()¶Get the system time.
Returns: | Returns the system time in HH:MM AM/PM format. |
---|---|
Return type: | str |
salt.modules.win_system.
halt
(timeout=5)¶Halt a running system.
Parameters: | timeout (int) -- Number of seconds before halting the system. Default is 5 seconds. |
---|---|
Returns: | True is successful. |
Return type: | bool |
CLI Example:
salt '*' system.halt
salt.modules.win_system.
init
(runlevel)¶Change the system runlevel on sysV compatible systems
CLI Example:
salt '*' system.init 3
salt.modules.win_system.
join_domain
(domain, username=None, password=None, account_ou=None, account_exists=False, restart=False)¶Join a computer to an Active Directory domain. Requires reboot.
Parameters: |
|
---|
New in version 2015.5.7.
New in version 2015.8.2.
Returns: | Returns a dictionary if successful. False if unsuccessful. |
---|---|
Return type: | dict, bool |
CLI Example:
salt 'minion-id' system.join_domain domain='domain.tld' \
username='joinuser' password='joinpassword' \
account_ou='ou=clients,ou=org,dc=domain,dc=tld' \
account_exists=False, restart=True
salt.modules.win_system.
poweroff
(timeout=5)¶Power off a running system.
Parameters: | timeout (int) -- Number of seconds before powering off the system. Default is 5 seconds. |
---|---|
Returns: | True if successful |
Return type: | bool |
CLI Example:
salt '*' system.poweroff
salt.modules.win_system.
reboot
(timeout=5)¶Reboot a running system.
Parameters: | timeout (int) -- Number of seconds before rebooting the system. Default is 5 seconds. |
---|---|
Returns: | True if successful |
Return type: | bool |
CLI Example:
salt '*' system.reboot
salt.modules.win_system.
set_computer_desc
(desc=None)¶Set the Windows computer description
Parameters: | desc (str) -- The computer description |
---|---|
Returns: | False if it fails. Description if successful. |
CLI Example:
salt 'minion-id' system.set_computer_desc 'This computer belongs to Dave!'
salt.modules.win_system.
set_computer_name
(name)¶Set the Windows computer name
Parameters: | name (str) -- The new name to give the computer. Requires a reboot to take effect. |
---|---|
Returns: | Returns a dictionary containing the old and new names if successful. False if not. |
CLI Example:
salt 'minion-id' system.set_computer_name 'DavesComputer'
salt.modules.win_system.
set_system_date
(newdate)¶Set the Windows system date. Use <mm-dd-yy> format for the date.
Parameters: | newdate (str) -- The date to set. Can be any of the following formats - YYYY-MM-DD - MM-DD-YYYY - MM-DD-YY - MM/DD/YYYY - MM/DD/YY - YYYY/MM/DD |
---|
CLI Example:
salt '*' system.set_system_date '03-28-13'
salt.modules.win_system.
set_system_date_time
(years=None, months=None, days=None, hours=None, minutes=None, seconds=None)¶Set the system date and time. Each argument is an element of the date, but not required. If an element is not passed, the current system value for that element will be used. For example, if you don't pass the year, the current system year will be used. (Used by set_system_date and set_system_time)
Parameters: | |
---|---|
Returns: | True if successful. Otherwise False. |
Return type: |
CLI Example:
salt '*' system.set_system_date_ time 2015 5 12 11 37 53
salt.modules.win_system.
set_system_time
(newtime)¶Set the system time.
Parameters: | newtime (str) -- The time to set. Can be any of the following formats. - HH:MM:SS AM/PM - HH:MM AM/PM - HH:MM:SS (24 hour) - HH:MM (24 hour) |
---|---|
Returns: | Returns True if successful. Otherwise False. |
Return type: | bool |
salt.modules.win_system.
shutdown
(message=None, timeout=5, force_close=True, reboot=False)¶Shutdown a running system.
Parameters: |
|
---|---|
Returns: | True if successful |
Return type: |
salt.modules.win_system.
shutdown_abort
()¶Abort a shutdown. Only available while the dialog box is being displayed to the user. Once the shutdown has initiated, it cannot be aborted
Returns: | True if successful |
---|---|
Return type: | bool |
salt.modules.win_system.
shutdown_hard
()¶Shutdown a running system with no timeout or warning.
Parameters: | timeout (int) -- Number of seconds before shutting down the system. Default is 5 seconds. |
---|---|
Returns: | True if successful |
Return type: | bool |
CLI Example:
salt '*' system.shutdown_hard
salt.modules.win_system.
start_time_service
()¶Start the Windows time service
Returns: | True if successful. Otherwise False |
---|---|
Return type: | bool |
CLI Example:
salt '*' system.start_time_service
salt.modules.win_system.
stop_time_service
()¶Stop the Windows time service
Returns: | True if successful. Otherwise False |
---|---|
Return type: | bool |
CLI Example:
salt '*' system.stop_time_service
salt.modules.win_system.
unjoin_domain
(username=None, password=None, domain=None, workgroup='WORKGROUP', disable=False, restart=False)¶Unjoin a computer from an Active Directory Domain. Requires restart.
Parameters: |
|
---|
WORKGROUP
New in version 2015.5.7.
New in version 2015.8.2.
Parameters: |
---|
New in version 2015.5.7.
New in version 2015.8.2.
Returns: | Returns a dictionary if successful. False if unsuccessful. |
---|---|
Return type: | dict, bool |
CLI Example:
salt 'minion-id' system.unjoin_domain restart=True
salt 'minion-id' system.unjoin_domain username='unjoinuser' \\
password='unjoinpassword' disable=True \\
restart=True