Jump to content


Search the Community

Showing results for tags 'Powershell Custom Script Var'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Cloud
    • Azure
    • Microsoft Intune
    • Office 365
    • Windows 365
  • General Stuff
    • General Chat
    • Events
    • Site News
    • Official Forum Supporters
    • Windows News
    • Suggestion box
    • Jobs
  • MDT, SMS, SCCM, Current Branch &Technical Preview
    • How do I ?
    • Microsoft Deployment Toolkit (MDT)
    • SMS 2003
    • Configuration Manager 2007
    • Configuration Manager 2012
    • System Center Configuration Manager (Current Branch)
    • Packaging
    • scripting
    • Endpoint Protection
  • Windows Client
    • how do I ?
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows Vista
    • Windows XP
    • windows screenshots
  • Windows Server
    • Windows Server General
    • Active Directory
    • Microsoft SQL Server
    • System Center Operations Manager
    • KMS
    • Windows Deployment Services
    • NAP
    • Failover Clustering
    • PKI
    • Hyper V
    • Exchange
    • IIS/apache/web server
    • System Center Data Protection Manager
    • System Center Service Manager
    • System Center App Controller
    • System Center Virtual Machine Manager
    • System Center Orchestrator
    • Lync
    • Application Virtualization
    • Sharepoint
    • WSUS

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests

Found 1 result

  1. Ok, I am trying to run a Custom Powershellscript and I need to access some custom MDTvariables. This should be simple but I am burning TIME here because I fail at some point . My Environment: SCCM 2007 SP2 R3 with integrated MDT 2012 Update 1 This is what I try to do, am I doing something stupid here? I create a Client MDT Task Sequence. In Customsettings.ini I declare some custom variables, ZTIGather seems to pick them up according the ZTIGather.log. Properties=AutoLogonUserName, AutoLogonDomainName, RunOnceCMD, RunOncePsScript [Default] AutoLogonUserName=testuser AutoLogonDomainName=testdomain RunOnceCMD= RunOncePsScript=C:\Windows\MEDIA\AutoLogon4InstCheck\RunOnceTestBox.ps1 In the full windowsphase in the Task Sequence I add a built in "Run PowerShell Script" and point it to my scriptfile in %SCRIPTROOT%. No parameters, scriptinput should come from my custom MDT variables... Here is my Powershellscript(i'm trying to add some registrysettings for autologon and runonce). I try to populate the scriptparameters with for exampel $TSEnv:AutoLogonUserName , the TSENV PSDrive should be automatically populated when using the built in "Run Powershell Script" action in the Task Sequence. $TSEnv:AutoLogonPassword is set as a collection variable in the SCCMconsole to hide it. [cmdletbinding()] param ( [parameter(mandatory=$true)] [string] $AutoLogonUserName = $TSEnv:AutoLogonUserName, [parameter(mandatory=$true)] [string] $AutoLogonPassword = $TSEnv:AutoLogonPassword, [parameter(mandatory=$true)] [string] $AutoLogonDomainName = $TSEnv:AutoLogonDomainName, [int] $AutoLogonCount = 1, [string] $RunOnceCMD = $TSEnv:RunOnceCMD, [string] $RunOncePsScript = $TSEnv:RunOncePsScript, [switch] $AutoAdminLogonDisable ) begin { [string] $WinlogonPath = "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" [string] $WinlogonBannerPolicyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" [string] $RunOnceKey = "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce" [string] $Enable = 1 [string] $Disable = 0 #Import-Module ZTIUtility #disable in SCCM/MDT Production, only for testing. } process { If($AutoAdminLogonDisable -eq $true) { Set-ItemProperty -Path $WinlogonPath -Name AutoAdminLogon -Value $Disable -Force Set-ItemProperty -Path $WinlogonPath -Name DefaultPassword -Value $null -Force #Clear password from registry, best practise because it is stored unencrypted. } Else { Set-ItemProperty -Path $WinlogonPath -Name AutoAdminLogon -Value $Enable -Force Set-ItemProperty -Path $WinlogonPath -Name DefaultPassword -Value $AutoLogonPassword -Force } Set-ItemProperty -Path $WinlogonPath -Name DefaultUserName -Value $AutoLogonUserName -Force Set-ItemProperty -Path $WinlogonPath -Name DefaultDomainName -Value $AutoLogonDomainName -Force Set-ItemProperty -Path $WinlogonPath -Name AutoLogonCount -Value $AutoLogonCount -Force Set-ItemProperty -Path $RunOnceKey -Name RunPSScript1 -Value "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -noprofile -sta -WindowStyle Hidden -executionpolicy bypass -nologo -file $RunOncePsScript" -Force } end { } This method fails because the MDTvariables seems to be empty or non existent when the script runs? The logfile from the script is created in the CCM\logs folder so it is indeed started. What am I doing wrong here, this should be SIMPLE
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.