Hi, Emil here. Have you ever wonder howto connect to a configuration manager 2012 site from Powershell? Okay, follow the steps below to success:

Requirements:

  • SCCM 2012 Console
  • Powershell 3.0
  • Be a member of SCCM Site Administrators group

1. Install Required Stuff and add you to Sccm Site Admin group.

After you have installed you required stuff like Powershell 3.0 and SCCM 2012 Console on your client or server, you are ready to go to next steps.

2. Start the builtin Windows PowerShell Integrated Scripting Environment (ISE) as a SCCM-Site-administrator.

3. Load the Configuration Manager Module. Type and run following Line:

Import-Module ((Split-Path $env:SMS_ADMIN_UI_PATH) + "\ConfigurationManager.psd1")

4. After you imported the ConfigMgr Module. Now you can go to that psdrive with following line:

Set-Location -Path ((Get-PSDrive -PSProvider CMSite).Name + ":\")

5. Now you are ready to do some rocken roll with your Sccm Site. ex: Try following line, to see all cmdlets for Configuration Manager 2012.

Get-Command -Module ConfigurationManager

Isn’t that cool?

And Here some cool script you can put at beginning of your script, to validate if the configMgr Module is loaded or not. If not loaded – load the module. Else go to cmSite Drive.

# Load the Configuration Manager Module.</pre>
<code> If (!(Get-Module -Name ConfigurationManager))
{
Import-Module ((Split-Path $env:SMS_ADMIN_UI_PATH) + "\ConfigurationManager.psd1")
Set-Location -Path ((Get-PSDrive -PSProvider CMSite).Name + ":\")
}
else
{
Set-Location -Path ((Get-PSDrive -PSProvider CMSite).Name + ":\")
} # End Of script - Load the Configuration Manager Module.</code>


System CenterAlong with the Technical Previews of Windows 10 and Windows Server, Microsoft has made the Microsoft System Center Technical Preview available for download. The Microsoft System Center Technical Preview delivers unified management across on-premises, service provider, and Microsoft Azure environments, thereby enabling the Microsoft Cloud OS.

System Center offers exciting new features and enhancements across infrastructure provisioning, infrastructure monitoring, application performance monitoring, automation, backup and IT service management.

The preview is focused on cloud based solutions and available for testing now are the following components: Orchestrator, Operations Manager, Data Protection Manager, Virtual Machine Manager, and Service Manager.

You can download the System Center Technical Preview from MS Evaluation Center.

For a preview of Configuration Manager, our favorite piece in the puzzle, we will have to wait until sometime in early 2015.

 

Microsoft has also released VHD files for each of the above mentioned products available in the current Technical Preview. These can be used to easily boot a virtual machine to start testing more quickly, retain custom settings, and allow you to start from a scratch installation if you need to.

Here are download-links for the VHD’s

Data Protection Manager
Operations Manager
Orchestrator
Service Manager
Virtual Machine Manager

 

Ps.
Don’t miss blog post from the SCCM Team about Windows 10 enterprise management with System Center Configuration Manager and Intune.

1) Download the Script. Change the file extension from txt to ps1 and save it to networkshare. The GUI is created with Sapien Powershell Studio
2) Create a package in sccm but do not create a program. Distribute the package to DP.
3) Edit your Task Sequence and add ”Run Powershell Script”. Browse for the package you just create and write the name of the script in ”Script Name” section. Change execution policy to ”bypass”.
4) Deploy you TS.

OSDpopup

DO NOT forget to update your boot image to support .Net and Powershell.

1) Save the following script as OSDComputerName.ps1 on a networkshare.

I use Hyper-v in my labb and Hyper-v virtual machin gives you over 30 digits of serialnumber and here in this script i want only the four first of them. This is because NetBios computer names can handle a maximum lenght of 15 characters.

$SerialNumber = (Get-WmiObject -Class Win32_BIOS | Select-Object SerialNumber).SerialNumber
$ShortSerialNumber = $SerialNumber.Substring(0,4)
$OSDComputerName = “LABB-” + $ShortSerialNumber
$TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$TSEnv.Value(“OSDComputerName”) = “$OSDComputerName”

2) Create a package in sccm but do not create a program. Distribute the package to DP.

3) Edit your TS and create a ”Group” before ”Apply Windows/Nework Settings” and name it OSDComputerName.

4) Add a ”Run Command Line” with the name ”Set PowerShell Execution Policy” and paste the following:

powershell.exe -noprofile -command "Set-ExecutionPolicy Bypass LocalMachine" -force

5) Add a ”Run command Line” with the name ”OSDComputerName.ps1” and paste the following:

powershell.exe -noprofile -file OSDcomputername.ps1

In ”Package” section browse for the script we created and saved in a networkshare.

6) Add a ”Run command Line” with the name ”Revert Powershell Execution Policy” and paste the following:

powershell.exe -noprofile -command "Set-ExecutionPolicy RemoteSigned LocalMachine" -force

Save the TS and test in your test environament.

Hello!

Here is some script to force a Sccm Client’s Machine Policy Cycle on remote client in a domain.

But first. You need to be sure you have enable the service ”Windows Remote Managment” on that client in the domain.
And be sure you run the script in correct logon context.

Link: http://msdn.microsoft.com/en-us/library/aa384372(v=vs.85).aspx

Script:

$ComputerName = Read-host("Enter The computername")</code>

<code>Invoke-Command -ComputerName $ComputerName -ScriptBlock {
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000021}"
}

Windows
Windows To Go
lets you to boot and run Windows 8 (Enterprise) from a USB stick as well as allowing you to connect to your corporate infrastructure from that image.

So how to deploy Windows To Go in your organization?

Peter Daalmans (MVP in System Center Configuration Manager) has published a blog article in three parts about how to deploy Windows To Go (onto a Ironkey Workspace W500) using SCCM 2012.

Windows To Go, Ironkey and SCCM 2012 R2 better together – part 1
Windows To Go, Ironkey and SCCM 2012 R2 better together – part 2
Windows To Go, Ironkey and SCCM 2012 R2 better together – part 3

As an alternative, Mikael Nystrom has posted a comprehensive blog post about Deploying Windows To Go devices using PowerShell. He generously published the script as well. Thanks Mikael!

Happy deploying 2014!