Jump to content


bart dm

windows 10 osd add client to device collection powershell

Recommended Posts

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

 

Share this post


Link to post
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • 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.