[SOLVED] Script for auto-connection
Hey,
I want to write a script that does the following:
When I switch my laptop on, checks (using the "iwlist wlan0 scan" command) which wireless networks are in range.
Then, if my home's essid is found, launch the file that connects to that network.
I know quite a few programming languages (JAVA, C, C++, etc.), but no scripting languages what so ever..
I would like a recommendation of a good scripting language to use, and maybe a few pointers as well..
Thanks in advance
Fiod
Last edited by fiod (2007-10-22 18:16:52)
I started to write a script wich list the available networks in python
maybe that can help you for starting
It is really fun to write python but when you come from java or C, you have to learn a new way of programming !!!
Python is really easy to learn.
#!/usr/bin/env python
import os
class AccessPoint:
adress = ""
essid = ""
quality = 0
mode = ""
frequency = ""
channel = 0
encryptionKey = ""
encryptionType = "No Information available"
def __init__(self, address):
self.address = address
def __cmp__(a, b):
return cmp(a.quality, b.quality)
tmpFile = "/tmp/wifiap"
interface = "wlan0"
if (os.path.exists(tmpFile) == False):
os.system ("iwlist %s scan > %s" % (interface,tmpFile))
data = open(tmpFile).readlines() # open the file
accessPoints = []
for line in data:
if "Address" in line: # create a new network dict
address = line[line.find("Address") + 8:]
accessPoints.append(AccessPoint(address.strip()))
elif "ESSID" in line:
accessPoints[-1].essid = line[line.find("ESSID") + len("ESSID") + 1:].strip()
elif "Mode" in line:
accessPoints[-1].mode = line[line.find("Mode") + len("Mode") + 1:].strip()
elif "Frequency" in line:
accessPoints[-1].frequency = line[line.find("Frequency") + len("Frequency") + 1:].strip()
elif "Encryption key" in line:
accessPoints[-1].encryptionKey = line[line.find("Encryption key") + len("Encryption key") + 1:].strip()
elif "IE" in line:
accessPoints[-1].encryptionType = line[line.find("IE") + len("IE") + 1:].strip()
elif "Quality" in line:
accessPoints[-1].quality = line[line.find("Quality") + len("Quality") + 1:line.find("Signal")].strip()
elif "Channel" in line:
accessPoints[-1].channel = line[line.find("Channel") + len("Channel") + 1:].strip()
accessPoints.sort()
accessPoints.reverse()
print "Listing found networks:"
print '%-18s %-20s %-8s %-7s %-4s (%s)' % ("ADDRESS", "ESSID", "QUALITY", "CHANNEL", "ENCRYPTION KEY" , "ENCRYPTION TYPE")
for accessPoint in accessPoints:
print '%-18s %-20s %-8s %-7s %-4s (%s)' % (accessPoint.address, accessPoint.essid, accessPoint.quality, accessPoint.channel, accessPoint.encryptionKey , accessPoint.encryptionType)
Similar Messages
-
PS Dynamic Script for Test-Connection on OU and SubOU.
I have a non working PowerShell script for searching an OU in an 2008 level Active directory, but it is obviously incomplete. I was able to retrieve part of the script from another forum (cant remember which one, or I would kindly give them the credit they
deserve), but I was hoping to include a variable to in the "SearchBase" option below and make it dynamic, where I can change the OU to ping from a top level and have it also work under a child OU if I need to.
Outcome: Ping OU and child OU and have the option to ping either selection. Of course I would manually enter in my Search base parameters when prompted from the shell. I just want to have any easy way of ping all computers from an OU level without having
to paste the lower part of the script to my PowerShell script pane and changing the OU from there. If I can get the correct parameters working, then it would be easy to load this function to my PS profile. Thank you, and help is appreciated. Hoping someone
can let me know what I am missing to get this functional.
function
get-DCping
[CmdletBinding()]
[Alias()]
[OutputType([int])]
Param
# Param1 help description
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName
=$true,
Position
=0)]
[string]$Search)
$rtn
=
$null
Get-ADComputer
-Filter
-SearchBase
'OU=$Search,DC=domain,DC=domain'
|
{$rtn
=
Test-Connection
-CN
$_.name
-Count
1
-BufferSize
16
-Quiet
IF
($rtn
-match
'True') {write-host
-ForegroundColor
green
$_.name}
ELSE
{ Write-host
-ForegroundColor
red
$_.name }}Hi,
Here's a starter:
Function Get-DCPing {
[CmdletBinding()]
param(
[string]
$OrganizationalUnit
Get-ADComputer -Filter * -SearchBase $OrganizationalUnit | ForEach {
$computerName = $_.Name
$props = @{
ComputerName = $computerName
Alive = $false
If (Test-Connection -ComputerName $computerName -Count 1 -Quiet) {
$props.Alive = $true
New-Object PsObject -Property $props
Don't retire TechNet! -
(Don't give up yet - 13,225+ strong and growing) -
VBS script for auto integration for multiple channels
Hello there,
I would like to create a Diadem script to auto analyse multple channels in a tdms file.
As I haven't yet gone on the diadem advanced course, I need help.
I have tried the recording mode but I must pick each channel manually then integrate it (but I have around 150 separate channels !)
I would like to therefore create a routine which starts at the first channel, integrates it, times it by 3600, then chooses the max value and stores this in a new channel.
It would then continue down the list until all channels are complete.
I need a loop routine , but don't understand yet how to create it....one day I'm sure it will appear simple ...
Can anybody help ..?Hi adek,
Why don't you post a typical data sett of yours with 150 channels. That way the code we give you will work without any edits needed on your end.
Brad Turpin
DIAdem Product Support Engineer
National Instrumens -
Script for internet connect with dial up modem, check email & log off
I am looking for a script to connect to the internet (with dial up) external apple modem, then check email and then log off and disconnect. I don't want any other applications opening internet connect? A would use this script file with ical and could have my email checked and open up in the morning before I leave for work....being that we have dial up the entire process of connecting to the internet and checking email is time consuming. Any help is greatly appreciated. thks
You need some additional logic in there - as written, the script will launch mail, then immediately disconnect the internet connection.
At the very least you need to add a delay before disconnecting to allow for Mail to download awaiting messages.
Since you cannot predict how long a delay you'll need, a better approach would be to query Mail.app and wait until it's idle, like:
tell application "Mail"
launch -- doesn't need to be frontmost
check for new mail -- get all mail
repeat until (get background activity count) = 0
delay 2 -- wait 2 seconds before checking again
end repeat
end tell
In this way the script forces a check of new mail (don't assume that Mail.app is set to auto-check, especially for dialup users who often compose mail offline and may have automatic checking disabled), and it hangs around until Mail.app has finished downloading all the messages. -
I am trying to set up bluetooth on the Centro to connect to the internet via my PC's internet.
HotSync over bluetooth works successfully.
Computer specs: Toshiba P205-S6277; Bluetooth Stack v5.10.04 (currently using); Bluetooth Monitor v3.01 (to use Vista's built-in bluetooth)
I think I have narrowed my problem down to 3 things.
(1) Finding Network Access properties (to allow connected devices to access the internet)
(2) Finding Centro's Network Connection Type: PPP
(3) Finding the correct Login Script to use
for (1) I think I've looked everywhere; found nothing on Network Access.
Checked control panel: only Bluetooth Local COM
Right-clicked bluetooth icon > Settings: File transfer, PAN Networking, PAN DHCP server, AV controls. Other bluetooth settings are for file transfer or object push. I don't see anything like this.
I'm stumped on (2). It seems as if palm removed this option under Centro's Advanced network settings .
Nearly all the forums that I read says to choose Connection Type: PPP.
(3) Found 2 scripts that seemed would work. I don't know how it exactly works but it sounds workable.
First script:
Send: CLIENT
Send: CLIENT
Wait for: CLIENTSERVER
End:
Script 1 Connect Log:
=======================================
Connect Log
S: client
S: client
R:
Err: 0x121F <<<netErrUserCancel b/c I canceled it.
Not connected
========================================
I canceled it because the process would stay on "Signing In" then it automatically "Canceled" itself.
Second script:
Send CR:
Delay: 1
Send: CLIENT
Wait For: CLIENTSERVER
End
**UPDATE** I found on this forum (Reply # 3689) that the script is needed only if you are using Palm OS 4 or under. Centro uses Palm OS 5.49121. Can anyone support this?
Even without the script it has problems "Signing In".
I'm currently reading this site and trying out its decribed methods. I will update this thread when I get the results.
I'm using the Centro. And If anyone's been able to successfully connect to the internet on the Centro via a bluetooth connection to the PC WITHOUT 3rd party applications, please share. If not, please share any ideas.
Thanks!
-Eric
Post relates to: Centro (AT&T)
Message Edited by naisanza on 01-01-2009 02:26 PMI've been going at this for days, and have probably exhausted all the proposed solutions on the first 3 pages of various google searches. I'm getting the feeling that Vista users are pretty much SOL for the time being.
For the record, I just tried out a few of the solutions (mRouter & SoftickPPP) on XP and they work perfectly.
Post relates to: Centro (Verizon)
Message Edited by Cogwheel on 02-13-2009 09:45 AM -
Script for auto recovery of standby node - Simple dataguard
Hi.
I have set up several solutions with Oracle SE and simple dataguard on linux.
On physical standby, I have created a script which performs the recovery every 15 minuts:
source /u01/app/oracle/sb_scripts/.profile_websb
/u01/app/oracle/product/10.2.0/bin/sqlplus "/ as sysdba" <<EOFSQL
recover automatic standby database;
exit;
EOFSQL
However, I am trying to perform the same on a windows environment but struggles a bit with the script.
Initally I tried %ORACLE_HOME%\bin\sqlplus / as sysdba @c:\scripts\recover.sql
Where recover.sql has been:
recover automatic standby database;
exit;
and :
recover automatic standby database until cancel;
alter database recover cancel;
exit;
Neither of these exits the bat scripts but awaits user input on CANCEL after the last archived log has been added.
Anyone with a bright idea on how to solve this?
Thanks.
Kjell OveKjell wrote:
Hi.
I have set up several solutions with Oracle SE and simple dataguard on linux.
On physical standby, I have created a script which performs the recovery every 15 minuts:
source /u01/app/oracle/sb_scripts/.profile_websb
/u01/app/oracle/product/10.2.0/bin/sqlplus "/ as sysdba" <<EOFSQL
recover automatic standby database;
exit;
EOFSQL
However, I am trying to perform the same on a windows environment but struggles a bit with the script.
Initally I tried %ORACLE_HOME%\bin\sqlplus / as sysdba @c:\scripts\recover.sql
Where recover.sql has been:
recover automatic standby database;
exit;
and :
recover automatic standby database until cancel;
alter database recover cancel;
exit;
Neither of these exits the bat scripts but awaits user input on CANCEL after the last archived log has been added.
Anyone with a bright idea on how to solve this?
Thanks.
Kjell OveKjell
This script I use for windows (linked from my old site at http://www.niall.litchfield.dial.pipex.com/ ) uses
alter database recover automatic standby database until cancel;
alter database recover cancel;Note the extra alter database I'll admit I haven't run this personally in 2 or 3 years now.
Niall Litchfield
http://www.orawin.info/
Edited by: Niall Litchfield on Apr 23, 2009 10:21 AM can't use bold in code apparently. -
Script for auto select of subtitle stream with 16:9 or 4:3 display
I have an anamorphic 16:9 project that is set for 16:9 letterbox display. It is letterboxed in anamorphic for a 2.35:1 aspect ratio. I have 2 subtitle streams both identical in content. One stream is positioned for 16:9 displays with subtitles in the lower movie frame. The other stream is positioned for 4:3 displays with subtitles completely in the lower letterbox.
I would like to create a script that can choose the appropriate stream depending on the user's setup (either 16:9 or 4:3). I would like the non-appropriate subtitle stream to appear non existent to the user. Basically, I don't want the user to have access to both of the streams. If they push the subtitle button on their remote, I would like to have just the proper one available. Can this be done in DVDSP? I'm not a total idiot with authoring, just not that experienced with scripting, so it's a little intimidating.
I've gone as far to look in the manual and have found that SPRM 14 seems to be the key to display prefs. Could someone map out how to create such a script? Thank you.In general this script should work:
mov GPRM0, SPRM14
and GPRM0, 3072
Set System Stream St(Subtitle Stream 1) (On) if GPRM 0 = 3072)
Set System Stream St(Subtitle Stream 2) (On) if GPRM 0 != 3072)
Jump Track 1
The value of 3072 is returned when 16:9 value is stored in SPRM14.
However some players may disregard this script as they might look for the presentation information in IFO files or in the video stream itself.
The better approach is to flag one subtitle stream as 16:9 and the other as 4:3 in DVD After Edit if you have an access to it.
MacPro 2.66, G5 DP 2.7 Mac OS X (10.4.9) TASCAM DA-88, DigiBeta, DeckLink HD Extreme, Cinemacraft Encoder -
Scripting for database connection
I am wondering if it is possible to create a new panel (like the folders panel).
The reason I ask is that, at work we use bridge to process all of our images, but use a database to store them all. The database uses a tree structure that I want to see on a panel like the Folders panel. That way we could edit the images straight from the database...
Is it even possible to create new panels?In all seriousness, wouldn't a MySQL forum be a much better place to ask this?
It would seem you would get a lot more replies. -
[SOLVED] problem in making a daemon for network auto-connection
I want to make a daemon that when I start my computer and my router is not already available, to auto connect to my router when it becomes available later without rebooting
So I thought in making a script and running it as a daemon which will hopefully solve my problems. The thing is I'm having a hard time isolating only the routers ip address. Here's how I thought the script should look like
#!/bin/sh
anet="$(ifconfig | awk "/router_address/{print $field}")"
if [ $anet = "router_address" ]
then
/etc/rc.d/network restart
fi
But although awk isolates the line with my router address it doesn't recognizes any field. Any value I assume to $field doesn't isolates anything so I could guess the right field (or fields) for the router's ip address.
Last edited by I'mGeorge (2011-03-31 09:46:05)litemotiv wrote:Not a direct answer to your question, but have you considered using Netcfg for this? https://wiki.archlinux.org/index.php/Netcfg
thx a bunch, all I needed was ifplugd daemon. That script I thought about was a bad idea anyway 'cause continuous starting or restarting your network can't be good so I had to work more on it while ifplugd made everything happen clean and easily. -
N8 Auto connect to WAN for no apparent reasons
Hi All,
I have noticed that for some unknown reasons my phone will auto connect to WAN.
I have absolutely no idea why it is doing so and have confirmed that there is some data transfer.
Is there any way to check which programs is connecting to WAN?
Can anyone recomend system settings which can prevent this from happening?
Thanks.
WAN settings is currently set to manual and always ask. - Though it still auto connect when using programs like the browser
Widgets: offline mode.
My Nokia: On. Can this be the cause?gerald teo wrote:
why does it keep changing from solid green to flashing amber even though i've not touched anything.
Welcome to Apple's discussion groups.
I'd guess that's due to a glitch in your broadband service. You should be able to identify why the Extreme isn't happy by launching AirPort Utility, putting the Extreme into "manual setup" mode, then clicking on the "Status" circle. -
Jabber for iPhone force auto-connect
Hello,
Does anybody know if it is possible to force Jabber for iPhone/iPad to connect to a wireless SSID network as soon as it is available?
We recently implemented Jabber and we are noticing that some times, users arrive to the office, where corporate SSID is available, but even if jabber is running on the background, it won't automatically reconnect to the network.
User will have to manually open the application and wait for Jabber to reconnect.
Is it possible to make this process automatic for the user?
Regards,CUCM version is 8.6.2.
Presence version is 8.6.4
Jabber for iPhone & iPad is 9.6.2
The issue is that if Jabber is running on iPhone's background, even if wireless connection is activated, it seems to disconnect. In order to reconnect, user has to manually open Jabber and wait for the connection to establish, especially to make calls.
The same applies when a user is running Jabber, he arrives from outside to the company and wireless reconnects to corporate SSID. Jabber won't automatically reconnect until user opens the app.
Regards, -
[SOLVED] advanced shell script for mount and unmount samba share
Good morning guys,
Today I've a very long question....
Hope in your help....:
I usually move from different network.
For one of those I need to mount some share that are under an ActiveDirectory server.
To do that I use samba.
Especially I've made and use the below shell script.
I know that it's so stupid but I'm a very newbie:
#!/bin/sh
echo "This is a custom script for mount my citrix share"
echo "Please insert user password (must a sudoer user)"
echo " "
sudo mount -t cifs -o username='myusername',password='mypassword' //host_ip/TsHome$/myusername /home/myuser/samba_share/TsHOME
sudo mount -t cifs -o username='myusername',password='mypassword' "//host_ip/direction" /home/myuser/samba_share/direction
echo " "
read -p "Press ENTER key to close this terminal"
exit
As I say the script work but it's so crude...!
I want/need to implement it whit the follow addictions:
1. print a feedback on mount: somenthing like "TsHOME is now mounted" or "unable to mount TsHOME"
2. check if the share are already mounted: to prevent accidentally multiple mount. If a share is already mounted I want to print something like "TsHOME is already mounted on /home/myuser/samba_share/TsHOME"
3. ask for share password (now it's in clear on script) - This is optinal
4. un-mount the share before reboot or shutdown command. That because I've notice that If i reboot or shutdown without manually un-mount the share the step of unmounting network file system became very slow
If it's no extremely difficult, can someone help me to write this script?
I know that man exist but I'm not a programmer and it's so difficult for me approch it.
Thank you in advance.
Ale
Last edited by Alexbit (2010-09-23 21:29:13)Thank you very (VERY) much!
I've follow your information and.. it work!
If can be usefull to other this is the complete script:
#!/bin/sh
echo "This is a custom script for mount citrix share"
echo "****************************************"
echo " "
echo "Please insert domain password:"
read -s mypassword
echo " "
echo "|checking mount state...in share are not mounted mount it!|"
echo "+-------------------------------------------------------------------------+"
if grep "TsHome" /etc/mtab &>/dev/null; then
grep "TsHome" /etc/mtab | awk '{print "TsHome is already mounted on " $2}'
else
sudo mount -t cifs -o username='yourusername',password="$mypassword" //ipaddress/TsHome$ /home/Samba_share/TsHOME && echo "TsHOME is now mounted" || echo "unable to mount TsHOME"
fi
echo " "
if grep "direction" /etc/mtab &>/dev/null; then
grep "direction" /etc/mtab | awk '{print "direction is already mounted on " $2}'
else
sudo mount -t cifs -o username='yourusername',password="$mypassword" '//ipaddress/direction' /home/Samba_share/direction' && echo "direction pat is now mounted" || echo "unable to mount direction"
fi
echo " "
if grep "Area" /etc/mtab &>/dev/null; then
grep "Area" /etc/mtab | awk '{print "Area is already mounted on " $2}'
else
sudo mount -t cifs -o username='yourusername',password="$mypassword" '//ipaddress/Area' /home/Samba_share/Area && echo "Area is now mounted" || echo "unable to mount Area"
fi
echo " "
echo "All DONE!"
echo " "
read -p "Press ENTER key to close this terminal"
exit
I don't really well understand what I've to put in rc.local.shutdown....
I think somethings like:
#!/bin/bash
# /etc/rc.local.shutdown: Local shutdown script.
echo "This is a custom script for UN-mount citrix share"
echo "********************************************"
echo " "
echo "|check mount state: if mount then un-mount!|"
echo "+-------------------------------------------------------+"
echo " "
if grep "TsHome" /etc/mtab &>/dev/null; then
grep "TsHome" /etc/mtab | awk '{print "TsHome is NOT mounted -> going on..." $2}'
else
sudo umount /home/Samba_share/TsHOME && echo "TsHOME is now UN mounted" || echo "unable to UN-mount TsHOME"
fi
echo " "
if grep "direction" /etc/mtab &>/dev/null; then
grep "direction" /etc/mtab | awk '{print "direction is NOT mounted -> going on.." $2}'
else
sudo umount /home/Samba_share/direction && echo "direction is now UN mounted" || echo "unable to UN-mount direction pat"
fi
echo " "
if grep "Area" /etc/mtab &>/dev/null; then
grep "Area" /etc/mtab | awk '{print "Area is NOT mounted - Finished" $2}'
else
sudo umount /home/Samba_share/Area && echo "Area is now UN mounted" || echo "unable to UN-mount Area"
fi
echo " "
echo "going shutdown"
echo " "
sleep 5
I've try but it seems to ignore the IF statement... this is the output when ALL share are UNmounted:
$ sh /etc/rc.local.shutdown
This is a custom script for UN-mount citrix share
|check mount state: if mount then un-mount!|
+-------------------------------------------------------+
umount: /home/Samba_share/TsHOME: not mounted
unable to UN-mount TsHOME
umount: /home/Samba_share/direction: not mounted
unable to UN-mount direction
umount: /home/Samba_share/Area: not mounted
unable to UN-mount Area
going shutdown
Tomorrow I will test again when I'm at office.
Meanwhile can you check if I made a macroscopic mistakes?
Thank you again!
Last edited by Alexbit (2010-09-23 17:34:49) -
Auto Email on event - EEM script for NxOS
I generated EEM script for Duplicate IP address detection, but i do not know how to trigger email in NxOS.
event manager environment emailto "[email protected]"
event manager applet Duplicate_IP
description "Detect Duplicate IP and Send Trap"
event syslog pattern "%ARP-2-DUP_SRC_IP"
action 1.0 snmp-trap strdata "Duplicate IP Detected on Host $hostname"
action 2.0 cli sh logg last 100
action 3.0 event-default
Somebody know how to trigger email. There is no good document on EEM email triggering mechanism.Not sure if this would work in NxOS but I think it would go something like this;
Specify the action of sending a short e-mail when the EEM applet is triggered via the event syslog pattern you already have defined:
Router(config-applet)# action label mail server server-address to to-address from from-address subject subject body body-text
Remember to define the EEM environment variables first when setting up the applet as follows:
event manager environment _email_server
event manager environment _email_to
event manager environment _email_from -
[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) -
Cannot load script for execution.
hi
iam creating the sisi package with in script task . script task was build successful . but when i was executive the ssis packages vs 2012.
it get error :Cannot load script for execution..
the code is
Microsoft SQL Server Integration Services Script Task
Write scripts using Microsoft Visual C# 2008.
The ScriptMain is the entry point class of the script.
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.IO;
namespace ST_8cdbf584a74b48abb384d8f03cf42f4d.csproj
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
#region VSTA generated code
enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
#endregion
The execution engine calls this method when the task executes.
To access the object model, use the Dts property. Connections, variables, events,
and logging features are available as members of the Dts property as shown in the following examples.
To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
To post a log entry, call Dts.Log("This is my log text", 999, null);
To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
To use the connections collection use something like the following:
ConnectionManager cm = Dts.Connections.Add("OLEDB");
cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
To open Help, press F1.
public void Main()
byte[] dataByte = null; String errInfo = "";
try
String sDirectory = Dts.Variables["User::Directory"].Value.ToString();
String CreatePartitionFileXMLA = sDirectory + "\\partitionssales20010701to20010731.XMLA";
String ProcessPartitionFileXMLA = sDirectory + "\\partitionssales20010701to20010731.XMLA";
// Create XMLA Script
Dts.Variables["User::CreatePartitions"].Value = ReadFile(CreatePartitionFileXMLA, errInfo);
if (errInfo.Length > 0)
Dts.Log("Error while reading XMLA file: " + errInfo, 0, dataByte);
Dts.TaskResult = (int)ScriptResults.Failure;
//Process XMLA Script
Dts.Variables["User::ProcessPartitions"].Value = ReadFile(ProcessPartitionFileXMLA, errInfo);
if (errInfo.Length > 0)
Dts.Log("Error while reading XMLA file: " + errInfo, 0, dataByte);
Dts.TaskResult = (int)ScriptResults.Failure;
Dts.TaskResult = (int)ScriptResults.Success;
catch (Exception ex)
Dts.Log("Error Message: " + ex.Message, 0, dataByte);
Dts.TaskResult = (int)ScriptResults.Failure;
public String ReadFile(String FilePath, String ErrInfo)
String strContents;
StreamReader sReader;
try
sReader = File.OpenText(FilePath);
strContents = sReader.ReadToEnd();
sReader.Close();
return strContents;
catch (Exception e)
MessageBox.Show(ErrInfo);
ErrInfo = e.Message;
return "";
how to solve this issue
pleasse help me..Hi sheshu0022,
Based on my research, the issue can be occurred due to something get corrupted in the script task. To fix this issue, please copy the code in the task, then rebuild the script task with the same code to test again.
The following similar thread is for your reference:
http://stackoverflow.com/questions/15165760/ssis-script-task-fails-on-server-with-error-cannot-load-script-for-execution
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support
Maybe you are looking for
-
Installation prob Essbase Administration Services 9.3.1 on HP-UX 11.11
Hello, I'm having problems while installing the Essbase Administration Console 9.3.1 on HP-UX 11.11. At the last step, I have the following messages in the Unix console: ...........May 29, 2008 12:29:37 PM com.hyperion.cis.ExpandArchives execute SEVE
-
XML Publisher Output in different forrmat
Hi, Any help with the below problem would be highly helpful. I have an xml data file which has the folloing looping structure: -<G_REPORT> -<G_HEADER> <NAME>xyz</NAME> <ADDR1>111</ADDR1> </G_HEADER> -<G_LINE> <LINE_NUM>1</LINE_NUM> <TRX_NUM>11<TRX_NU
-
HT2497 How can I connect my MacBook Pro using my personal cellular 'hotspot'?
I am a brandnew user of MacBook Pro (iOS 10.8 Mountain Lion) and am clueless!! I've never used anything but Windows OS's. I am attempting to connect to the internet using my cellular phone's 'hotspot'....no connection. I then tried to connect via
-
Write the syntax for declaring table control in dialog programming?
1) Write the syntax for declaring table control in dialog programming? 2) Write the syntax to call a selection screen in a modal dialog box?
-
Dynamic select list with display,return val & join condition issue.
hello, I am having a dynamic select list with display, return value say for example my select statement is select distinct dname d, deptno r from dept dt right join emp e on (e.deptno=dt.deptno) where (condition) when i tried this query for my select