13 April 2018

PowerShell : Find user exist in AD -GROUP

Some times we do need to find users exist in AD group we assign any tickets and perform any activity
here is a sudo code i created in powershell to help you.

Code Step 1 Should be part of input


$cmdOutput = net group YOURADGROUPNAME /domain ;
$var = "USERNAME";



Code Step 2 : loop users and check for user



function finduser() {
for($i = 0; $i -lt $cmdOutput.Count; $i++) {
if($cmdOutput[$i] -eq $var){
$found="T"
write-host "--FOUND-->" $cmdOutput[$i]}
}
if($found -eq "T"){
write-host -ForegroundColor Green "Wow user found " $var}
else {
write-host -ForegroundColor Magenta "SORRY -Scanned records "$cmdOutput.Count " But " $var " not Found"
}
}

finduser



Angular 4/5 & SignalR connection


Signal R is one of the most widely used 

Step1:install i @aspnet/signalr-client --save
Step 2: include needed import in your component.

import { HubConnection } from '@aspnet/signalr-client';

now in your component

//HUB connection
this.connection = $.hubConnection(this.signalRURL);
this.connection.logging = true;
this.proxy = this.connection.createHubProxy('HUBNAME');

this.proxy.on('broadcastMessage', (data: any) => {
var msg = (JSON.parse(data)); Alert(msg); });
this.connection.start().done((data: any) => {
console.log(data.id);
}).catch((error: any) => {
this.connectionStatus = "Connection Failed";
console.log('Hub error -> ' + error);
});


 

Rate Now: