Jump to content


Search the Community

Showing results for tags 'run command line'.

  • 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 3 results

  1. OSD Run Command Line: One Liners Please find attached a set of usefull SCCM OSD Task Sequence "Run Command Line" One-Liners Show Task Sequence Name in SCCM Status Messages: cmd.exe /C "echo %_SMSTSPackageName%" Format Disk 0 for Staging (Remove Bitlocker before downloading first Package) cmd.exe /c "(echo select disk 0&& echo.clean&& echo.list disk&& echo.list volume) > .\diskpart.txt && diskpart.exe /s .\diskpart.txt" Adjust OSDDiskIndex (Max two disks) (Useful if a device has two disk and either one can/should be the C drive. Work in combination with the step "Format and Partition Disk" and overwrites the "Disk Number" value) cmd.exe /V /C "(set /a osdID=1-%OSDDiskIndex% > null&& tsenv.exe "OSDDiskIndex=!osdID!")" Set Drive Offline/Online by variable (see: Bitlocker Pre-Provision multi Disk) cmd.exe /c "(echo select disk %OSDDiskIndex%&& echo.offline disk&& echo.list disk) > .\diskpart.txt && diskpart.exe /s .\diskpart.txt" cmd.exe /c "(echo select disk %OSDDiskIndex%&& echo.online disk&& echo.list disk) > .\diskpart.txt && diskpart.exe /s .\diskpart.txt" Fix Drive Letter of mounted devices (Best used in combination with conditions) cmd.exe /V /C "FOR /F %V IN ('mountvol.exe D: /L') DO (mountvol.exe D: /D & mountvol.exe F: %V)" (Checks if devices has one disk and device with drive letter D is an USB Drive --> Map USB from D to F Drive Letter) (Checks if devices has one disk and device with drive letter D is an CDRomDrive --> Map CDRom from D to E Drive Letter) Forcefully halt the task sequence (The file does not exist and therefor generates an error, best/only to use with conditions) Enables Task Sequence Powershell special return codes StopTaskSequenceWithError.exe The step before is a "Run PowerShell Script" step and may return "SomeRandomPs1ReturnCode". But the step does not support defining return codes. To overcome this issue change the powershell script or set "Continue on Error" and create this step afterwards. If you like this collection and have some other useful commands by your own please share them in a "reply to this Topic"
  2. OSD Run Command Line: WMI to TS Variable (Tested with WinPE 1703 and Windows 10 1703 / SCCM 2012 Version 1706 / MDT ) A short guide how to store WMI information into a Task Sequence Variable without the need of a script. (And therefore without a "Update Distribution Point") Create a new "Run Command Line" Step Set the step name for example: "Set Task Sequence Variable OSD_VariableName" Command Line: powershell -Command "& {(New-Object -COMObject Microsoft.SMS.TSEnvironment).Value('OSD_VariableName') = (Get-WmiObject Win32_ComputerSystemProduct).Version}" Done The example shows how to store the property "Version" of the WMI Class "Win32_ComputerSystemProduct" into the Variable "OSD_VariableName". This is for example usefully for Lenovo devices because the property holds the real model name (Lenovo Model Names) and not the cryptic ID which may change. Other examples would be: Device Disk Count: powershell -Command "& {(New-Object -COMObject Microsoft.SMS.TSEnvironment).Value('OSD_DiskCount') = @(Get-WmiObject -query 'Select * from Win32_DiskDrive WHERE MediaType = \"Fixed hard disk media\"').Count}" Device TPM Chip Available: powershell -Command "& {(New-Object -COMObject Microsoft.SMS.TSEnvironment).Value('OSD_TPMChipAvailable') = [boolean](Get-WmiObject -Namespace 'ROOT\cimv2\Security\MicrosoftTpm' -query 'SELECT * FROM Win32_Tpm')}" Event more complicated commands are possible but at some point a script provides more flexibility. Important Note: "Run Command Line" step in conjunction with "powershell -Command "& {Crazy-PowershellFunction}" has problems with double quotes ("). If they are required they need to be escaped with "\". See for example: Device Disk Count: Other special characters my produce similar issues. If you like this quick and simple solution and found some other useful commands please share them in a reply to this Topic
  3. One of the things we have implemented with our in-place refresh is re-installing printers with a powershell script...yes, I know there are ways to do this with GPO...I'm not going into the details, but suffice to say that GPO printer installs are not an option right now (unfortunately). But here's what I have run into...in my powershell, I'm executing the rundll32 printui.dll command. The script loops through and collects info on the printers which were installed and then choses the appropriate printer from that list to set as default, again using the rundll32 printui command. I have to use the rundll32 method because the prnmngr.vbs requires elevation to install a printer, which I can't get through a TS (at least not easily). If I simply run the script by itself then things work perfectly...all printers install and the default is set at the end. However, when running it from a TS, the only thing which doesn't work is setting the default printer. Since it wasn't working in my PS TS step, I figured I would hard-code it in with a Run Command Line step, passing a TS variable in my PS code. That didn't work either. I even setup a VBScript to set the default printer, but that did not work. I'm out of ideas at this point, and I don't know why it wouldn't be working from a TS other than it might be because it is running under a system context instead of a user? I don't know...I'm just stumped right now, and I'm too close to the project right now to think outside of the box at the moment. Any input would be appreciated. thanks.
×
×
  • 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.