Dumping Task Sequence Variables 转储,怕丢,已经有一篇类似的404了

news/发布时间2024/5/19 17:48:12

Dumping Task Sequence Variables

 

Several people asked me after the troubleshooting session I presented at MMS 2010 how to write a script to dump out all the task sequence variables.  Here are a few samples showing how to do just that.  (These examples work for ConfigMgr and MDT Lite Touch task sequences.)

First, the absolute “bare bones” approach:


Set env = CreateObject("Microsoft.SMS.TSEnvironment")
For each v in env.GetVariables
   WScript.Echo v & " = " & env(v)
Next


Save that as “DumpVar.vbs” and run it via the task sequence, redirecting the output to a text file.  For example, if you saved this script in the MDT “Scripts” folder, you could use a command line like this:

cmd.exe /c cscript.exe "%ScriptRoot%\DumpVar.vbs" >> %Temp%\DumpVar.txt

If you want to get fancier, you can use MDT’s logging capabilities:


<job id="ZTIConnect">
   <script language="VBScript" src="ZTIUtility.vbs"/>
   <script language="VBScript">

   Set env = CreateObject("Microsoft.SMS.TSEnvironment")
   For each v in env.GetVariables
      oLogging.CreateEntry v & " = " & env(v), LogTypeInfo
   Next

   </script>
</job>


Save that as “DumpVar.wsf” in the MDT “Scripts” folder, and run it with a simpler command line:

cscript.exe "%ScriptRoot%\DumpVar.wsf"

If you would prefer to use PowerShell, the same thing can be done with it:


# Determine where to do the logging
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$logPath = $tsenv.Value("_SMSTSLogPath")
$logFile = "$logPath\$($myInvocation.MyCommand).log"

# Start the logging
Start-Transcript $logFile

# Write all the variables and their values
$tsenv.GetVariables() | % { Write-Host "$_ = $($tsenv.Value($_))" }

# Stop logging
Stop-Transcript


Save that as “DumpVar.ps1” in the MDT “Scripts” folder, and run it using PowerShell.exe (as long as execution of scripts has been enabled):

PowerShell.exe –File "%ScriptRoot%\DumpVar.ps1"

Here are some related links:

https://blogs.technet.com/deploymentguys/archive/2008/08/29/outputting-all-the-configuration-manager-task-sequence-variables.aspx

https://blogs.technet.com/mniehaus/archive/2009/09/22/running-powershell-scripts-as-part-of-a-task-sequence.aspx

A few people commented on how they could see my Administrator account and password details in the output of the script I was running, as I had specified that account for my ConfigMgr network access account.  That’s definitely not a best practice – you should specify an account that has the minimum rights required, typically just enough to connect to your distribution point shares.  It should never have domain admin rights.  (Yes, I was lazy and just reused the only account I set up in my demo VMs.)

You might wonder why the example script above that uses ZTIUtility.vbs doesn’t log the password.  That’s because we have specific logic in that script that refuses to log any line that contains the word “password” as a security feature.

 
 

注释

  •  
    2003年1月1日

    Since many of our task sequence variables were useful reference items, I used a similar script to dump all of the variables to the registry, then went back and deleted any values that were known to contain sensitive information.  Great for troubleshooting failed builds, or having an "as built" record of important information (we used a LOT of custom variables for our builds).

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.ulsteruni.cn/article/37005286.html

如若内容造成侵权/违法违规/事实不符,请联系编程大学网进行投诉反馈email:xxxxxxxx@qq.com,一经查实,立即删除!

相关文章

高校运维赛WEB部分-gxngxngxn

高校运维赛WEB部分-gxngxngxn phpsql 利用万能密码登录 admin/""="a=a 登录进后台后得到flagpyssrf 访问/source可以得到源码 from flask import Flask,request from redis import Redis import hashlib import pickle import base64 import urllib app = Flask…

读天才与算法:人脑与AI的数学思维笔记20_数学图灵测试

读天才与算法:人脑与AI的数学思维笔记20_数学图灵测试1. 数学图灵测试 1.1. 能不能将这种计算机证明语言翻译成易于与人交流的方式呢? 1.1.1. 剑桥大学的两位数学家蒂莫西高尔斯(Timothy Gowers)和莫汉加内萨林加姆(Mohan Ganesalingam)开展了此项研究 1.1.1.1. 他们决定…

HTTP协议相关文档

HTTP The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. bing.com 翻译: 超文本传输协议 (HTTP) 是用于分布式的、协作的、超媒体信息系统的 应用程序级协议。IETF Internet Engi…

TI对OpenVX标准的实现-TIOVX

TIOVX是TI对OpenVX标准的实现 TIOVX允许用户使用OpenVX API创建视觉和计算应用程序。这些OpenVX应用程序可以在TDA2x、TDA3x和TDA4x等TI SoC上执行。TIOVX完全符合OpenVX v1.1规范。TIOVX还为C66x DSP提供了优化的OpenVX内核。扩展API允许用户集成自主开发的自定义内核,并使用…

沟通技巧

第一步:搞定情绪 充分表达尊重,(不吝赞美,如何夸奖别人?从细节和对比可以发现) 夸人的时候不要太笼统,如:你穿的真好看和今天 上衣显的你很白,太美了。。 显然后面这一句显得更加的真诚 找不到细节就用对比,你穿的真好看,比一般人有气质多了。 对比找不到,就直接夸…

如何根据二叉树遍历结果快速绘制二叉树

一、已知前序遍历和中序遍历 (1)前序遍历(根结点--->左子树--->右子树) A B D G H C E I F (2)中序遍历(左子树--->根结点--->右子树) G D H B A E I C F注意:在最后连接二叉树时,注意先完玩左子树,再连右子树 二、已知前后序遍历和中序遍…