Difference dot sourcing and importing module

Hi,
Please clarify the difference between dot sourcing a function and importing a module.
http://mikepfeiffer.net/2010/06/how-to-add-functions-to-your-powershell-session/
Note: is there a way to import all my functions in one go so I can load them on a new pc?
J.
Jan Hoedt

dot sourcing runs the script in the global scope.
Import-Module loads an assemble or module file.
They are not in any way similar although theey can both be used to accomplish certain things.
Start by reading the manual on what a module is.
help about_modules
Now look at how dot sourcing works.  A file loaded with dot sourcing is not executed but remains in memory.  A function in a PS1 and all variables will not remain in memory if you "run" the script without dot sourcing.
search for "dot sourcing" and read almist any of the many blog articles on how to use it.
\_(ツ)_/

Similar Messages

  • What's the difference between dot sourcing and non-dot sourcing?

    My teacher is incompetent in this matter.
    I've been struggling to make logic out of the use of dot-sourcing and non dot sourcing. 
    What is the difference? I've been bashing my head against the wall for the past hour.

    Hi Loginux,
    "simply" put, non-dotsourcing scripts / functions will run them in their own small box ("Scope"), which is discarded when the execution finishes. Dotsourcing will run it in the current environment. Example:
    script.ps1:
    $Hello = "Hello World"
    non-dotsourced:
    $Hello = "Hi Mark"
    & .\script.ps1
    Write-Host $Hello
    dotsourced:
    $Hello = "Hi Fred"
    . .\script.ps1
    Write-Host $Hello
    Cheers,
    Fred
    There's no place like 127.0.0.1

  • What is the difference between subroutine and function module?

    What is the difference between subroutine and function module?

    Hi,
    they can both return values.
    FMs are mainly used when a routine is to be performed by many programs.
    Subroutines (forms) are generally only executed within one program.
    You can perform routines from other programs, but it's not often done.
    both forms and FMs are reusable modularization units.
    To distinguish we generally say that forms are used for internal modularization and
    FMs are used for external modularization.
    To decide on which to implement, consider whether you need the content to be used just for a limited program
    or wheteher it can be called from many independent programs.
    For the first purpose it is better to implement a form whereas for the second we implement an FM.
    However, ABAP does not isolate the usage context.
    That is; you can call a form from another program within whose code the form is not actually implemented.
    However, this requires attention since the form may utilize global variables.
    The same issue holds for FMs.
    FMs are encapsulated in function groups and function groups may have global variables that can be globally
    used by all FMs inside it.
    Thanks,
    Reward If Helpful.

  • Difference between bapi and function module

    Can you guys tell me what are the differences in calling bapis and function modules?
    I see we are calling both as the same way we call function modules. May be for bapis, we need to be careful in declaring and passing those exact structures. Can you please make it clear reg. the differences between them?
    I appreciate it.
    Thanks!

    HI,
    See these links on help.sap.com
    <b>For BAPI:</b>
    The data entered in the Internet is transferred to the R/3 System via BAPIs (Business Application Programming Interfaces).
    Data in the R/3 System is accessed via BAPIs as well.
    A Good Site for BAPI's
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://help.sap.com/saphelp_erp2005/helpdata/en/7c/3ce38765ba11d395fe00a0c94260a5/frameset.htm
    <b>For Function Module:</b>
    The important use of functional module is it is used by Enhancements.
    SAP Enhancements are used to expand the standard functionality within SAP.
    Enhancements use function modules and are called from the standard SAP code.
    http://help.sap.com/saphelp_erp2005/helpdata/en/41/7af4daa79e11d1950f0000e82de14a/frameset.htm
    List of functional modules ( Good Site)
    http://www.geocities.com/victorav15/sapr3/abapfun.html
    Hope it helps!!!!
    Thanks
    Sudheer

  • What is the difference between LH and LX modules?

    I would like to know the difference between LX and LH SFP modules. Long Haul ( LH ) denotes longer distances while Long Wavelength ( LX ) denotes less energy which is obviously shorter distance. Why does Cisco use both LX and LH for certain SFP modules?
    Do they denote the capability of the module to work both for MM ( which will be Long wavelength ) and SM ( Long Haul ) fiber? Do correct me if i am wrong.
    What does it infer if a modules says like "Cisco 1000BASE-LX/LH SFP" ?

    What does it infer if a modules says like "Cisco 1000BASE-LX/LH SFP
    Generally a module is either made for single mode (More distance) / multimode (short distance). But this module can be used for both Single mode and Multimode.
    If used with SM fiber it can go upto 10Km
    It used with MM it can go upto 550meters (depend on what kind os MM fiber you have) You need a mode conditioning patch chord too with legacy MM i think OM1 and 2.
    Long Haul ( LH ) denotes longer distances while Long Wavelength ( LX ) denotes less energy which is obviously shorter distance. Why does Cisco use both LX and LH for certain SFP modules
    Read this link and dont worry about LX/LH (You will ge tthe distance mentiond above depending on the type of fibe ryou are using)
    http://en.wikipedia.org/wiki/Gigabit_Ethernet
    Before it was standardized 1000BASE-LX10 was essentially already in widespread use by many vendors as a proprietary extension called either 1000BASE-LX/LH or 1000BASE-LH

  • SQL Server replication and size differences of source and destination databases

    I set up snapshot replication for a DB between two SQL instances.  On the source instance, the DB shows as 106612.56MB with 34663.75MB as available free space.  I expected that the replica would then end up being 71948.81MB (106612.56 - 34663.75
    because it wouldn't replicate the white space).  The resultant replica database is showing as 35522.94MB.  The required data appears to be present in the replicated DB as the SSRS reports that use it are able to find the data they look for.  But
    why the large discrepancy in size between the source and replicated DB?  The replicated DB is less than 1/2 the size of the source DB.  I've searched around and can't seem to find any explanation.  I realize this isn't mirroring so the DBs will
    not be identical in size but I did not expect to see such a large difference between the two.  I am replicating all almost all articles (tables, stored procs, etc.) with the exception of a handful of stored procedures and user-defined functions that either
    reference invalid column names in a table (vendor bug) or reference another DB that is not present on the replica's instance.  I would expect these 4-5 articles can not account for a 37000 MB size difference between the two DBs.
    Please note that this has nothing to do with transaction log size.  I am specifically talking about the database size and am not looking at the size that combines both DB and TxLog size.
    Any insight?

    Another factor could be that on the publisher the data is distributed through pages, paragraphs and extents. Depending on your fill factor and the amount of deletes and your datatype, there could be space in the pages, paragraphs and extents which have not
    been reclaimed.
    During the bcp process which is part of the snapshot application process on the subscriber all the data will be in the tables in a contiguous fashion. I would suspect this would be why you have the difference in space usage.
    looking for a book on SQL Server 2008 Administration?
    http://www.amazon.com/Microsoft-Server-2008-Management-Administration/dp/067233044X looking for a book on SQL Server 2008 Full-Text Search?
    http://www.amazon.com/Pro-Full-Text-Search-Server-2008/dp/1430215941

  • BC data source and functional module

    Hi Gurus
    I know that we can extract data via functional module in case of generic extractor but when we use business content data source ( for ex.0MAT_PLANT_ATTR) is it possible to use functional module to extract the data?
    How can we find the functional module? my requirement is I need to enhance this data source with few more attributes.
    Pl help. also advise where I need to write the code?

    You can see if it FM based or not, in RSA2, or, in table ROOSOURCE (on the source system).
    In general, it is not possible/advisable to change the BC extractor FMs.
    Right way to go about is to use enhancements. For this case 0MAT_PLANT_ATTR, if the other attributes are coming from same material tables, you may be able to get those by enhancing the extract structure.
    If not, you can enhance the extract structure, and write the code in the user-exit provided for extending master data extraction (function EXIT_SAPLRSAP_002 - check its documentation in SE37).

  • Quality Difference Between Source and Program Monitors

    Hi,
    Hopefully somebody might be able to shed some light on my problem... I am working with a QT file in PP CS5 which is an animation created in AE CS5.
    File Details:
    Type: QuickTime Movie
    File Size: 507.4 MB
    Image Size: 1920 x 1080
    Pixel Depth: 24
    Frame Rate: 25.00
    Total Duration: 00:01:00:00
    Average Data Rate: 8.5 MB / second
    Pixel Aspect Ratio: 1.0
    Now when I view the footage in my Source with window (at 100%) it looks nice and crisp, bright and vibrant. When I view it in the Program monitor (at 100%), at both pre and post render stages the footage looks jagged, pixelated and much less vibrant, I've also noticed a slight colour shift as well.
    I'm pretty new to PP CS5 - sorry if this is something really obvious or basic that I have overlooked!, but hopefully someone can help me out!
    Many Thanks,
    Neil.

    Neil,
    The Source Monitor is a simple player (as is the tiny player window in the Project Panel), and plays directly from the AV file on the HDD, where the Program Monitor is displaying from the Timeline, and takes into consideration any decompression, any Effects, etc.. There are also several settings in the Program Monitor, that can affect the display, such as Quality (try on Highest), and whether one is displaying 1/2, 1/4, etc. Resolution. What are all of the settings in your Program Monitor.
    Also, what form of MPE do you have enabled, and what is the make/model of your video card? At the same time, you might want to list your video driver number/date.
    Good luck,
    Hunt

  • Difference between GBIC and SFP module

    when its best to use GBIC and When to use SFP ?
    what i know is basically SFP is a smaller version of GBIC but I am not clear when to use what any special recommendation ?

    GBIC - Datasheet definition:
    The industry-standard Cisco Gigabit Interface Converter (GBIC) is a hot-swappable input/output device that plugs into a Gigabit Ethernet port or slot, linking the port with the network. Cisco GBICs can be interchanged on a wide variety of Cisco products and can be intermixed in combinations of 1000BASE-T, 1000BASE-SX, 1000BASE-LX/LH, 1000BASE-ZX, or 1000BASE-CWDM interfaces on a port-by-port basis.
    http://www.cisco.com/en/US/prod/collateral/modules/ps5455/ps6577/product_data_sheet09186a008014cb5e.html
    SFP - Datasheet definition:
    The industry-standard Cisco® Small Form-Factor Pluggable (SFP) Gigabit Interface Converter is a hot-swappable input/output device that plugs into a Gigabit Ethernet port or slot, linking the port with the network (Figure 1). SFPs can be used and interchanged on a wide variety of Cisco products and can be intermixed in combinations of 1000BASE-SX, 1000BASE-LX/LH, 1000BASE-ZX, or 1000BASE-BX10-D/U on a port-by-port basis.
    http://www.cisco.com/en/US/prod/collateral/modules/ps5455/ps6577/product_data_sheet09186a008014cb5e.html
    Ok, now if you have a look at the above datasheets for GBIC's & SFP's, you would find that GBIC & SFP are different in there sizes, hence it is more of a question as to which gigabit solution your device supports. If your device supports GBIC, like 4500's, you will have to go for a GBIC, & if your device supports SFP, like 3750's, you will have to go for a SFP. These days all the latest devices would have SFP's normally.
    Also, here is a very good document which lists almost all the GBIC's & SFP's & the devices on which they are supported, you may check your device on this list & decide which one can you use accordingly.
    Hope that helps !!

  • JavaNullPointer Exception in Appserver Log(Finance Sourcing and Contracts Module)

    We are facing one exception in the app server log in our Dev, Test and UAT environments at the time of triggering emails.
    Emails are getting posted to the concern person, but an exception log is getting generated in the App server Log.
    We are unable to trace out whether this is a configuration issue or code issue.
    Can someone help us in sorting out this problem. We have completed the UAT phase as well.
    Our concern is this log should not get generated in PROD. Since the client DBA's are pushing us to check the code that we have written.
    We are using the delivered method to trigger the emails. But getting the below exceptions in App server Log.
    Please forward this message to any known finance DBA's or Know DBA's who can suggest something solution.
    Thanks in advance.
    PSAPPSRV.15807 (559) [08/22/13 19:59:22
    .com (IE 8.0; WIN7) ICPanel](0) Rowset::Refresh in program AUC_ANALYZE_HD_CMP.GB
    L.AUC_LINE_WRK.AUC_ANALYZE_PB.FieldChange flushes current or parent scroll
    PSAPPSRV.15807 (559) [08/22/13 19:59:23
    .com (IE 8.0; WIN7) ICPanel](0) (MCFSendMail): Creating SendMailException
    PSAPPSRV.15807 (559) [08/22/13 19:59:23
    .com (IE 8.0; WIN7) ICPanel](0) (MCFSendMail): SendMailException
    PSAPPSRV.15807 (559) [08/22/13 19:59:23
    .com (IE 8.0; WIN7) ICPanel](0) (MCFSendMail): SendMailException: Context:
    Outbo
    undEmail.Send method called
    PSAPPSRV.15807 (559) [08/22/13 19:59:23
    .com (IE 8.0; WIN7) ICPanel](0) (MCFSendMail): *SendMailException: Java
    Exception*
    *: java.lang.NullPointerException*
    PSAPPSRV.15807 (559) [08/22/13 19:59:23
    .com (IE 8.0; WIN7) ICPanel](0) (MCFSendMail): SendMailException: Detail Message
    :JavaMail Error: java.lang.NullPointerException.\nStack
    Trace:\njava.lang.NullPo
    interException
    at
    com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:599)
    at
    com.peoplesoft.pt.mcf.mail.MCFOutboundEmail.send(MCFOutboundEmail.jav
    a:780)
    at
    com.peoplesoft.pt.mcf.mail.MCFOutboundEmail.send(MCFOutboundEmail.jav
    a:948)
    *OR*
    PSAPPSRV.1663 (4604) [07/31/13 02:41:50
    com (IE 8.0; WIN7) ICPanel](0) (MCFSendMail): SendMailException: Context:
    OutboundEmail.Send method called
    PSAPPSRV.1663 (4604) [07/31/13 02:41:50
    (MCFSendMail): SendMailException: Java Exception:
    java.lang.NullPointerException
    PSAPPSRV.1663 (4604) [07/31/13 02:41:50
    (MCFSendMail): SendMailException: Detail Message:JavaMail Error:
    java.lang.NullPointerException.\nStack
    Trace:\njava.lang.NullPointerException
    at
    com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:509)
    at
    com.peoplesoft.pt.mcf.mail.MCFOutboundEmail.send(MCFOutboundEmail.java:780)
    at
    com.peoplesoft.pt.mcf.mail.MCFOutboundEmail.send(MCFOutboundEmail.java:948)

    First of all, you really, really want to edit your post and remove all the references to your organization smtp server, it's a piece of security hole that attacker can use.
    For your issue, I'd recommand to read the following note, if not already done Master Note for Email failing With Various Errors. (Doc ID 624207.1) from My Oracle Support (paid support required).
    Nicolas.

  • Difference Betwen #include statement and Import statement

    What is the Difference between #include and Import statements!

    Why do you need to shout! Are you unware that English has a question mark that is used at the end of a question sentence! Java doesn't have #include! It only has import!
    Import in Java simply tells the compiler that when you say, for example, List, you mean, for example, java.util.List! It does not affect the generated class file in anyway!
    #include in C/C++ causes the body of the reference file to be inserted into the compilation stream! So, unlike Java's import, that file actually gets compiled into the final output!

  • Diff b/w BAPI and Function Module.

    What is the difference between BAPI and Function Module....
    By Interface programming do we mean posting data thru  BAPI,BDC....

    Hi Alex,
    BAPI: Standard Interface in the R/3 system that allows the system to communicate with components of other business suites.
    FM: These are the procedures that are defined in the Function Groups and can be called from any ABAP Program. FM allow you to encapsulate and reuse global functions int he R/3 system.
    The main basic difference between BAPI and FM are
    1) All BAPIs are FM but not all FMs are BAPIs
    2) BAPIs are remote enabled
    3) BAPIs interface will not have a changing and exceptions. They can not be used to have use dialog.
    Interface programs can post data to SAP either through a BDC, BAPI, IDOC etc. It depends on the type of requirement.
    Hope this solves your question.
    Enjoy SAP
    Rajasekhar

  • RMAN backup files differences in numbers and sizes

    hi,
    I have cloned one database and after doing i can see the target (cloned database has more number of files and in different sizes).
    i can see the scripts are the same and environments are the same..
    where do i find out why there is difference between source and target ..
    ulimit -a > is same
    RMAN backup scripts > is same
    any clues i can find out >?
    Thanks.

    user13051945 wrote:
    hi,
    Let me make it clear here
    Cloning done well no issues..
    now two databases A and B are seperate now.. functioning in two different serveres
    The observation (not an issue) here is
    Server 1 > the backup files generated by Database A is only 10 backup files (10 * 5 = 50 )
    Server 2 > the backup files generated by Database B is 25 files.... (25 * 2 = 50 )
    so how the differences came in both backup scripts are the same....
    hope you got my concern...10 * 5 and 25 * 2
    *5 and 2* are backup piece and *10 and 25* are backupset, yes?
    From each server, post:
    RMAN>show all;

  • Powershell generic session and import this session in Exchange remote management session c#

    The situation :
    I am trying to make an application (c#-asp.net) to manipulate user's on an exchange server. The application will be on a different server than the exchange's one. So, to manipulate the data, I am using an "Exchange remote management session" created
    with c#. Exchange remote management session give access to simple powershell command like "New-Mailbox" and "Set-User" - This is good for simple task, but in my case, I have to do more complexe operations that will need some specific command
    that is not included in the default command. To access this command, I have to use some specific module like "ActiveDirectory". It is simple ? Only use "Import-Module" ! Not really, like I said, the "Exchange remote management session"
    is very limited with the command, and "Import-Module" is not allowed...
    So what we can do ?
    I read a lot about my problem, and the most "simple" (That I understand the theory) solution is something like :
    Start with a generic PS session, import the AD module, then connect to an Exchange management session and do an Import-PSSession and use implicit remoting for the
    Exchange management stuff.
    Given that I am pretty new to manipulate the Powershell with c#, I have no idea how to use this awesome solution in my code. So I am asking your help.
    Here's my current code :
    // Prepare the credentials.
    string runasUsername = @"MarioKart 8";
    string runasPassword = "MarioKart";
    SecureString ssRunasPassword = new SecureString();
    foreach (char x in runasPassword)
    ssRunasPassword.AppendChar(x);
    PSCredential credentials =
    new PSCredential(runasUsername, ssRunasPassword);
    // Prepare the connection
    var connInfo = new WSManConnectionInfo(
    new Uri("MarioKart8Server"),
    "http://schemas.microsoft.com/powershell/Microsoft.Exchange",
    credentials);
    connInfo.AuthenticationMechanism =
    AuthenticationMechanism.Basic;
    connInfo.SkipCACheck = true;
    connInfo.SkipCNCheck = true;
    // Create the runspace where the command will be executed
    var runspace = RunspaceFactory.CreateRunspace(connInfo);
    // create the PowerShell command
    var command = new Command("New-Mailbox");
    // Add the command to the runspace's pipeline
    runspace.Open();
    var pipeline = runspace.CreatePipeline();
    pipeline.Commands.Add(command);
    // Execute the command
    var results = pipeline.Invoke();
    if (results.Count > 0)
    System.Diagnostics.Debug.WriteLine("SUCCESS");
    else
    System.Diagnostics.Debug.WriteLine("FAIL");
    This code work great for simple task (like "New-Mailbox") ! But how can I create a "generic PS session" and then use this session in the "Exchange remote management session" ?

    Hi Vincent,
    Generally we can use the cmdlet "import-module" to import the AD module on DC (Domain Controller), and we can also create a exchange remote powershell session with the cmdlet new-pssession, for more detailed information to create exchange remote session,
    please refer to this article:
    Managing Exchange 2010 with Remote PowerShell
    In addition, to invoke powershell cmdlet in C#, please also try to save all the cmdlets to a powershell script (.ps1 file), then we can add the powershell script to C# like:
    Pipeline pipeline = runspace.CreatePipeline();
    pipeline.Commands.AddScript(scriptText);
    If I have any misunderstanding, please let me know.
    Best Regards,
    Anna Wang

  • Why jave export and import need to be performed after sys copy Dual stack

    Dear All,
    i have a question why do we have to perform JAVA export in the source and import in the target system
    after system copy ( dual stack ). when whole database is copied. Thank you in advance.

    Hi,
    The reason for this is: because most of the Java configuration lies in the file system and not in the database. This is the reason you need to export Java and then import in system copy.
    Thanks
    Sunny

Maybe you are looking for