Bash script for checking link status
So I'm doing some SEO work I've been tasked with checking a couple hundred thousand back links for quality. I found myself spending a lot of time navigating to sites that no longer existed. I figured I would make a bash script that checks if the links are active first. The problem is my script is slower than evolution. I'm no bash guru or anything so I figured maybe I would see if there are some optimizations you folks can think of. Here is what I am working with:
#!/bin/bash
while read line
do
#pull page source and grep for domain
curl -s "$line" | grep "example.com"
if [[ $? -eq 0 ]]
then
echo \"$line\",\"link active\" >> csv.csv else
echo \"$line\",\"REMOVED\" >> csv.csv
fi
done < <(cat links.txt)
Can you guys think of another way of doing this that might be quicker? I realize the bottleneck is curl (as well as the speed of the remote server/dns servers) and that there isn't really a way around that. Is there another tool or technique I could use within my script to speed up this process?
I will still have to go through the active links one by one and analyze by hand but I don't think there is a good way of doing this programmatically that wouldn't consume more time than doing it by hand (if it's even possible).
Thanks
I know it's been awhile but I've found myself in need of this yet again. I've modified Xyne's script a little to work a little more consistently with my data. The problem I'm running into now is that urllib doesn't accept IRIs. No surprise there I suppose as it's urllib and not irilib. Does anyone know of any libraries that will convert an IRI to a URI? Here is the code I am working with:
#!/usr/bin/env python3
from threading import Thread
from queue import Queue
from urllib.request import Request, urlopen
from urllib.error import URLError
import csv
import sys
import argparse
parser = argparse.ArgumentParser(description='Check list of URLs for existence of link in html')
parser.add_argument('-d','--domain', help='The domain you would like to search for a link to', required=True)
parser.add_argument('-i','--input', help='Text file with list of URLs to check', required=True)
parser.add_argument('-o','--output', help='Named of csv to output results to', required=True)
parser.add_argument('-v','--verbose', help='Display URLs and statuses in the terminal', required=False, action='store_true')
ARGS = vars(parser.parse_args())
INFILE = ARGS['input']
OUTFILE = ARGS['output']
DOMAIN = ARGS['domain']
REMOVED = 'REMOVED'
EXISTS = 'EXISTS'
NUMBER_OF_WORKERS = 50
#Workers
def worker(input_queue, output_queue):
while True:
url = input_queue.get()
if url is None:
input_queue.task_done()
input_queue.put(None)
break
request = Request(url)
try:
response = urlopen(request)
html = str(response.read())
if DOMAIN in html:
status = EXISTS
else:
status = REMOVED
except URLError:
status = REMOVED
output_queue.put((url, status))
input_queue.task_done()
#Queues
input_queue = Queue()
output_queue = Queue()
#Create threads
for i in range(NUMBER_OF_WORKERS):
t = Thread(target=worker, args=(input_queue, output_queue))
t.daemon = True
t.start()
#Populate input queue
number_of_urls = 0
with open(INFILE, 'r') as f:
for line in f:
input_queue.put(line.strip())
number_of_urls += 1
input_queue.put(None)
#Write URL and Status to csv file
with open(OUTFILE, 'a') as f:
c = csv.writer(f, delimiter=',', quotechar='"')
for i in range(number_of_urls):
url, status = output_queue.get()
if ARGS['verbose']:
print('{}\n {}'.format(url, status))
c.writerow((url, status))
output_queue.task_done()
input_queue.get()
input_queue.task_done()
input_queue.join()
output_queue.join()
The problem seems to be when I use urlopen
response = urlopen(request)
with a URL like http://www.rafo.co.il/בר-פאלי-p1
urlopen fails with an error like this:
Exception in thread Thread-19:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/threading.py", line 639, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/threading.py", line 596, in run
self._target(*self._args, **self._kwargs)
File "./linkcheck.py", line 35, in worker
response = urlopen(request)
File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 160, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 473, in open
response = self._open(req, data)
File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 491, in _open
'_open', req)
File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 451, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 1272, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 1252, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/client.py", line 1049, in request
self._send_request(method, url, body, headers)
File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/client.py", line 1077, in _send_request
self.putrequest(method, url, **skips)
File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/client.py", line 941, in putrequest
self._output(request.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 5-8: ordinal not in range(128)
I'm not too familiar with how character encoding works so I'm not sure where to start. What would be a quick and dirty way (if one exists) to get URLs like this to play nicely with python's urlopen?
Similar Messages
-
Script for 'Check Links Before Opening Document' preference
I'm trying to find the VB script for changing the "Check Links Before Opening Document" checkbox on the File Handling panel in the Preferences dialog? I haven't found any documentation referring to the Links items on that panel.
BobThanks for the info.
Was there a document you pulled this from?
I have an old document from CS2 days that is invaluable for providing a detailed list of available script methods and properties. Obviously things that have been added in subsequent InDesign releases aren't in this document. Later InDesign CS releases offer script SDKs that contain helpful sample scripts but I don't find a detailed summary similar to one from CS2. Have I just not found them? Or how does one find the script method/property for things not contained in the sample scripts? -
Unix script for checking the user account status
Hi All,
i have created one unix script to check the status of the user in diff databases.
#!/bin/ksh
useracctreport.txt if [ ! -f hh ];
then
echo "Database file does not exist"
fi
echo "Enter Username"
read USER
echo "Enter the password"
stty -echo
read PASS
stty echo
for j in `cat users`
do
j="`echo $j| tr '[a-z]' '[A-Z]'`"
for i in `cat hh`
do
sqlplus -s $USER/$PASS\@$i <<EOF >> useracctreport.txt
column USERNAME format a8
column ACCOUNT_STATUS format a5
!echo "*****User $j Status in $i DB*****"
select USERNAME,ACCOUNT_STATUS from dba_users where username=('$j');
select OBJECT_TYPE,count(*) from dba_objects where owner='$j' group by object_type;
EOF
done
done
In log file ,i get the below error when its unable to connect to the DB.
SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
where <logon> ::= <username>[<password>][@<connect_string>] | /
SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
where <logon> ::= <username>[<password>][@<connect_string>] | /
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
ERROR:
ORA-01017: invalid username/password; logon denied
Is there any way i can supress this error?
and is there any other way i can make this script faster.Thanks a lot for your helpHi,
The failing line is
sqlplus -s $USER/$PASS\@$i <<EOF >> useracctreport.txtYou should test the connect statement you provide to sqlplus. For example:
CONSTRING=$USER/$PASS\@$i
echo Connect string used: $CONSTRING
sqlplus -s $CONSTRING <<EOF >> useracctreport.txtCheck the echoed value. It's malformed. Correct it appropriately.
Yoann. -
I'm trying to write a script to check the status of a package on aur; ie, to see if its been updated since I've installed it.
Here's what I have so far:
#!/bin/sh
PACK=$1 #package name
PACKID=$2 #package ID on AUR
#grab last updated of package on AUR
LUPD=`elinks -source http://aur.archlinux.org/packages.php?ID=$PACKID | grep "Last Updated" | awk -F : '{print $2}'`
LAST=`grep -c $PACK /var/log/pacman.log` #number of instances of package
INST=`grep $PACK /var/log/pacman.log | sed -n ${LAST}p` #get last instance
echo -e "Package: $PACK \n $INST \n Last Update: $LUPD"
This basically works fine for manually inputting a package name and AUR ID (though it needs to be prettied up):
[mike@esme abs]$ aurcheck rxvt-unicode-256color 13060
Package: rxvt-unicode-256color
[2008-04-18 20:01] installed rxvt-unicode-256color (9.02-1)
Last Update: Sun, 04 May 2008 14
but what I envision is having a two column file with the first column the package name and the second the ID but I can't figure out how to make this loop around for each line of such a file. If anyone can provide some help/pointers I'd greatly appreciate it.
PS Perhaps yaourt can do this for you, but I don't use yaourt and would like to learn how to do this even just to improve my scripting abilities
Thanks!Daenyth wrote:Oh wow, I had no idea such a thing existed... Very cool!
Expanding on my suggestion, here's the bash/js-script I use to find packages in AUR:
wget="/usr/bin/wget -q -O-"
aurrepo="http://aur.archlinux.org/rpc.php?type=search&arg="
js="/usr/bin/js"
aur() {
local iam="${FUNCNAME[0]}:"
local cmd="${1}"
local what="${2}"
local aurresult=""
[[ -z "${cmd}" ]] && {
echo "${iam}: use ${iam} (cmd) searchstring"
return 1
aurresult="$(${wget} ${aurrepo}${what})"
${js} -e "
var out = ${aurresult};
var res = out.results;
var i, j, len;
var tabs = ' ';
var tabstop1 = 13;
var oneline1 = {
'ID':true, 'CategoryID':true, 'NumVotes':true,
'OutOfDate':true, 'License':true
var oneline2 = {'Name':true, 'Version':true};
var line1='', line2='';
var others = {};
function tabto(string) {
return tabs.substring(1, tabstop1 - string.length);
if (out.type === 'error') {
print(res);
quit(1);
for (i in res) {
others = {};
line1 = '';
line2 = '';
for (j in res[i]) {
if ((typeof oneline1[j] !== 'undefined')
&& (typeof res[i][j] === 'string')) {
if (line1.length > 0) line1 = line1 + '; ';
line1 = line1 + j + ': ' + res[i][j];
} else if ((typeof oneline2[j] !== 'undefined')
&& (typeof res[i][j] === 'string')) {
if (line2.length > 0) line2 = line2 + '; ';
line2 = line2 + j + ': ' + res[i][j];
} else {
others[j] = res[i][j];
print(line2);
print(line1);
for (k in others) {
print(k + ':' + tabto(others[k]) + others[k]);
print('---');
quit(0);
return $?
Note that js(1), which has no man-page or other documentation, is part of "spidermonkey", which in turn is part of "firefox". It makes sense to assume that people have this browser installed. If at all possible, the javascript shell should have the file-methods compiled in to be able to use it like many other scripting languages, especially with JSON code. The scriptlet above works with an unmodified standard install. -
Need a bat script to check Server status remotly.
Hi,
I need bat script to check server status remotly (Ping) for multiple servers. It should generate a txt file for result.
Thanks.Hi Ravi,
To ping multiple computers and generate report cia cmd, please refer to the script below, the "fnm" is computer name list and the "lnm" is the result, and you can save the script below as .bat file:
@echo off
set fnm=d:\test1\computers.txt
set lnm=d:\test1\ping.txt
if exist %fnm% goto Label1
echo.
echo Cannot find %fnm%
echo.
Pause
goto :eof
:Label1
echo PingTest STARTED on %date% at %time% > %lnm%
echo ================================================= >> %lnm%
echo.
for /f %%i in (%fnm%) do call :Sub %%i
echo.
echo ================================================= >> %lnm%
echo PingTest ENDED on %date% at %time% >> %lnm%
echo ... now exiting
goto :eof
:Sub
echo Testing %1
set state=alive
ping -n 1 %1
if errorlevel 1 set state=dead
echo %1 is %state% >> %lnm%
Refer to:
Explain the Batch script to ping multiple computers
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected] -
What is the tracking ID for checking the status of a sent text message??
i don't know what the tracking ID is for checking the status of a sent text message...
You didn't need to post here and start a new thread; you could have just done a search, i.e.,
https://community.verizonwireless.com/thread/455106 -
[solved]Need help with a bash script for MOC conky artwork.
I need some help with a bash script for displaying artwork from MOC.
Music folders have a file called 'front.jpg' in them, so I need to pull the current directory from MOCP and then display the 'front.jpg' file in conky.
mocp -Q %file
gives me the current file playing, but I need the directory (perhaps some way to use only everything after the last '/'?)
A point in the right direction would be appreciated.
thanks, d
Last edited by dgz (2013-08-29 21:24:28)Xyne wrote:
You should also quote the variables and output in double quotes to make the code robust, e.g.
filename="$(mocp -Q %file)"
dirname="${filename%/*}"
cp "$dirname"/front.jpg ~/backup/art.jpg
Without the quotes, whitespace will break the code. Even if you don't expect whitespace in any of the paths, it's still good coding practice to include the quotes imo.
thanks for the tip.
here it is, anyhow:
#!/bin/bash
filename=$(mocp -Q %file)
dirname=${filename%/*}
cp ${dirname}/front.jpg ~/backup/art.jpg
then in conky:
$alignr${execi 30 ~/bin/artc}${image ~/backup/art.jpg -s 100x100 -p -3,60}
thanks for the help.
Last edited by dgz (2013-08-29 21:26:32) -
Power Shell Script for Check Remote machinces are live or not
I have required a Power Shell Script for Check multiple Remote machines are live or not.Please guide me
This will do it.
http://gallery.technet.microsoft.com/Ping-IP-Adress-Range-d90ce82d
¯\_(ツ)_/¯ -
Script for Checking the Server Status
Hi All,
I just need the script for monitoring the server status through the WLST.My scenario:I have 2 server in Running State.If any one of the server get failed or in not RUNNING state then i use the script for starting that server automatically.I tried some of the script but it is not working properly .If any one have the sample script please share with me.
Regards,
Ove.Hi Syed,
Replication state is very easy to see in 4.x and earlier. The last changenumber in the supplier changelog is visible (on the root DSE IIRC), and each consumer suffix has an operational attribute "copiedfrom" that tells you the name of the supplier, the database generation id, and the last change replayed from the supplier.
So a script that compares the results of
ldapsearch -h <supplier> -s base -b "" "objectclass=*" lastchangenumber
and
ldapsearch -h <consumer> -s base -b <base_suffix> "objectclass=*" copiedFrom
will show you if a replica has fallen out of sync. It won't tell you more than how many changes behind the replica is, though, because pre-5.x changenumbers are sequential integers, not timestamps.
However, the change that corresponds to the changenumber is clearly visible under the "cn=changelog" suffix. So if you look at the change itself you can see the timestamp on it.
For more info on the status of replication, you should be able to query the agreements on the supplier. Those live under the "Netscape Machine Data Suffix", which you can also find on the supplier's root DSE:
ldapsearch -h <supplier> -s base -b "" "objectclass=*" netscapemdsuffix
And of course the error logs will usually tell you if replication is failing outright.
I may be off on some of the attribute names, but if you do some investigating along these lines, you should be able to figure it out. -
Udev bash script for autodialing usb huawei modem
Hey
I've got an interesting one here.
I have scripted up a bash script to be triggered by a udev add event for my usb modem. As far as I can tell the udev event is firing correctly according to udevadm.
ACTION=="add", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", RUN+="/bin/sh /usr/local/bin/huawei_key.sh add"
ACTION=="remove", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", RUN+="/bin/sh /usr/local/bin/huawei_key.sh remove"
And heres the code from the script
#!/bin/bash
#returns
# 0 Successfully ran script for case
# 1 wvdial process already running
# 2 wvdial was not terminated
# 3 script was not ran with ADD or REMOVE events
function getpid #get process id of running program
pidof wvdial
if [ "$?" = 0 ];
then
pid=`pidof wvdial`
running=1
else
running=0
fi
function checkrun #check for a running copy of the program
pidof wvdial
if [ "$?" == "0" ];
then
running=1
else
running=0
fi
function killloop #a set of time kill commands to let the program exit gracefully
#two terms, one int and one kill with suitable gaps
getpid
checkrun
if [ "$running" = "0" ];
then
return
fi
kill $pid
sleep 10
checkrun
if [ "$running" = "0" ];
then
return
fi
kill $pid
sleep 10
checkrun
if [ "$running" = "0" ];
then
return
fi
kill -INT $pid
sleep 5
checkrun
if [ "$running" = "0" ];
then
return
fi
kill -KILL $pid
sleep 5
checkrun
if [ "$running" = "1" ];
then
exit 2 #process fails to die
fi
function getlaststatus
if [ -e "/var/run/huawie" ];
then
last=`cat /var/run/huawie`
else
last=0
fi
if [ "$1" = "add" ];
then
getlaststatus
if [ "$last" = "1" ];
then
exit 1
fi
echo 1 > /var/run/huawie #block future udev events
getpid
if [ "$running" = "1" ];
then
exit 1
fi
modprobe usbserial
sleep 6 #modem init time
wvdial &
exit 0
elif [ "$1" = "remove" ];
then
getlaststatus
if [ "$last" = "2" ];
then
exit 0
fi
echo 2 > /var/run/huawie
killloop
exit 0
else
echo 3 > /var/run/huawie
exit 3
fi
I'd appreciate any ideas, this one has me stumped
Edit:
Forgot to add that when I call the script manually it works like a charm.
Last edited by adamd (2009-08-25 15:04:06)Hey
I've got an interesting one here.
I have scripted up a bash script to be triggered by a udev add event for my usb modem. As far as I can tell the udev event is firing correctly according to udevadm.
ACTION=="add", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", RUN+="/bin/sh /usr/local/bin/huawei_key.sh add"
ACTION=="remove", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", RUN+="/bin/sh /usr/local/bin/huawei_key.sh remove"
And heres the code from the script
#!/bin/bash
#returns
# 0 Successfully ran script for case
# 1 wvdial process already running
# 2 wvdial was not terminated
# 3 script was not ran with ADD or REMOVE events
function getpid #get process id of running program
pidof wvdial
if [ "$?" = 0 ];
then
pid=`pidof wvdial`
running=1
else
running=0
fi
function checkrun #check for a running copy of the program
pidof wvdial
if [ "$?" == "0" ];
then
running=1
else
running=0
fi
function killloop #a set of time kill commands to let the program exit gracefully
#two terms, one int and one kill with suitable gaps
getpid
checkrun
if [ "$running" = "0" ];
then
return
fi
kill $pid
sleep 10
checkrun
if [ "$running" = "0" ];
then
return
fi
kill $pid
sleep 10
checkrun
if [ "$running" = "0" ];
then
return
fi
kill -INT $pid
sleep 5
checkrun
if [ "$running" = "0" ];
then
return
fi
kill -KILL $pid
sleep 5
checkrun
if [ "$running" = "1" ];
then
exit 2 #process fails to die
fi
function getlaststatus
if [ -e "/var/run/huawie" ];
then
last=`cat /var/run/huawie`
else
last=0
fi
if [ "$1" = "add" ];
then
getlaststatus
if [ "$last" = "1" ];
then
exit 1
fi
echo 1 > /var/run/huawie #block future udev events
getpid
if [ "$running" = "1" ];
then
exit 1
fi
modprobe usbserial
sleep 6 #modem init time
wvdial &
exit 0
elif [ "$1" = "remove" ];
then
getlaststatus
if [ "$last" = "2" ];
then
exit 0
fi
echo 2 > /var/run/huawie
killloop
exit 0
else
echo 3 > /var/run/huawie
exit 3
fi
I'd appreciate any ideas, this one has me stumped
Edit:
Forgot to add that when I call the script manually it works like a charm.
Last edited by adamd (2009-08-25 15:04:06) -
ECMA script for checking active workflows for an list item
Hi i am having more than 1 workflow associated with the list if there is any workflow that is active for an item then i need to prevent starting another workflow for the same item. I am using the following code to achieve the same. Can anyone please provide
me the ECMA object model equivalent for achieving the same.
//Check for any active workflows for the document
private void CheckForActiveWorkflows()
// Parameters 'List' and 'ID' will be null for site workflows.
if (!String.IsNullOrEmpty(Request.Params["List"]) && !String.IsNullOrEmpty(Request.Params["ID"]))
this.workflowList = this.Web.Lists[new Guid(Request.Params["List"])];
this.workflowListItem = this.workflowList.GetItemById(Convert.ToInt32(Request.Params["ID"]));
SPWorkflowManager manager = this.Site.WorkflowManager;
SPWorkflowCollection workflowCollection = manager.GetItemActiveWorkflows(this.workflowListItem);
if (workflowCollection.Count > 0)
SPUtility.TransferToErrorPage("An workflow is already running for the document. Kindly complete it before starting a new workflow");
}Hi,
According to your post, my understanding is that you wanted to use ECMA script to check active workflows for an list item.
You can use the Workflow web service "/_vti_bin/workflow.asmx"
- GetWorkflowDataForItem operation in particular.
Here is a great blog for you to take a look at:
http://jamestsai.net/Blog/post/Using-JavaScript-to-check-SharePoint-list-item-workflow-status-via-Web-Service.aspx
In addition, you can use
SPServices. For more information, please refer to:
http://sharepoint.stackexchange.com/questions/72962/is-there-a-way-to-check-if-a-workflow-is-completed-using-javascript
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
Script for checking the replication process in Netscape Directory Sever 4.1
Hi,
We are using Netscape Directory Server 4.1.6 in our production environment. Where we want to know is there any script available to check the replication process. Or can we write a script to check the process.
Waiting for your replies at the earliest.
Thanks,
Syed A.Hi Syed,
Replication state is very easy to see in 4.x and earlier. The last changenumber in the supplier changelog is visible (on the root DSE IIRC), and each consumer suffix has an operational attribute "copiedfrom" that tells you the name of the supplier, the database generation id, and the last change replayed from the supplier.
So a script that compares the results of
ldapsearch -h <supplier> -s base -b "" "objectclass=*" lastchangenumber
and
ldapsearch -h <consumer> -s base -b <base_suffix> "objectclass=*" copiedFrom
will show you if a replica has fallen out of sync. It won't tell you more than how many changes behind the replica is, though, because pre-5.x changenumbers are sequential integers, not timestamps.
However, the change that corresponds to the changenumber is clearly visible under the "cn=changelog" suffix. So if you look at the change itself you can see the timestamp on it.
For more info on the status of replication, you should be able to query the agreements on the supplier. Those live under the "Netscape Machine Data Suffix", which you can also find on the supplier's root DSE:
ldapsearch -h <supplier> -s base -b "" "objectclass=*" netscapemdsuffix
And of course the error logs will usually tell you if replication is failing outright.
I may be off on some of the attribute names, but if you do some investigating along these lines, you should be able to figure it out. -
Kindly let me know the transaction for checking the Status of par.User?
Kindly let me know the transaction for checking the Particular Users Status?
I mean to say,Which Transaction is he into?
Or Is he/She Logged on to a particular System?
Regards,
Shashank.Hi,
Go to Transaction SM04.You will find the List of Users And the List of transactions ther are currently using.
Regards,
Sujit -
Hi,
I have a text file in which some SamAccountNames are present.I need to check the file while creating a new users through ADUC console.If a username that is going to create through ADUC console is present in the file, then it should prompt a message
that the user is already present in the text file.
Is there any possibility of contacting the powershell script from the ADUC console.If so, then while creating a new user through ADUC console, what is the proceedure for executing that powershell script.
please provide me the approriate solutions.
Thanks
Prasanthi kRun the below Powershell Script for users are exist or not in AD. Later you can create the users.
#Find Users exist in AD or Not?
#Biswajit Biswas
$users = get-content c:\users.txt
foreach ($user in $users) {
$User = Get-ADUser -Filter {(samaccountname -eq $user)}
If ($user -eq $Null) {"User does not exist in AD ($user)" }
Else {"User found in AD ($user)"}
Active Directory Users attributes-Powershell
http://gallery.technet.microsoft.com/scriptcenter/Getting-Users-ALL-7417b71d
Regards~Biswajit
Disclaimer: This posting is provided & with no warranties or guarantees and confers no rights.
MCP 2003,MCSA 2003, MCSA:M 2003, CCNA, MCTS, Enterprise Admin
MY BLOG
Domain Controllers inventory-Quest Powershell
Generate Report for Bulk Servers-LastBootUpTime,SerialNumber,InstallDate
Generate a Report for installed Hotfix for Bulk Servers -
CSS Script for checking RADIUS Service
Hi,
We are using CSS 11501 boxes for load-sharing RADIUS (NAC) requests between different ACS Servers.
How can I configure a keepalive method for checking the RADIUS service on the ACS Servers ?
If this needs to be a script then Can anyone provide some hints\tips ?
Thanks,
NamanThis needs to be a script.
The best way would be to sniff a request/response from a known user [or fake user], then extract the udp header + payload in hex format, then create a CSS script to send the hex formatted query and to verify that the hex formatted response matches the server response.
I believe the ap-kal-dns script uses a similar approach so you can look at it to get an idea of what you have to do.
Gilles.
Maybe you are looking for
-
Re: Connecting though internet when client Macs are on office network
I have a small company with two iMacs at work which are on a network with several other PC's. I have a home office with a Power Mac G5 (not intel based) and a satellite office 1500 miles away in PHX with a MacBook (brand new). I am trying to be able
-
I need a little help i am having trouble removing ALL the white space from my string using a tokenizer here is my code so far: String str = "klj f a sklj fdaskldf" String deLimiters = " "; StringTokenizer tokens = new StringTokenizer(str,
-
Lightroom 5 crashes my Windows 8 machine
Hi, I have installed Lightroom 5 Beta on my new Windows 8 PC a few weeks ago and have a serious problem with it - ocassionally (From a few minutes to an hour), while I am working on Lightroom, I get a blue screen saying something about a problem with
-
Discuss settings of c5 browser
when you go to default browser of this phone (nokia c5-00 3.2 mega pixel version) i.e. Options>>Settings>>Page [url=http://www.freeimagehosting.net/osaad][img]http://www.freeimagehosting.net/t/osaad.jpg[/img][/url] http://www.freeimagehosting.net/os
-
ODT 10.2.0.2.10 beta - Package Load Failure VS2005.
Attempts to use Oracle Explorer from VS 2005 resulted in the following error; tried to restart VS2005 but errors continued to occur.: The Oracle Developer Tools for Visual Studio .NET ({D601BB95-E404-4A8E-9F24-5C1A462426CE}) did not load because of p