Cant Move Computer into an OU via Powershell


greetings,

below script im trying run in adps. im trying move pc 1 ou , put username in description field. able "set-adcomputer $computer -description $userid" working "move-adobject $computer -targetpath 'ou=laptops,ou=pc-computers,dc=pc,dc=com'" i'm  having trouble with.

i'm thinking its syntax issue wrong. assistance great.

thanks all.  

##laptop name username ou name##  $computer= read-host "what name of laptop move laptop ou?"  $userid= read-host "what name of user computer?"     ##move laptop ou##  move-adobject $computer -targetpath 'ou=laptops,ou=pc-computers,dc=pc,dc=com'    ##add name description in computer object##   set-adcomputer $computer -description $userid
here error throws.

 

move—adobject : cannot find object identity: ‘2ua2061fnh’ under: ‘dc=pc

, dc=com’ .

at c:\powershell\movelaptop4.ps1:6 char:14

+ move—adobject « $computer  -targetpath ‘ou=laptops,ou=pc-computers,dc=pc, dc=com’

+ categorylnfo                             : objectnotfound: <2ua2061fnh:adobject) [move—adob

ject]. adldentitynotfoundexception

+ fullyqualifiederrorld : cannot find object identity: ‘2ua2061fnh'

‘ under: ‘dc=pc,dc=com’ .,microsoft.activedirectory.managenent.commands.

move adobject

 

the move-adobject cmdlet accepts distinguishedname or guid identify object. name uniquely identifies computers (although not always), more of problem other classes. use get-adcomputer retrieve object name , pipe move-adobject.

richard mueller - mvp directory services




Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

CRL Revocation always failed

Failed to query the results of bpa xpath

0x300000d errors in Microsoft Remote Desktop client