Module for managing windows systems.
depends: |
|
---|
支持reboot, shutdown,等等
salt.modules.win_system.
get_computer_desc
()¶Get the Windows computer description :return:
Returns the computer description if found. Otherwise returns False
CLI 范例:
salt 'minion-id' system.get_computer_desc
salt.modules.win_system.
get_computer_name
()¶获取Windows计算机的主机名
返回: | Returns the computer name if found. Otherwise returns False |
---|
CLI 范例:
salt 'minion-id' system.get_computer_name
salt.modules.win_system.
get_domain_workgroup
()¶Get the domain or workgroup the computer belongs to.
2015.5.7 新版功能.
2015.8.2 新版功能.
返回: | The name of the domain or workgroup |
---|---|
返回类型: | str |
salt.modules.win_system.
get_hostname
()¶2016.3.0 新版功能.
Get the hostname of the windows minion
返回: | Returns the hostname of the windows minion |
---|
CLI 范例:
salt 'minion-id' system.get_hostname
salt.modules.win_system.
get_pending_computer_name
()¶获取更新的计算机名。如果计算机名被更新、并且该更新正在等待重启,函数将会返回更新的计算机名,不然将会返回“None”。若获取更新的计算机名时发生错误,函数将返回“False”,并且会在minion log中记录一条错误信息。
返回: | Returns the pending name if pending restart. Returns none if not pending restart. |
---|
CLI 范例:
salt 'minion-id' system.get_pending_computer_name
salt.modules.win_system.
get_system_date
()¶获取Windows系统日期
返回: | Returns the system date. |
---|---|
返回类型: | str |
CLI 范例:
salt '*' system.get_system_date
salt.modules.win_system.
get_system_info
()¶Get system information.
返回: | Returns a Dictionary containing information about the system to include name, description, version, etc... |
---|---|
返回类型: | dict |
salt.modules.win_system.
get_system_time
()¶Get the system time.
返回: | Returns the system time in HH:MM AM/PM format. |
---|---|
返回类型: | str |
salt.modules.win_system.
halt
(timeout=5, in_seconds=False)¶Halt a running system.
参数: | timeout (int) -- Number of seconds before halting the system. Default is 5 seconds. |
---|---|
返回: | True is successful. |
返回类型: | bool |
Whether to treat timeout as seconds or minutes.
2015.8.0 新版功能.
CLI 范例:
salt '*' system.halt 5
salt.modules.win_system.
init
(runlevel)¶改变系统运行级别在sysV兼容的系统
CLI 范例:
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.
参数: |
|
---|---|
返回: | Returns a dictionary if successful. False if unsuccessful. |
返回类型: | dict, bool |
CLI 范例:
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, in_seconds=False)¶Power off a running system.
参数: | timeout (int) -- Number of seconds before powering off the system. Default is 5 seconds. |
---|---|
返回: | True if successful |
返回类型: | bool |
Whether to treat timeout as seconds or minutes.
2015.8.0 新版功能.
CLI 范例:
salt '*' system.poweroff 5
salt.modules.win_system.
reboot
(timeout=5, in_seconds=False, wait_for_reboot=False)¶Reboot a running system.
参数: |
|
---|---|
返回: | True if successful |
返回类型: |
CLI 范例:
salt '*' system.reboot 5
salt '*' system.reboot 5 True
salt.modules.win_system.
set_computer_desc
(desc=None)¶设置Windows计算机的描述
参数: | desc (str) -- The computer description |
---|---|
返回: | False if it fails. Description if successful. |
CLI 范例:
salt 'minion-id' system.set_computer_desc 'This computer belongs to Dave!'
salt.modules.win_system.
set_computer_name
(name)¶设置Windows计算机的主机名
参数: | name (str) -- The new name to give the computer. Requires a reboot to take effect. |
---|---|
返回: | Returns a dictionary containing the old and new names if successful. False if not. |
CLI 范例:
salt 'minion-id' system.set_computer_name 'DavesComputer'
salt.modules.win_system.
set_hostname
(hostname)¶2016.3.0 新版功能.
Set the hostname of the windows minion, requires a restart before this will be updated.
参数: | hostname (str) -- The hostname to set |
---|
CLI 范例:
salt 'minion-id' system.set_hostname newhostname
salt.modules.win_system.
set_system_date
(newdate)¶设置Windows系统时间。使用 <mm-dd-yy> 的日期格式。
参数: | 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 范例:
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)
参数: | |
---|---|
返回: | True if successful. Otherwise False. |
返回类型: |
CLI 范例:
salt '*' system.set_system_date_ time 2015 5 12 11 37 53
salt.modules.win_system.
set_system_time
(newtime)¶Set the system time.
参数: | 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 True if successful. Otherwise False. |
返回类型: | bool |
salt.modules.win_system.
shutdown
(message=None, timeout=5, force_close=True, reboot=False, in_seconds=False)¶Shutdown a running system.
参数: |
|
---|---|
返回: | True if successful |
返回类型: |
CLI 范例:
salt '*' system.shutdown 5
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
返回: | True if successful |
---|---|
返回类型: | bool |
salt.modules.win_system.
shutdown_hard
()¶Shutdown a running system with no timeout or warning.
返回: | True if successful |
---|---|
返回类型: | bool |
CLI 范例:
salt '*' system.shutdown_hard
salt.modules.win_system.
start_time_service
()¶启动Windows时间服务
返回: | True if successful. Otherwise False |
---|---|
返回类型: | bool |
CLI 范例:
salt '*' system.start_time_service
salt.modules.win_system.
stop_time_service
()¶停止Windows时间服务
返回: | True if successful. Otherwise False |
---|---|
返回类型: | bool |
CLI 范例:
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.
参数: |
|
---|
WORKGROUP
2015.8.2/2015.5.7 新版功能.
参数: | |
---|---|
返回: | Returns a dictionary if successful. False if unsuccessful. |
返回类型: | dict, bool |
CLI 范例:
salt 'minion-id' system.unjoin_domain restart=True
salt 'minion-id' system.unjoin_domain username='unjoinuser' \\
password='unjoinpassword' disable=True \\
restart=True