Adding remote machine to AD via Powershell

336

Solution 1

Figured it out, if I set-item wsman:\localhost\Client\TrustedHosts -value * on my local machine to allow remote connections from untrusted sources since certificate errors don't pop up.

And then move it into a ScriptBlock it runs.

Solution 2

Add-Computer will add the local computer to a domain : Link

You can try to add your machine using PowerShell Remoting

Share:
336

Related videos on Youtube

bkrish
Author by

bkrish

Updated on September 18, 2022

Comments

  • bkrish
    bkrish over 1 year

    I am trying to migrate a Spring Cloud Stream application Chelsea.SR1 to Horsham. This project does not have binder but uses spring messaging and integration to integrate a custom source and sink.

    It looks like AggregateApplicationBuilder is not available anymore. How do I bind the source, transformer and sink without AggregateApplicationBuilder ?

    Or is there a better way to implement this in Horsham? The only constraint I have is, I need to use Pollable source/consumer.

    Thanks in advance!

    pom.xml

      <modelVersion>4.0.0</modelVersion>
      <artifactId>example-info-processor</artifactId>
      <groupId>com.example.streams</groupId>
      <version>1.2-SNAPSHOT</version>
      <packaging>jar</packaging>
      <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
        <relativePath />
      </parent>
      <properties>
        <spring-cloud.version>Chelsea.SR1</spring-cloud.version>
      </properties>
      <dependencies>
        <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-stream</artifactId>
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-messaging</artifactId>
          <version>4.3.17.RELEASE</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-core</artifactId>
          <version>4.3.15.RELEASE</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-web</artifactId>
          <version>4.3.20.RELEASE</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-webmvc</artifactId>
          <version>4.3.24.RELEASE</version>
        </dependency>
      </dependencies>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
    </project>
    

    Application

    @SpringBootApplication
    @ComponentScan(basePackages = {
            "com.example.streams",
    })
    public class ExampleInfoProcessorApplication extends SpringBootServletInitializer {
        public static void main(String[] args) {
            new AggregateApplicationBuilder(ExampleInfoProcessor.class, args)
                    .from(ExampleInfoConsumer.class).via(ExampleInfoTransformer.class)
                    .to(ExampleInfoSink.class).run(args);
        }
    }
    

    Source

    @EnableBinding(Source.class)
    public class ExampleInfoConsumer {
        @Autowired
        private MyConsumer customConsumer;
    
        @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "30"))
        public List<ExampleRecord> consume() {
          //Read the available chunk from the source location
                .....
            return exampleRecordsList;
        }
    }
    

    Transformer

    @EnableBinding(Processor.class)
    public class ExampleInfoTransformer {
    
        @Transformer(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT)
        public Map<String, List<ExampleInfo>> transform(List<ExampleRecord> exampleRecords) {
            //transform the consumer records, store the list of ExampleInfo objects in a map using ExampleInfo key
            return map;
        }
    }
    

    Sink

    @EnableBinding(Sink.class)
    public class ExampleInfoSink {
    
        @ServiceActivator(inputChannel = Sink.INPUT)
        public void sink(Map<String, List<ExampleInfo>>  exampleInfoMap) {
            //Read from map and write to destination.
        }
    }
    
  • joeqwerty
    joeqwerty almost 10 years
    make sure Remote Registry service is running and accessible, ie. disable firewall or create an exception - Creating a firewall rule for the Remote Registry service doesn't start the service. The OP needs to do both, create a firewall rule and start the service.
  • Raf
    Raf almost 10 years
    @joeqwerty - that's what the answer says ""..make sure Remote Registry service is running and accessible.." where and implies what it traditionally does which is both conditions to be true:)
  • joeqwerty
    joeqwerty almost 10 years
    I took your use of ie to mean in essence which I thought meant that you were implying that creating a firewall rule was all that was necessary and I wanted to clarify that the service needs to be started in addition to creating a firewall rule.
  • Dan Pritts
    Dan Pritts almost 10 years
    i.e. is actually an abbreviation for the Latin id est. Although "in essence" isn't a bad translation of the meaning. en.wikipedia.org/wiki/List_of_Latin_phrases_(I) I must admit to making the same mistake myself once.
  • jscott
    jscott almost 10 years
    Glad you've resolved this. Please be sure to mark your answer as accepted when you're able.