Skip to content

windows 10 osd add client to device collection powershell

Featured Replies

dear all,

I have a problem with adding a client during osd to a device collection.

After install of the os en sccm client we want to add it automatically to a device collection where windows updates are linked to.

I ve found a script on the web which we adapted to our needs

_____________________________________

 

$computer = hostname 
$remotesession = New-PSSession -ComputerName YourSiteServer -ConfigurationName Microsoft.PowerShell32 
Invoke-Command -Session $remotesession -ScriptBlock { 
    param($computer) 
    Import-module 'D:\Program Files\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1' 
        Set-Location YourSiteCode: 
            Add-CMDeviceCollectionDirectMembershipRule -CollectionName "YourCollectionName" -ResourceID (Get-CMDevice -Name $computer).ResourceID 
} -Args $computer 
Remove-PSSession $remotesession

__________________________________

powershell remote connection is enabled on our sccm server, but the execution is blocked by our server.

I think we have to set the executionpolicy on our server but which one and which value do we have to set?

thank you al

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.