Issue with running powershell script in pssessions
Hi Everyone,
I am trying to run powershell script from remote machine using below commands
C:\Users\user>"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
-command "$s= New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri
http://Exchservername/PowerShell/ -Authentication Kerberos ; Import-PSsession $s; "C:\Failback.ps1"
and Below is the failback.ps1.
$mbxs = Get-MailboxDatabase | Sort Name
ForEach($mbx in $mbxs)
$MBdb=$mbx.Name $ServerHosting=$mbx.Server.Name
if($mbx.activationPreference.value -eq 1)
If ($ServerHosting -ne $ActivationPreference.Key.Name)
Move-ActiveMailboxDatabase $MBdb -ActivateOnServer $ActivationPreference.Key.Name -confirm:$False
Below is what i am getting.
What is your question? Are you pointing out the yellow text? This is normal, and appears every time EMS is opened.
I should also point out that Microsoft provides a script to re-balance databases, if that's what you're trying to accomplish:
You can use the RedistributeActiveDatabases.ps1 script to balance the active mailbox databases copies across a DAG. This script moves databases between their copies in an attempt to have an equal number of mounted databases on each server in DAG. If required,
the script also attempts to balance active databases across sites.
https://technet.microsoft.com/en-us/library/dd335158(v=exchg.141).aspx
Mike Crowley | MVP
My Blog --
Baseline Technologies
Similar Messages
-
Issue with running Unix Script during post processing
Dear all,
In one of the requirement, we need a execute a UNIX script in the post procesing steps of file channel.
When the script is run independently on the UNIX prompt, it executes very well.
But when the same script is kept in the post processing steps of the file channel, it doesn't give the desired results.
In the channel log, it says the script is executed but we are not able to see the output. (in this case, ist writing some dummy text in a new file). The script has all the permissions for all the users, read write and execute.
If anyone has a similar issue, kindly respond with the resolutions.
Regards,
YounusHI Younus
How you are running the script. Could be a problem with the command you are trying to execute from channel. Let us know the way you are doing
Check whether installed and executed on XI server properly then again check with channel.
Check with these for reference
http://help.sap.com/saphelp_nw70/helpdata/EN/e3/94007075cae04f930cc4c034e411e1/content.htm
The specified item was not found.
Executing Unix shell script using Operating System Command in XI
Thanks
Gaurav -
Issue with running a script in Oracle test manager
Tool - Open Script 9.0.1 , OTM
Hi All
I am facing issue while executing a open script with Oracle Test Manager , I have a script which was made with open script 9.0.1 and which is running very fine with the Open Script UI ,
problem occurs once I am trying to run this with OTM.Issue looks that playback was so fast in OTM so that script was not able to recognize some of the objects.
Is there anyway so that I can control the speed of playback at any particular step when I am using OTM
ThanksHi Kumar,
Regarding your query below is the suggestion:
You have to configure the job server with the repository. While configuring the adapter, you have to configure the job server in management console also..
Still if you are facing issue then please share Job Server logs available in BODS Job Server Folder and error screenshot to debug the issue.
Thanks,
Daya -
Issue with AD Powershell Script
Matt338 wrote:This returned that I had two 1st OU's.
It was what I was looking for.
cduff wrote:
it will work without manually specifying the DN property, because the OU object will implicitly cast to a DN string
As I always passed the object and never the DN, I made in my head an implicit definition of the needed type for the targetpath argument :DSo I have been working this summer getting ready for the next school year. I need to move all of my students up and I thought this would be a great job for a PowerShell script. So I did a little research and found the commands and added the -whatif tag so I could test my scripting. It worked and I was happy.Fast forward now two months and I went to run the script once yesterday and I received some errors for the first six lines the the remaining seven ran just fine.Here is my script:Powershellget-aduser -filter "description -eq 'grad27'" | move-adobject -targetpath (Get-ADOrganizationalUnit -filter "name -eq '1st'") -whatifget-aduser -filter "description -eq 'grad26'" | move-adobject -targetpath (Get-ADOrganizationalUnit -filter "name -eq '2nd'") -whatifget-aduser -filter "description -eq 'grad25'" | move-adobject -targetpath (...
This topic first appeared in the Spiceworks Community -
Issues with running permission scripts on Hoted desktop via Citrix and when deploying via SCCM
I am running a permissioning VBScript which runs when I do a standalone insallation manually running the power shell commands to add and publish the application.
This only runs vis SCCM when a machine installation is acrried out but not a per user installation. Any ideas?
The same script seems to run sometimes & sometimes does not on a hosted desktop with aps publish via citrix from the appv server. Any ideas?. A coppy of my Deploymentconfig.xml file userscript section that calls the script is below
<UserScripts>
<StartProcess RunInVirtualEnvironment="true">
<ApplicationId>[{AppVPackageRoot}]\Adobe Photoshop CS6 (64 Bit)\Photoshop.exe</ApplicationId>
<Path>[{AppVPackageRoot}]\..\Scripts\AdobeSerialization.exe</Path>
<Arguments>adobe_prtk --tool=VolumeSerialize --provfile=[{AppVPackageRoot}]\..\Scripts\prov.xml</Arguments>
<Wait RollbackOnError="false" />
</StartProcess>
<StartVirtualEnvironment>
<Path>WSCRIPT.EXE</Path>
<Arguments>[{AppVPackageRoot}]\..\Scripts\VFSCACLS.vbs -guid 6d0756af-b755-493b-8cee-4299e8666978 -error -name "Adobe Photoshop CS6"</Arguments>
<Wait RollbackOnError="false" />
</StartVirtualEnvironment>
</UserScripts>
The guys in the build team reckon this is an application issues but I can't see how it can be if the applications runs when manually calling the powersehell commands. Also like I said on the Hosted desktop one minutes the script runs and one minute it does
not.
Can someone help please?Hello,
If deploying the application to the user, and the configuration file is updated as part of the content and distributed to the DPs, and then downloaded to the client and the client is enabled to run scripts - no I never had that issue.
If I had something which didn't work I would usually verify what is on the Distribution Point?
You can download the SCCM 2012 R2 toolkit to verify what is on the DPs;
http://www.microsoft.com/en-us/download/details.aspx?id=36213
If it is deployed to the client - it means you can read the client log-file from SCCM. See the AppEnforce.log as a potential candidate;
http://technet.microsoft.com/en-us/library/hh427342.aspx#BKMK_AppManageLog
If it gets properly parsed by the App-V Client you can check the App-V event logs, see Tim Mangans blog post about enabling further debug-logs;
http://www.tmurgent.com/TMBlog/?p=1247
As I can't see what is happening within your Environment I would redo all the steps and verify what the results were of each step. If one step fails, I would then post what step I had performed up until that point, what the result were of each step and what
was happening within the final step that I would consider a failure.
Nicke Källén | The Knack| Twitter:
@Znackattack -
Passing parameters with spaces to SCCM Run PowerShell Script task
I am working on an OS deployment task sequence in SCCM 2012 R2 with several Run PowerShell Script tasks. Most of them run fine, but I am having trouble with the one I need to pass parameters to.
The parameters I need to pass are:
-ComputerOU "ou=All Workstations,dc=contoso,dc=com" -GroupDN "cn=Group1,ou=All Groups,dc=contoso,dc=com"
I have that line (with actual DNs) entered in Parameters of the task.
But when the script runs on the target machine, the values of the parameters in the script are truncated at the spaces. $ComputerOU is set to "ou=All" and $GroupDN is set to "cn=Group1,ou=all"
What syntax should I be using the Parameters field of the Task in order to properly pass PowerShell parameter string values that include spaces?
Tim Curwick
MadWithPowerShell.comThank you, TC, but I am not calling the parameters from within PowerShell.
The parameters are in the settings of a task sequence task to be used by the task to launch a script. The syntax I am using would be correct for use within PowerShell or from a command line or batch script, but SCCM appears to be doing some parsing
before or while it is passing them to the script, possibly dropping the quotes which causes mishandling of the spaces in the string values.
Historically, it is always challenging to give one application parameters to pass to another application, and the required syntax can get quite tricky when the two application handle quotes or spaces differently, or when the parent application wants to parse
something intended to be passed on as is to the child application.
I'm sure someone has already figured out what the syntax needs to be for doing this with an SCCM 'Run PowerShell Script" task, it's just one of those issues that is hard to Google effectively.
Any other ideas?
Tim Curwick
MadWithPowerShell.com -
Issue with Generate Create Script in new ODT 11.1.0.6.10 beta
I've tried this on several tables in my database. I choose Generate Script to ... a file, for a given table it gives me the error message "An error occurred while writing to fil: \nValue was either too large or too smal for an Int32."
(It doesn't matter if I'm in a Oracle database project or some other project.)
Trying to Generate Script To Project... when I'm in a Oracle Database Project, Visual Studio (2005) crashes. It appears to be some overflow exception according to crashinfo:
EventType : clr20r3 P1 : devenv.exe P2 : 8.0.50727.762 P3 : 45716759
P4 : mscorlib P5 : 2.0.0.0 P6 : 461eee3d P7 : 407b P8 : a3
P9 : system.overflowexception
(With ODT 11.1.0.5.10 beta it worked fine dispite the issue discussed in thread: Re: Issue with Generate Create Script in new ODT 11.1.0.5.10 beta
/TomasTried to debug this error and got these exception details. Hope it helps!
/Tomas
System.OverflowException was unhandled
Message="Value was either too large or too small for an Int32."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.Decimal.ToInt32(Decimal d)
at System.Decimal.op_Explicit(Decimal value)
at Oracle.Management.Omo.TableSpaceQuotaDetails.FillTableSpaceQuota(OracleDataReader reader)
at Oracle.Management.Omo.User.FillTableSpaceQuotas(OracleDataReader reader)
at Oracle.Management.Omo.Connection.GetUserCollection(Boolean refresh)
at Oracle.Management.Omo.Connection.GetUsers(Boolean refresh)
at Oracle.Management.Omo.TableSQLGenerator.GetCreateSQLs(OmoObject obj, ArrayList& typeAndNames, Boolean checkRequired, Boolean appendSchemaName)
at Oracle.Management.Omo.TableViewBase.GetCreateSQLs(Boolean appendSchemaName)
at Oracle.VsDevTools.OracleUILDBProjectServices.GenerateCreateScript(OracleUILConnCtx connCtx, String[] objectNames, String objectOwner, OracleUILObjectType objectType)
at Oracle.VsDevTools.OracleUILDBProjectServices.GenerateCreateScriptAsyncMethod(IntPtr ppvObj, OracleUILConnCtx connCtx, String[] objectNames, String objectOwner, OracleUILObjectType objectType, ICollection& scriptText)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at Oracle.VsDevTools.OracleUILDBProjectServices.GenerateScriptAsyncMethodDelegate.EndInvoke(ICollection& scriptText, IAsyncResult result)
at Oracle.VsDevTools.OracleUILDBProjectServices.OnGenerateScriptAsyncCompletion(IAsyncResult ar)
at System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(IMessage msg)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(Object o)
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state) -
Run Powershell Script task sequence
Hi,
Anyone have good documentation on how to use the Run PowerShell Script task sequence ?
ThanksIf you are just interested in running a powershell command without creating a package, you can do this with the the Command line step by using this format in the command line:
PowerShell -ExecutionPolicy bypass -Command "& {your powershell commands}"
Here is an example of a multiline command to increase the agents cache size. Notice the ";"'s which are used to delineate a new line.
PowerShell -ExecutionPolicy bypass -Command "& {$UIResourceM gr = New-Object -ComObject UIResource.UIResourceMgr;$Cache = $UIResourceMgr.GetC acheInfo();$Cache.TotalSize = "20480"}" -
Need Help with running expect script on MAC OS
Hi Guys,
I'm having an issue with running an expect script on my Mac Mini with Mac OS x 10.7.5. I think the script is correct but the not sure why its not working.
The script is as below and also teh error from Xtern or terminal when i try to run it.
#!/usr/bin/expect
set telnetAddr "172.22.22.254"
set telnetAddr1 "172.22.22.252"
set username "ww"
set passwords "ww"
set enablepassword "ww"
spawn telnet $telnetAddr
expect "Username: "
send "username\r"
expect "Password: "
send "$passwords\r"
expect "Orange-ISRGW>"
send "enable\r"
expect "Password: "
send "$enablepassword\r"
expect "Orange-ISRGW#"
send "sh flash\r"
expect "Orange-ISRGW#"
send "delete flash:c1140-k9w7-tar.default.JAR\r"
expect "Delete flash:/c1140-k9w7-tar.default.JAR? [confirm]"
send "\r"
expect "Orange-ISRGW#"
send "exit/r"
interact
here is what happens when i try to run it. This is just a test script before i re-write it to do what i intened to use it for.
sh-3.2# ls -al Text-Script.txt
-rwxrwxrwx@ 1 root wheel 592 Dec 6 08:36 Text-Script.txt
sh-3.2# more Text-Script.txt
#/!/usr/bin/expect -f
set telnetAddr "172.22.22.254"
set username "ww"
set passwords "ww"
set enablepassword "ww"
spawn telnet $telnetAddr
expect "Username: "
send "username\r"
expect "Password: "
send "$passwords\r"
expect "Orange-ISRGW>"
send "enable\r"
expect "Password: "
send "$enablepassword\r"
expect "Orange-ISRGW#"
send "term length 0\r"
expect "Orange-ISRGW#"
send "sh flash\r"
expect "Orange-ISRGW#"
send "delete flash:c1140-k9w7-tar.default.JAR\r"
expect "Delete flash:/c1140-k9w7-tar.default.JAR? [confirm]"
send "\r"
expect "Orange-ISRGW#"
send "exit/r"
sh-3.2#
sh-3.2# pwd
/usr/bin
sh-3.2# Text-Script.txt
/usr/bin/Text-Script.txt: line 8: spawn: command not found
couldn't read file "Username: ": no such file or directory
/usr/bin/Text-Script.txt: line 10: send: command not found
": no such file or directory:
/usr/bin/Text-Script.txt: line 12: send: command not found
": no such file or directorySRGW>
/usr/bin/Text-Script.txt: line 14: send: command not found
couldn't read file "Password: ": no such file or directory
/usr/bin/Text-Script.txt: line 16: send: command not found
": no such file or directorySRGW#
/usr/bin/Text-Script.txt: line 18: send: command not found
": no such file or directorySRGW#
/usr/bin/Text-Script.txt: line 20: send: command not found
": no such file or directorySRGW#
/usr/bin/Text-Script.txt: line 22: send: command not found
": no such file or directorylash:/c1140-k9w7-tar.default.JAR? [confirm]
/usr/bin/Text-Script.txt: line 24: send: command not found
": no such file or directorySRGW#
/usr/bin/Text-Script.txt: line 26: send: command not found
sh-3.2#
sh-3.2#
sh-3.2# ./Text-Script.txt
./Text-Script.txt: line 8: spawn: command not found
couldn't read file "Username: ": no such file or directory
./Text-Script.txt: line 10: send: command not found
": no such file or directory:
./Text-Script.txt: line 12: send: command not found
": no such file or directorySRGW>
./Text-Script.txt: line 14: send: command not found
couldn't read file "Password: ": no such file or directory
./Text-Script.txt: line 16: send: command not found
": no such file or directorySRGW#
./Text-Script.txt: line 18: send: command not found
": no such file or directorySRGW#
./Text-Script.txt: line 20: send: command not found
": no such file or directorySRGW#
./Text-Script.txt: line 22: send: command not found
": no such file or directorylash:/c1140-k9w7-tar.default.JAR? [confirm]
./Text-Script.txt: line 24: send: command not found
": no such file or directorySRGW#
./Text-Script.txt: line 26: send: command not found
sh-3.2#Works like a Charm after making the change suggested ..
macminiserver:ExpectScript Tola$ more Text-Script.txt
#! /usr/bin/expect -f
set telnetAddr "172.22.22.254"
set username "ww"
set passwords "ww"
set enablepassword "ww"
spawn telnet $telnetAddr
expect "Username: "
send "$username\r"
expect "Password: "
send "$passwords\r"
expect "Orange-ISRGW>"
send "enable\r"
expect "Password: "
send "$enablepassword\r"
expect "Orange-ISRGW#"
send "term length 0\r"
expect "Orange-ISRGW#"
send "sh flash\r"
expect "Orange-ISRGW#"
send "delete flash:c1140-k9w7-tar.default.JAR\r"
send "\r"
expect "Orange-ISRGW#"
send "sh flash\r"
interact
macminiserver:ExpectScript Tola$ ./Text-Script.txt
spawn telnet 172.22.22.254
Trying 172.22.22.254...
Connected to 172.22.22.254.
Escape character is '^]'.
User Access Verification
Username: ww
Password:
Orange-ISRGW>enable
Password:
Orange-ISRGW#term length 0
Orange-ISRGW#sh flash
-#- --length-- -----date/time------ path
2 1440 Oct 24 2013 11:23:26 -07:00 vlan.dat
3 63714548 May 3 2010 11:49:40 -07:00 c2800nm-adventerprisek9_ivs_li-mz.151-1.T.bin
5 67871024 Nov 9 2012 19:05:24 -08:00 c2800nm-adventerprisek9-mz.151-4.M5.bin
124751872 bytes available (131600384 bytes used)
Orange-ISRGW#delete flash:c1140-k9w7-tar.default.JAR
Delete flash:/c1140-k9w7-tar.default.JAR? [confirm]
%Error deleting flash:/c1140-k9w7-tar.default.JAR (File not found)
Orange-ISRGW#sh flash
-#- --length-- -----date/time------ path
2 1440 Oct 24 2013 11:23:26 -07:00 vlan.dat
3 63714548 May 3 2010 11:49:40 -07:00 c2800nm-adventerprisek9_ivs_li-mz.151-1.T.bin
5 67871024 Nov 9 2012 19:05:24 -08:00 c2800nm-adventerprisek9-mz.151-4.M5.bin
124751872 bytes available (131600384 bytes used)
Orange-ISRGW# -
OSD - Task Sequence to run powershell script
Hello,
I'm building up an image with OSD and will be layering some components to meet our needs with some powershell scripts. At the moment we will not have this device add itself to the domain so it'll be in a workgroup. The scripts are on a share that everyone has
read access to. Should I add a task sequence that will map a drive letter with domain credentials and have the task sequence call the script from that drive letter?That is possible to do, but why would you not create a package/application with the script and let it download and run locally?
Daniel Ratliff | http://www.PotentEngineer.com -
HT3131 Are there any ventilation issues with running a macbook air in clamshell mode?
Are there any ventilation issues with running a macbook air in clamshell mode?
...that makes sense to me.
but, why do so many MBA users (on this forum and others) claim that ventilation occurs through the keyboard? Is this claim based on an old macbook design?
for example, here's a related discussion (although fairly old):
11-08-2010, 12:16 PM
#6 (permalink)
SP Forsythe
Notebook Evangelist
Join Date: Jul 2007
Location: California
Posts: 660
Rep Power: 14
Re: Is it safe to use MBP with screen lid closed? Leave charge on always?
Quote:
Originally Posted by tHE j0KER
Actually I you shouldn't close the lid while running on an external screen. The keyboard of the Macbook is an air intake for the fan. Close the lid, and it could overheat.
A common misconception of unknown origin. The intake and the exhaust for the cooling fan on the 13" MB and MBP are both located on the rear slot at the base of the hinge. In fact, you can actually see the divider that separates the intake flow from the output flow. If it were through the keyboard crevices, then an awful lot of overheats would result from people using impermeable keyboard covers, as well as Apple's warranty department would be flipping out over the Apple store carrying such covers. iSkin ProTouch FX Keyboard Cover for all MacBooks - Black Printed Keys on White - Apple Store (U.S.)
Does one think that Apple sells these only for use when the Notebook is off??? http://store.apple.com/us/product/TW...co=MTM3OTUwMDE Closing the lid, whilst operating the unit actually results in cooler operation due to reduction in power consumed by operating the display, which in supporting the on-board display generates heat far greater than simply powering the video port..
Does one think that Apple sells these for use only when the MacBook is off? http://store.apple.com/us/product/TW...co=MTM3OTUwMDEApples direction for use is specifically for when using with an external display.
Currently using:
Apple MacBook Air 13" mid 2011 1.8GHz Core i7 4GB 256 GB SSD Lion & Ubuntu Linux via Fusion
MacBook Air 11.6" late 2010 1.6 GHZ, 320M, 4GB 180 GB SSD Upgraded OWC), OS X Lion
11-08-2010, 02:34 PM
#7 (permalink)
ajreynol
Notebook Virtuoso
Join Date: Mar 2009
Location: Ann Arbor, MI
Posts: 2,542
Rep Power: 18
Re: Is it safe to use MBP with screen lid closed? Leave charge on always?
once again, I've tried a few of these keyboard covers. the Moshi keyboard cover is the ONLY one I can recommend. the others are too thick or change the keyboard experience too much.
17" Apple MacBook Pro | i7 2720m | 160GB SSD + 750GB | 16GB | HD 6750M 1GB
Dell 435MT | i7 920 | 10GB RAM | 7.64TB HDDs | HD 6970 | Win7+SL
HP Elitebook 2710p Tablet PC | 1.8GHz C2D | 4GB RAM | 160GB HDD | X3100
Apple iPhone 4 32GB | Apple iPad 64GB (Gen 3)
Stop random laptop wakeup | 5K500.B bench data | How to Disable PowerMiser
Disable Vaio beep when pressing volume or special keys
11-08-2010, 03:34 PM
#8 (permalink)
doh123
Without ME its just AWESO
Join Date: Feb 2009
Posts: 3,282
Rep Power: 22
Re: Is it safe to use MBP with screen lid closed? Leave charge on always?
1. Closing the cover will cause more heat. This is not because of covering the keyboard very much (though it does help some heat be retained). It's mainly because of the shape of the hinge and the fact when closed it covers up the back vent a lot more. For the best cooling, it is best to have the screen open. Just run it as a dual monitor, but make the external the Primary monitor, and if you don't want to use the built in, just turn its backlight off and don't use it.
2. The thing you plug into the wall is not a battery charger. The actual "charger" is built into the computer. It knows when to charge and when not to. If the little light on the power plug is amber, then its charging your battery. When its green, its just powering the laptop and NOT charging your battery at all.
Mac OS X Gamer/Porter
(We do exist!)
Wineskin 2.5 is available!. Turn Windows apps into Mac apps for free!
11-08-2010, 03:38 PM
#9 (permalink)
Wolfpup
Notebook Virtuoso
Join Date: Jun 2007
Posts: 3,871
Rep Power: 28
Re: Is it safe to use MBP with screen lid closed? Leave charge on always?
I'd leave the lid open, at least partially...yes it may be fine not doing that, but you are making heat dissipate worse, of course could even theoretically hurt the screen.
As for the battery...well there's really only two choices, have it plugged in or not. As others mentioned, you can't overcharge the battery. It can be damaged a bit from heat, but of course the number one thing that's going to damage it is discharging it...so it's a no brainer-use it plugged in whenever possible, and try to charge it whenever possible when it's not plugged in.
11-08-2010, 03:45 PM
#10 (permalink)
SP Forsythe
Notebook Evangelist
Join Date: Jul 2007
Location: California
Posts: 660
Rep Power: 14
Re: Is it safe to use MBP with screen lid closed? Leave charge on always?
Quote:
Originally Posted by doh123
1. Closing the cover will cause more heat. This is not because of covering the keyboard very much (though it does help some heat be retained). It's mainly because of the shape of the hinge and the fact when closed it covers up the back vent a lot more. For the best cooling, it is best to have the screen open. Just run it as a dual monitor, but make the external the Primary monitor, and if you don't want to use the built in, just turn its backlight off and don't use it.
Nope. Apple would disagree with you on that one. Any "closure", which is, when compared to the amount of CFM, is insignificant. In fact, the opening size remains the same. it is only deflected at a slight angle when the lid is closed. Tilt your MBP and see. As well, shutting down the display lowers the heat being generated, even in the lower case. As I said, if it were a problem, Apple would not be selling stands designed to operate your unit in the closed position as the original poster of this thread proposes to do.
Currently using:
Apple MacBook Air 13" mid 2011 1.8GHz Core i7 4GB 256 GB SSD Lion & Ubuntu Linux via Fusion
MacBook Air 11.6" late 2010 1.6 GHZ, 320M, 4GB 180 GB SSD Upgraded OWC), OS X Lion -
Issue with running redistributeactivedatabases.ps1 in new-pssession
Hi,
I am stuck with the issue to run redistributeactivedatabases.ps1 in new-pssession.
Is there any best pratice or some other script to redistribute the mailbox databases using new-pssessionHi Jrv,
I am sorry for not being very clear.
Also i know what i am trying is not very sane but i cannot help it as i got order that i have to achive this.
Below are the exact suitation.
We have JP1 server (Automation) which we use to reboot/failover/failback.
I have to automate failover and failback scripts. I am able to achive failover part as it is simple command
Move-ActiveMailboxDatabase -server servername
and it is working.
For failback and automatic rebalance mailbox database according to the activation preference i am using below script which i have to run using cmd.
$mbxs =
Get-MailboxDatabase
| sort name
ForEach($mbx
in $mbxs){
$MBdb=$mbx.Name
$ServerHosting=$mbx.Server.Name
if($mbx.activationPreference.value
-eq 1)
If
($ServerHosting -ne $ActivationPreference.Key.Name){
Move-ActiveMailboxDatabase $MBdb
-ActivateOnServer $ActivationPreference.Key.Name
-confirm:$False
But the problem i am getting is that script is not working when i am running this in cmd or in powershell.
But if i run the same script on Exchange server using Exchange Management shell then there are no issues.
So, i need your help so that i can run above script using cmd in new-pssession.
Hopefully i am able to make some sense now. -
I am trying to run a PowerShell script to upload files into a SharePoint site in an Azure environment...the script works fine on my local machine, but every time I run it in Azure (remotely), I get errors. Here is what my simple script looks like...
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
Write-Host "Loading Sharepoint Module "
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
Add-PSSnapin -Name Microsoft.SharePoint.PowerShell
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell) -eq $null )
Write-Host "Failed to load sharepoint snap-in. Could not proceed further, Aborting ..."
Exit
#Script settings
$webUrl = "http://sampleWebUrl"
$docLibraryName = "My Documents"
$docLibraryUrlName = "My%20Documents"
$localFolderPath = get-childitem "C:\Upload\Test Upload\My Documents\" -recurse
$contentType = "ContenttType1"
#Open web and library
$web = Get-SPWeb $webUrl
write-host "Web:" $web
$docLibrary = $web.Lists[$docLibraryName]
write-host "docLibrary:" $docLibrary
$files = ([System.IO.DirectoryInfo] (Get-Item $localFolderPath)).GetFiles()
write-host "files:" $files
If ($contentType = "ContenttType1")
#Open file
$fileStream = ([System.IO.FileInfo] (Get-Item $file.FullName)).OpenRead()
# Gather the file name
$FileName = $File.Name
#remove file extension
$NewName = [IO.Path]::GetFileNameWithoutExtension($FileName)
#split the file name by the "-" character
$FileNameArray = $NewName.split("_")
$check = $FileNameArray.Length
#Add file
$folder = $web.getfolder($docLibrary.rootFolder.URL)
write-host "Copying file " $file.Name " to " $folder.ServerRelativeUrl "..."
$spFile = $folder.Files.Add($folder.Url + "/" + $file.Name, [System.IO.Stream]$fileStream, $true)
$spItem = $spFile.Item
write-host "Success"
write-host "SP File:" $spFile
write-host "SP Item" $spItem
#populate columns
$spItem["Column1"] = $FileNameArray[0]
$spItem["Column2"] = $FileNameArray[1]
$spItem.Update()
$fileStream.Close();
Again, I can run this on my local machine and it works just fine, but when I attempt to run it on the Azure environment I get this error...
Get-Item : Cannot find path 'C:\powershellscripts\12653_B7045.PDF' because it does not exist.
At C:\PowerShellScripts\Upload-FilesIntoSharePointTester.ps1:32 char:42
+ $files = ([System.IO.DirectoryInfo] (Get-Item $localFolderPath)).GetFiles()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\powershellscripts\12653_B7045.PDF:String) [Get-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand
What strikes me first is the fact that the file its looking for is in the "C:\Upload\Test Upload\My Documents\" directory, but the error keeps saying "C:\powershellscripts\" which is where my script resides and not the files I want to
upload into SharePoint. When I step through the code, all the variables are holding the correct values. The $localFolderPath shows the name of files that I am attempting to upload, so it recognizes them. But once I step through this particular line of code,
the error occurs...
$files = ([System.IO.DirectoryInfo] (Get-Item $localFolderPath)).GetFiles()
Is this an error caused because I am remoting into the Azure environment? Has anyone dealt with this issue before? I would really appreciate the help. Thanks
Update: quick thing I noticed is that these two lines of code are returning null values. Again, is this handled differently in Azure or remotely? I ask cause this is the way I know how to do this, locally.
$docLibrary = $web.Lists[$docLibraryName]
$files = ([System.IO.DirectoryInfo] (Get-Item $localFolderPath)).GetFiles()"...square brackets are wildcard characters in Windows PowerShell..."
When you use cd without a parameter it uses the -Path parameter. In this case you'll have to escape the square brackets so they are not considered wildcards. Each of the commands in the first example does the exact same thing.
cd 'Learn PowerShell `[Do Whatever`]'
cd -Path 'Learn PowerShell `[Do Whatever`]'
cd (or Set-Location) also has a literal path parameter (-LiteralPath) that does not require using an escape character (`) before each of the brackets. Hope this helps.
cd -LiteralPath 'Learn PowerShell [Do Whatever]' -
Run PowerShell script from C# writing to input pipe
Hello,
I am trying to run a PowerShell script from C# (I have no control over what's in the script). The script may have a prompt like "Press enter to continue". So my goal is:
1. Get text output from the script (easy, many examples available)
3. If output contains "Press enter to continue", write a blank line to the running script's pipe to make it finish its job and quit
4. If output does contain that prompt, just let it exit by itself without sending any input
Note that commands in this PS script also try to get at script's file path, so I can't read script from file and pass it as text. It has to be executed as a script so it knows where it's located.
I have done this with .exes and batch files before. All you do in that case is process.StandardInput.WriteLine() which "types" enter into the input stream of script you are trying to control. But this does not work with Power Shell. How do I do this?
I have tried using PS object model like so:
using (Pipeline pipeline = runspace.CreatePipeline())
Command command = new Command(scriptPS, true, true);
pipeline.Commands.Add(command);
pipeline.Commands[0].MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output);
pipeline.Input.Write("\n");
Collection<PSObject> psresults = pipeline.Invoke(); //...
But I get an error because the script prompts:
"A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related
commands from command types that do not support user interaction, such as Windows PowerShell workflows."
I also tried using Process, and running PowerShell with -File switch to execute the script, then write to StandardInput with C#. I get no errors then, but the input is ignored and doesn't make it to PowerShell.
Please help!No man, what kind of answer is that? You should have left it unanswered rather than waste people's time like this. I already seen those links before I posted my question. They address the issue of specifying script parameters, but not
writing to the input pipe.
Fortunately I did figure this out by writing a custom script host for PowerShell. Anyone interested can read about this in detail on MSDN (fortunately simple material with samples you can copy paste as I did, so this solution takes little time to implement).
Implement PSHost interface. Nothing special here, just paste directly from MSDN sample and modify their SetShouldExit function definition to contain just a "return;". Here's the relevant link:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee706559(v=vs.85).aspx
Implement PSHostUserInterface interface. This is the ticket to solving this problem
(see below). Here's the MSDN link:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee706584(v=vs.85).aspx
Implement PSHostRawUserInterface. This may not be required (not sure) but I did anyway. Nearly a direct paste from MSDN:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee706601(v=vs.85).aspx
So, there are two PSHostUserInterface function implementations that are of particular interest. First is Prompt (read header comment to see why):
/// <summary>
/// When script attempts to get user input, we override it and give it input programmatically,
/// by looking up within promptInput's dictionary<string,string> or lineInput array.
/// PromptInput dictionary is mapped by input prompt (for example, return "" in response to "Press ENTER to continue")
/// LineInput is a regular array, and each time the script wants to prompt for input we return the next line in that array;
/// this works much like piping inputs from a regular text file in DOS command line.
/// </summary>
/// <param name="caption">The caption or title of the prompt.</param>
/// <param name="message">The text of the prompt.</param>
/// <param name="descriptions">A collection of FieldDescription objects that
/// describe each field of the prompt.</param>
/// <returns>Throws a NotImplementedException exception.</returns>
public override Dictionary<string, PSObject> Prompt(string caption, string message, System.Collections.ObjectModel.Collection<FieldDescription> descriptions)
Dictionary<string, PSObject> ret = new Dictionary<string, PSObject>();
foreach (FieldDescription desc in descriptions)
if (this.promptInput.Count != 0)
ret[desc.Name] = new PSObject(this.promptInput[desc.Name] + "\r\n");
else if (this.lineInput != null && this.currentLineInput >= 0 && this.currentLineInput < this.lineInput.Length)
ret[desc.Name] = new PSObject(this.lineInput[this.currentLineInput++] + "\r\n");
else
if (desc.DefaultValue == null)
ret[desc.Name] = new PSObject("\r\n");
else
ret[desc.Name] = new PSObject(desc.DefaultValue);
return ret;
Next is PromptForChoice. Here I opted to always return the default choice, but you could rewrite it to read from somewhere to "simulate" reading from input pipe just like the function above:
public override int PromptForChoice(string caption, string message, System.Collections.ObjectModel.Collection<ChoiceDescription> choices, int defaultChoice)
return defaultChoice;
Last but not least, here's a ReadLine implementation (again read header comment):
/// <summary>
/// If the LineInput is set, "read" the next line from line input string array, incrementing line pointer/// </summary>
/// <returns>The characters that are entered by the user.</returns>
public override string ReadLine()
if (this.lineInput != null && this.currentLineInput >= 0 && this.currentLineInput < this.lineInput.Length)
return this.lineInput[this.currentLineInput++];
else
return Console.ReadLine();
Both are exposed as properties:
/// <summary>
/// Gets or sets the input pipe override
/// </summary>
public string Input
get
return string.Join("\n", this.lineInput);
set
if (value != null)
this.lineInput = value.Split('\n');
this.currentLineInput = 0;
else
this.lineInput = null;
/// <summary>
/// Gets or sets input pipe override for named prompts
/// </summary>
public Dictionary<string, string> PromptInput
get
return this.promptInput;
set
this.promptInput = value;
And finally, here's how the whole shebang is used:
/// <summary>
/// Runs a powershell script, with input pipe arguments
/// </summary>
/// <param name="script">Path of the script to execute, or script text</param>
/// <param name="inline">Whether or not to execute script text directly, or execute script from path</param>
/// <param name="unrestricted">Whether or not to set unrestricted execution policy</param>
/// <param name="parameters">Parameters to pass to the script command line</param>
/// <param name="inputOverride">Input to pass into the script's input pipe</param>
/// <param name="inputOverrideName">Input to pass into the script's input pipe, to each prompt by label</param>
/// <returns>Output lines</returns>
public static string PowerShell(string script, bool inline, bool unrestricted = false, Dictionary<string, string> parameters = null, string inputOverride = null, Dictionary<string, string> inputOverrideByName = null)
string output = null;
ScriptHost host = new ScriptHost();
(host.UI as ScriptHostUserInterface).Input = inputOverride;
(host.UI as ScriptHostUserInterface).PromptInput = inputOverrideByName;
using (Runspace runspace = RunspaceFactory.CreateRunspace(host))
runspace.Open();
if (unrestricted)
RunspaceInvoke runSpaceInvoker = new RunspaceInvoke(runspace);
runSpaceInvoker.Invoke("Set-ExecutionPolicy Unrestricted");
using (Pipeline pipeline = runspace.CreatePipeline())
if (inline)
pipeline.Commands.AddScript(script);
else
Command command = new Command(script, true, true);
foreach (KeyValuePair<string, string> param in parameters)
command.Parameters.Add(param.Key, param.Value);
pipeline.Commands.Add(command);
pipeline.Commands.Add("Out-String");
pipeline.Commands[0].MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output);
Collection<PSObject> psresults = pipeline.Invoke();
var sb = new StringBuilder();
foreach (PSObject obj in psresults)
sb.AppendLine(obj.ToString());
output = sb.ToString();
pipeline.Dispose();
runspace.Close();
return (host.UI as ScriptHostUserInterface).Output + "\r\n" + output;
As you can see, I also did some magic with the .Output property. That just accumulates lines of text output by the script in every WriteXXX function implemented in your custom PSHostUserInterface. The end result of all this, is that if you have a script
that has prompts, choices or reads from standard input, you can execute the script within the context of your custom script host written as above, to control precisely what strings are passed to it in response to prompts.
-
Issue with Generate Create Script in new ODT 11.1.0.5.10 beta
So I'm trying to determine if there's an issue with the Generate Create Script option in the new ODT 11.1.0.5.10 beta (when you right click on a table in Server Explorer).
The SQL create script that it generates lacks the slash between lines. For example I generated the create script for my User table and this is what was generated:
CREATE TABLE "DEV"."SYSTEM_USER_TB" ("RID" NUMBER(10,0),"USER_NAME" VARCHAR2(256 CHAR),"APPLICATION_RID" NUMBER(10,0),"FIRST_NAME" VARCHAR2(256 CHAR),"LAST_NAME" VARCHAR2(256 CHAR),"PW" VARCHAR2(128 CHAR),"PW_FORMAT" NUMBER,"PW_SALT" VARCHAR2(128 CHAR),"LAST_ACTIVITY_DT" DATE,"EXPIRATION_DT" DATE,"EMAIL" VARCHAR2(256 CHAR),"PW_QUESTION" VARCHAR2(256 CHAR),"PW_ANSWER" VARCHAR2(256 CHAR),"APPROVED_FLG" NUMBER(1,0),"LOCKED_OUT_FLG" NUMBER(1,0),"LAST_LOGIN_DT" DATE,"LAST_PW_CHANGED_DT" DATE,"LAST_LOCKOUT_DT" DATE,"FAILED_PW_ATTEMPT_CNT" NUMBER(6,0),"FAILED_PW_ATTEMPT_WINSTART" DATE,"FAILED_PW_ANSW_ATTEMPT_CNT" NUMBER(8,0),"FAILED_PW_ANSW_ATTEMPT_WINSTRT" DATE,"CREATED_BY_RID" NUMBER(10,0),"CREATED_DT" DATE,"MODIFIED_BY_RID" NUMBER(10,0),"MODIFIED_DT" DATE) TABLESPACE "USERS" PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 131072 MAXEXTENTS 2147483645 MINEXTENTS 1 )
CREATE UNIQUE INDEX "DEV"."XPKSTAFF" ON "DEV"."SYSTEM_USER_TB" ("RID" ) TABLESPACE "USERS"
ALTER TABLE "DEV"."SYSTEM_USER_TB" ADD ( CONSTRAINT "SYS_C0033033" PRIMARY KEY ("RID") USING INDEX "DEV"."XPKSTAFF" ENABLE VALIDATE )
ALTER TABLE "DEV"."SYSTEM_USER_TB" ADD ( CONSTRAINT "SYS_C0033032" CHECK ("RID" IS NOT NULL) ENABLE VALIDATE )
CREATE TRIGGER "DEV"."SYSTEM_USER_TRG1"
BEFORE
INSERT
ON "DEV"."SYSTEM_USER_TB"
FOR EACH ROW
begin
select SYSTEM_USER_SEQ.nextval into :new.RID from dual;
end;
In my new Oracle Database Project, if I right click on the script and select "Run" or "Run On", the script fails saying:
Connected.
CREATE UNIQUE INDEX "DEV"."XPKSTAFF" ON "DEV"."SYSTEM_USER_TB" ("RID" ) TABLESPACE "USERS"
ERROR at line 2:
ORA-00922: missing or invalid option
If I then add, a slash between lines, the script runs successfully and creates the table/trigger and whatever else just fine. For example, I changed the above generated code to look as follows:
CREATE TABLE "DEV"."SYSTEM_USER_TB" ("RID" NUMBER(10,0),"USER_NAME" VARCHAR2(256 CHAR),"APPLICATION_RID" NUMBER(10,0),"FIRST_NAME" VARCHAR2(256 CHAR),"LAST_NAME" VARCHAR2(256 CHAR),"PW" VARCHAR2(128 CHAR),"PW_FORMAT" NUMBER,"PW_SALT" VARCHAR2(128 CHAR),"LAST_ACTIVITY_DT" DATE,"EXPIRATION_DT" DATE,"EMAIL" VARCHAR2(256 CHAR),"PW_QUESTION" VARCHAR2(256 CHAR),"PW_ANSWER" VARCHAR2(256 CHAR),"APPROVED_FLG" NUMBER(1,0),"LOCKED_OUT_FLG" NUMBER(1,0),"LAST_LOGIN_DT" DATE,"LAST_PW_CHANGED_DT" DATE,"LAST_LOCKOUT_DT" DATE,"FAILED_PW_ATTEMPT_CNT" NUMBER(6,0),"FAILED_PW_ATTEMPT_WINSTART" DATE,"FAILED_PW_ANSW_ATTEMPT_CNT" NUMBER(8,0),"FAILED_PW_ANSW_ATTEMPT_WINSTRT" DATE,"CREATED_BY_RID" NUMBER(10,0),"CREATED_DT" DATE,"MODIFIED_BY_RID" NUMBER(10,0),"MODIFIED_DT" DATE) TABLESPACE "USERS" PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 131072 MAXEXTENTS 2147483645 MINEXTENTS 1 )
CREATE UNIQUE INDEX "DEV"."XPKSTAFF" ON "DEV"."SYSTEM_USER_TB" ("RID" ) TABLESPACE "USERS"
ALTER TABLE "DEV"."SYSTEM_USER_TB" ADD ( CONSTRAINT "SYS_C0033033" PRIMARY KEY ("RID") USING INDEX "DEV"."XPKSTAFF" ENABLE VALIDATE )
ALTER TABLE "DEV"."SYSTEM_USER_TB" ADD ( CONSTRAINT "SYS_C0033032" CHECK ("RID" IS NOT NULL) ENABLE VALIDATE )
CREATE TRIGGER "DEV"."SYSTEM_USER_TRG1"
BEFORE
INSERT
ON "DEV"."SYSTEM_USER_TB"
FOR EACH ROW
begin
select SYSTEM_USER_SEQ.nextval into :new.RID from dual;
end;
So, does anyone know if this is a bug? Could I be missing an option to add in the slashes to the generated code? Is there an option to not require the slashes? Could there be another way to execute these scripts?
Seriously, I think I'm having deja vu from the last release of the Dev Tools: Generate Create Script creates scripts that won't run: ORA-00922: missing..
...except this time the documentation says I should be able to use the "Run" and "Run On" commands in the Oracle Database Project (see page 8): http://www.oracle.com/technology/tech/dotnet/pdf/ODT11_whatsnew.pdf
nullThere are 2 issues in the generated script :
1. Missing semicolons at the end of the create stmts
2. Missing slashes
Both of these fixes will be available in the ODT 11.1 release.
Maybe you are looking for
-
Office 2010 & 2007 - Excel and Access File Locking Out On the Network With Multiple Users
This is also posted in the Office 2010 - IT Pro General Discussions, but was suggested to repost here, since a definitive answer was not found. Hi, An issue that's happening is that Excel and Access files are locking on the network. We're currently u
-
HP Laserjet Pro 400 Printer unable to print docs using both letter and legal paper
HELP!! Have been using an HP Laserjet Pro 400 M425dn dual tray printer for 2 years, along with a Dell laptop. Always had ability to send documents to print using both letter and legal size paper. Under print set-up on laptop, the option checked wa
-
Hi, after installation of my CS6 Master Collection i noticed that Adobe Bridge istn working. Whats the point: When I try to start the program there's any notification about errors or something. It's just dont loading. Does anybody know what to do? He
-
Duplicate Purchase Order with all fields.
Hi, I need a method to Duplicate a Purchase Order with ALL the fields. I tryed with a SendKey("^D") method but the new instance not copy the IC data. Looking for a better method, I read about the option to Save as XML the selected purchase, but I don
-
I recently Did a windows update to install Internet explorer 9. When my Computer Restarted, I opened Mozilla, because it is my preferred Browser, and pages such as the ones stated above started loading with just text with no layout. I cleared the cac