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
¯\_(ツ)_/¯
Similar Messages
-
Power shell script for get a content db for a particular web application
Hi
what is the power shell script for get a content db for a particular web application
Get-SPDatabase
adiltry this one
Get-SPContentDatabase -webapplication http://url
this will return all the database for the web applications.
Get-SPContentDatabase -site http://contoso.com
this will return the database name in which the contose site collection is.
Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog -
Hi,
I am trying to launch Amazon EC2 windows server 2008 R2 instance using AWS Auto Scaling feature. I have used cusmized AMI in Autoscaling Launch configuration to launch an instance.I have placed Power Shell script in AMI.
The responsibility of script is to download code from AWS S3 and deploy in IIS server while windows startup first time.
When i check status, IIS is started succesfully. But default Application pool is not started.
To resolve this issue i have written one scheduled script. It helps to start the application pool if any application pool is in stopped state.
After this Application pool is started but i am not able to communicate with IIS server through browser.
Please help any one to resolve this issue.
Thanks in advanceHi Vchreddy,
For the IIS issue, we recommend you can post in IIS forum for more effective support:
http://forums.iis.net/
Thanks for your understanding. -
Power Shell Script for getting the list of members of a particular collection group
Hi Group
I am looking for a powershell script for the below manual process in sccm2012. please help
Obtain the list of “All Users Group1” collection that have been defined as a Primary User of a device, and what that Users ShortName and Device name is
Obtain the list of user from Active Directory that have their “Title” attribute equal to “Non-Employee” (samAccountName)
For each user that is returned from AD, determine if they are assigned as a Primary User of a Device and write the Device name to a file
Continue to append all of the applicable Device names to the file
End Result = List of all Devices that have Users that have their AD Attribute “Title” equal to “Non-Employee”
thanks
VARHi,
The Cmdlets below should be helpful for you to write the script. You could have a look.
Get-CMUser
Get-CMUserDeviceAffinity
Get-ADUser
Best Regards,
Joyce Li
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Power shell script for AD User
Hi Team,
can any one help me to find out this in ad through power cell script.
List of users who's password has been reset in 90 days.
Regards, TriyambakTry amending the following script from the repository.http://gallery.technet.microsoft.com/scriptcenter/Query-for-AD-Users-that-b87acf2f
-
Power Shell Script to Initiate Billing Determinants Calculations
Hi All,
I'm New to CC&B, i have a problem when i try to initiate the BD Calc thru Power shell script for "ALL" Accounts, at the same time i'm able to succeed for single account. Did any one faced this problem ?
Any advise?
btw, i use Win2008R2 server (x64) | MDM 1.6.1.2 | PShell v1.0
- Nandawbadmin start systemstatebackup -backupTarget:$backdir -[quiet]"[quiet]"? I guess you should remove the bracketswbadmin start systemstatebackup -backupTarget:$backdir -quiet
-
Trying to run Power shell Script on task schedule
My case is i'm trying to run a power shell script through the task schedule.
Note if i run the script locally it is working fine but from the task schedule it is not working.
More information:
script function: Password Change Notification
Task name : test3
Time to do the task: 9:08 am every day
the status : running
.ps1 file location: under C\windows\system32\
some actions in the task history after the dated time to run:
1 Task Scheduler launched "{3023b1eb-9b29-47b9-ace2-e6083e2f00cc}" instance of task "\test3" due to a time trigger condition
2 Task Engine "S-1-5-21-60622444-1628707926-2526327935-500: enviroment\Admin:S4U:LUA" received a message from Task Scheduler service requesting to launch task "\test3" .
3 Task Scheduler started "{3023b1eb-9b29-47b9-ace2-e6083e2f00cc}" instance of the "\test3" task for user "enviroment\admin
4 Task Scheduler launched action ""C:\Windows\System32\Password Change Notification\Password Change Notification.ps1"" in instance "{3023b1eb-9b29-47b9-ace2-e6083e2f00cc}" of task "\test3
5 Task Scheduler launch task "\test3" , instance "C:\Windows\System32\notepad.exe" with process ID 5052Hi MeipoXu,
First of all i would like to thank you for your answer, i followed the URL that you posted already in the previous comment and unfortunately it didn't work, and please find my ps1 file
content as typed below and give me your feedback on that.
# # Version 1.1 May 2014
# Robert Pearman (WSSMB MVP) # TitleRequired.com
# Script to Automated Email Reminders when Users Passwords due to Expire.
# # Requires: Windows PowerShell Module for Active Directory
# # For assistance and ideas, visit the TechNet Gallery Q&A Page. http://gallery.technet.microsoft.com/Password-Expiry-Email-177c3e27/view/Discussions#content
# Please Configure the following variables....
$smtpServer="outlook. myDomain " $expireindays = 7
$from = "الدعم الفني
<ITHelpDesk@myDomain>"
$logging = "Enabled" # Set to Disabled to Disable Logging
$logFile = "PassExpireNotlog.csv" # ie. c:\mylog.csv
$testing = "Enabled" ## "Enabled" # Set to Disabled to Email Users
$testRecipient = "MyEmail@MyDomain"
$encoding = [System.Text.Encoding]::Unicode $date = Get-Date -format ddMMyyyy
# Check Logging Settings if (($logging) -eq "Enabled")
{ # Test Log File Path
$logfilePath = (Test-Path $logFile) if (($logFilePath) -ne "True")
{ # Create CSV File and Headers
New-Item $logfile -ItemType File
Add-Content $logfile "Date,Name,EmailAddress,DaystoExpire,ExpiresOn,MsgBody"
} } # End Logging Check
# Get Users From AD who are Enabled, Passwords Expire and are Not Currently Expired
Import-Module ActiveDirectory $users = get-aduser -filter * -SearchScope Subtree -SearchBase "OU=UsersOU,DC=MyDomain,DC=MyrootDomain,DC=MYrootNS" -properties Name, PasswordNeverExpires, PasswordExpired, PasswordLastSet,
EmailAddress |where {$_.Enabled -eq "True"} | where { $_.PasswordNeverExpires -eq $false } | where { $_.passwordexpired -eq $false }
$maxPasswordAge = (Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge
# Process Each User for Password Expiry foreach ($user in $users)
{ $Name = (Get-ADUser $user | foreach { $_.Name})
$emailaddress = $user.emailaddress
$passwordSetDate = (get-aduser $user -properties * | foreach { $_.PasswordLastSet })
$PasswordPol = (Get-AduserResultantPasswordPolicy $user)
# Check for Fine Grained Password
if (($PasswordPol) -ne $null) {
$maxPasswordAge = ($PasswordPol).MaxPasswordAge
$expireson = $passwordsetdate + $maxPasswordAge
$today = (get-date) $daystoexpire = (New-TimeSpan -Start $today -End $Expireson).Days
# Set Greeting based on Number of Days to Expiry.
# Check Number of Days to Expiry
$messageDays = $daystoexpire if (($messageDays) -ge "2")
{ $messageDays = "خلال
" + "$daystoexpire" + " ايام"
} elseif (($messageDays) -eq "2")
{ $messageDays = "خلال يومين
} else
{ $messageDays = "اليوم."
} # Email Subject Set Here
$subject="كلمة المرور الخاصة بك ستنتهي
$messageDays"
# Email Body Set Here, Note You can use HTML, including Images.
$body = "<P style='font-family: Arial; font-size: 16pt' />
<center> الاستاذ/ $name
</center>
<br> <center>
كلمة المرور الخاصة بك ستنتهي $messageDays </center>
<br> <center>
نأمل تغييرها في أقرب فرصة حتي تتمكن من الدخول على النظام
</center>
<br> <center>
مع تحيات الادارة العامة لتقنية المعلومات
</center>
<br> </P>"
# If Testing Is Enabled - Email Administrator
if (($testing) -eq "Enabled")
{ $emailaddress = $testRecipient
} # End Testing # If a user has no email address listed
if (($emailaddress) -eq $null)
{ $emailaddress = $testRecipient
}# End No Valid Email # Send Email Message
if (($daystoexpire -ge "0") -and ($daystoexpire -lt $expireindays))
{ # If Logging is Enabled Log Details
if (($logging) -eq "Enabled")
{ Add-Content $logfile "$date,$Name,$emailaddress,$daystoExpire,$expireson,$body"
} # Send Email Message
Send-Mailmessage -smtpServer $smtpServer -from $from -to $emailaddress -subject $subject -body $body -bodyasHTML -priority High -Encoding $encoding
} # End Send Message
} # End User Processing
# End -
Dear experts,
I have to do the below requirments can you please help me on this,
i have to check the database status on every 2 hour intravel, i need a shell script to check the database status whether up or down, if the status is up i have to call .sql file , if the status is down the mail will be sent to dba team with mailx functionality, can any one plz help me on this? this requirment needs to be used only shell script code. thanks in advance
Os is AIX
db version 11.2.0.2I can think of a few ways this can mislead...
expired password
mail problems (both mail not working, and too much mail on Monday...)
network problems (for example, db can be up and working, but that client can't get there - false negative)
Client dead, or process can't start (false postive - no mail, therefore no problem)
Login storm (so only some new connections rejected, random false negative or false positive)
Listener down or related login problems, device with executables offline, out of horsepower - users still working, but no new logins.
Multiple problems (I've seen more than once, both phone lines and power fail, no notification sent)
Error not discriminatory enough - the email should at least send the error it got.
False positive - only script can get to db, users can't with modern tiered architecture.
client tnsnames.ora not available or corrupted.
Nothing wrong with having a script, you just have to watch the requirements and definitions. More sophisticated solutions have problems too. In the end you have to decide what the operational priorities are. Two hours down might be OK at 4AM but not at 6. You also don't want to stretch the limits of an UPS. -
Intermittent "Power Shell Script failed to run" after installing SQL MP 6.5.4.0
We recently installed the SQL MP. One thing I am struggling with is this "Power Shell Script failed to run" that occasionally comes up, but, not always on the same server, and not always at the same time.
It says it ran past the configured timeout of 300 seconds.
The post that seemed to have me on the right track was
https://social.technet.microsoft.com/Forums/en-US/c539a55d-dd48-438f-b7d5-06ed2cecf6e9/powershell-script-failed-to-run-alerts-from-sql-management-pack-6410?forum=operationsmanagergeneral
However, even after getting one of the several scripts that have been generating the error, out of the extract management pack, it has parameters that need to be fed to it that I have no idea what they are....
Example. ActiveRequestsDataSource.ps1 requires $computername, $connectionstring, $tcpport, $sql_wmi_namespace, and $servicename.
The computername is easy enough... so is tcpport. but, the others... not so much.
I am fairly certain I will be able to run these manually, if I just knew the parameters... I am also fairly certain we are getting these because at the time of the check, resources on that server are tied up for one reason or another.
Can someone please help? This is killing me.Hi,
As this issue happens after you installing SQL MP, so from my point of view, it seems like caused by the runas account for the SQL MP is not configured well, I would like to suggest you follow the article below to configure runas account for the management
pack:
Configuring Run As Accounts and Profiles in OpsMgr – A SQL Management Pack Example
http://blogs.technet.com/b/kevinholman/archive/2010/09/08/configuring-run-as-accounts-and-profiles-in-r2-a-sql-management-pack-example.aspx
Regards,
Yan Li
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 Subscriber Support, contact [email protected] -
HI,
i have written some java code Database backup but there are some problems with that so now i need to write shell script for db backup.
what i was doing in java code i was running command like that
/usr/local/bin/tar cvzf /export/home/monitor/FILE_20091005.tar.gz FILES/*20091005.*which compress the all *20091005* files (myisam table files)
but after compression file doesn't extract
so i have to write shell script for that ..... can any body guide me how can i write that kind of script and put it in cron job.
thankssoundar wrote:
Hi all,
I have migrated database from 8i to 10gr2.For Backup in 8i, we used a RMAN shell script (scheduled uding cron tab) to backup the database to Tape.(VERITAS BACKUP).
I am new to 10G.I checked out the options to backup the database using Oracle Enterprise manager DB console.
http://www.oracle.com/technology/obe/10gr2_db_single/ha/rman/rman_otn.htm#t1d
I am planning to take a test backup using the steps mentioned inthe above url.Could any one suggest whcih is the best option for database backup,eiether to use Oracle Enterprise manager DB console or thru RMAN shell script for backup..?
Edited by: soundar on Mar 9, 2010 10:53 PMDear soudar
I woudn't suggest you to work with EM if you want to be a professional DBA. Start learning RMAN and use CLI instead of GUI
Those who live by the GUI, die by the GUI -
Trying to run program off network location using GPO with Power shell script.
Hello All,
Not much of a script writer. I am giving it a shot. My issue is that I need to run a application update across our network and I am trying to do it with as little hands on as possible. So I was planning to push a GPO with a power shell script in it
to run the program with elevated privileges.
Little background:
We are running on a domain and end users do not have admin rights.
The application is stored on a share on our network that is open to all domain users.
The installer user name and password is a temp one and will only be valid for the 30 min window when everyone logs in at the beginning of the day.
So this is what I have so far.
$username = "USER"
$password = "PASSWORD"
$credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDirectory \\Server\Folder\Folder1\Folder2\filder3\PSQLv11sp3_x32\
But for some reason I keep getting :
Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:10 char:1
+ Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDir ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
Any help you could give would be great.
Thanks,
jdfmonkeyHi jdfmonkey,
Has anyone provided an answer to your original question? I am trying to use Start-Process to launch a process using another logged in user's credentials, and am not able to get it working:
$cred=Get-Credential
start-process Process.exe-WorkingDirectoryC:\Scripts-Credential$cred
I get the same error that you mentioned:
start-process : This command cannot be run due to the error: The system cannot find the file specified.
At C:\Scripts\Process.ps1:2 char:1
+ start-process Process.exe -WorkingDirectory C:\Scripts -Credential ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
When I leave off the credentials:
start-processProcess.exe-WorkingDirectoryC:\Scripts
It works correctly. Does anyone have a solution to make this work correctly?
Please ask your own question. You issue is nothing like the current thread. You clearly are using a user account that has no access to the folder. It is a permissions issue. It is not a scripting issue.
If you need further help please start your own question.
¯\_(ツ)_/¯ -
I need AD Health status via Power Shell script
Dear All,
I need AD Health power shell script and it has to be sent via email as report on daily basis
Can anyone help on this?
Thanks,
PushparajI found below script which can be used, but i would request run these scirpts in test environment before executing in production.
http://fearthemonkey.co.uk/using-powershell-to-perform-dc-health-checks/
http://www.wolffhaven45.com/blog/powershell/automate-some-active-directory-health-checks-via-powershell/
You can also search for scripts in below repository.
http://gallery.technet.microsoft.com/
Also, for scripting related request, its better to post the thread in dedicated scripting/powershell forum.
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
Awinish Vishwakarma - MVP
My Blog: awinish.wordpress.com
Disclaimer This posting is provided AS-IS with no warranties/guarantees and confers no rights. -
Web Service to call Power Shell Script
Hello All,
How can we make a call to power shell script from a asp.net web service with parameter ?
Thanks in AdvanceNormally you can do everything using web service, why do you want to call powershell
May be you can plan
http://geekswithblogs.net/Norgean/archive/2012/09/19/running-powershell-from-within-sharepoint.aspx
Plan to use workflow for same
http://ilovesharepoint.codeplex.com/wikipage?title=Execute%20PowerShell%20Script%20Action
Also check
http://forums.iis.net/t/1161083.aspx?running+PS+scripts+from+a+webpage+sharepoint+site
If this helped you resolve your issue, please mark it Answered -
Shell scripting for sftp command
Guy's
you may wondering how i can ask these question in this forum,actually it's related to abap,we have create
unix script that will upload file from remote sftp server
and put it into AL11 transcation (take any location from
your point of view),but instead of using shell script
that is having ftp the want to go for sftp,for your undersatnding following thing's i am working with
<b>Tcode</b>:sm69,sm49
<b>function module</b>:SXPG_COMMAND_EXECUTE
script that need to have sftp instead of ftp
Connecting to ftp server to get the file on the current server
SOURCE_FILE_NAME=TSPAR_`date +%Y%m%d`.txt
TARGET_FILE_NAME=TSPAR_`date +%Y%m%d`.txt
cd /interf/torrance/TCW/FI
ftp -nv << EOF
open 10.252.8.73
user sanju sanju
cd /home/sanju
get $SOURCE_FILE_NAME
EOF
cp SOURCE_FILE_NAME TARGET_FILE_NAME
rm SOURCE_FILE_NAME
<b>note:</b>above script is working ,but we want' sftp not ftp
don't try above script as such,because value's are
changed for sake of securityTry to execute same command using your OS .
ksh + x ( is for debugging ) shell script and see where its failing . I also did the same thing in last project as i have written 5 different shell scripts , for backup , append file , sending file to FTP location and then create email ...
Hope thisll help you
Thanks -
Need shell Script for Invalid object
Hi All,
Can anyone post me a script for checking the invalid objects in 10g/11g database.
The should should check for invalid objects,recompile and sent the email .I could think fo something like below(And applicable to multiple SID's running on the server) and i tested it it works(bash shell script)
Assumptions:
You have environmental file to set ORACLE_HOME ORACLE_SID
say in this example
/oracle/env
ls -ltr
env_ORCL.sh
env_TEST.sh
env_HR.sh
You also have uuencode rpm installed to use along with mailx command(or else get it installed not big deal). uuencode is required
to send as mail attachment
1)I have kept SID list in file (/oracle/INVALID directory for eg)
cat SID.lst
ORCL
TEST
HR
If you have lot of SID's you can populate the file using ( ps -ef|grep -i pmon | grep -v grep | awk '{print$9}' | sed 's/ora_pmon_//g' > SID.lst)
2) Here are the list of SQL's(/oracle/INVALID directory
cat invalid_pre.sql (For listing invalid objects per instance)
set echo off
set heading off
set time off
set timing off
spool invalid.log append
break on instance_name
select instance_name , a.*
from (select owner,count(*) from dba_objects where status='INVALID' group by owner) a, v$instance;
spool off
exit;
cat invalid_compile.sql--to recompile invalid objects
set echo off
set termout off
set feedback off
@?/rdbms/admin/utlrp.sql 4; (Note you change degree 4 or 8 accordingly)
exit;
cat invalid_post.sql--to list post recompilation
set echo off
set heading off
set time off
set timing off
spool invalid_post.log append
break on instance_name
select instance_name , a.*
from (select owner,count(*) from dba_objects where status='INVALID' group by owner) a, v$instance;
spool off
exit;
3)here is the shell script
cat invalid.sh
for i in `cat SID11g.lst`
do
cd /oracle/env/
source env_$i.sh
cd /oracle/INVALID
sqlplus "/as sysdba" @invalid_pre.sql
sqlplus "/as sysdba" @invalid_compile.sql
sqlplus "/as sysdba" @invalid_post.sql
done
uuencode invalid.log invalid.log | mailx -s "Invalid" <your mail id>
uuencode invalid_post.log invalid_post.log | mailx -s "Invalid" <your mail id>
4) Finally run the shell script, hopefully you should receive email :-)
I have tested it on bash
./invalid.sh
Once tested you can schedule it in cron
Edited by: vreddy on Jul 19, 2012 9:57 AM
Maybe you are looking for
-
Performance Issues with 10.6.7 and External USB Drives
I've had a few performance issues come up with the latest 10.6.7 that seem to be related to external USB drives. I have a 2TB USB drive tha I have my iMovie content on this drive and after 10.6.7 update, iMovie is almost unusable. Finder even seems s
-
Set as default value the Item Category in the Maintenance Order
Hello everyone, We are trying to find a user exit in order to set as default value the item category in the Maintenance Order once the Material has been introduced (Tag Components). SAP Customizing let the user set the Item Category automatically per
-
Maintaining Constant Sender Address in the Email of Batch Job
Hi, I have created a smartform whcih will be sent via Batch job at a partcular time .And everytime the Sender Id is "BATCH.JOB". Actually the businesswants the sender address to be XYZ.com instead of BATCH.JOB Iam using the below FM to send email. C
-
CL_GUI_ALV_TREE Event CHECKBOX_CHANGE
Dear Experts, i use a tree control using class cl_gui_alv_tree. All fields of my fieldcatalog are specified as fieldcat-checkbox = 'X' and fieldcat-edit = 'X'. i have a global class zcl...... where i implemeted a method as event_handler for class cl_
-
Disable Mobile Link popup in Acrobat DC
Is there a way to disable the "you haven't enabled Mobile Link" popup that appears over the top-right corner of the PDF you're viewing periodically? I've seen it, I've read about Mobile Link, and at this time I do not want to use it, thanks. I'm awar