Command to use commands from list
Hey everybody. I new in powershell. I need to convert mailboxes to shared. The list in txt/exel.
Set-Mailbox -Identity [email protected] -Type Shared
How can I make this command to difference mailboxes from the list?
Thnx.
[System.IO.File]::ReadAllText("C:\scripts\myList.txt") | %{Set-Mailbox -Identity $_ -Type Shared}
Using "ReadAllText" is faster than "Get-Content".
# The fastest Powershell 2 : Read a text file
http://powershell-guru.com/fastest-powershell-2-read-text-file
Of course it's faster. It reads the entire file as one string, with embedded spaces. But that's useless for this application, because you need an array of strings you can iterate through with foreach or ForEach-Object. You'll have to turn
around and split it at the newlines before it can be used for that.
To get an array of strings (one per line) you'd want to use [System.IO.File]::ReadAllLines.
But that isn't really any faster than using Get-Content with a ReadCount of 0.
The author of that web page is doing a lot of apples-and-oranges comparisons.
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Similar Messages
-
Catch chose from list results, & use it
The following script will activate/deactivate layers based on the letter {A, E, D, F} chosen from the list, then export single page (w 3 digits for the page number section) PDF. The problem I have I don't know to trap or cacth the results of whatever is chosen from the list & use it to name the pdf. If file name is ABC01_A_100.indd & the letter chosen from the list is "E" then final pdf should be ABC01_E_100.pdf. If the letter chosen from the list is D then final pdf is ABC_D_100.pdf. Basically what is changing whatever is between the two underscores _?_
I can see the results on the events window. How can I capture the results of whatever is chosen from list? I tried return statement but no success at all.
•Then the other question is if i use choose from list with multiple selection allowed in which I can select more letters: A", "E", "D", "F" how can I output different PDFs with whatever is chosen from the list (with the correct layers activated/deactivated) & file names; ABC01_E_100.pdf, ABC01_F_100.pdf, ABC01_F_100.pdf. See below. Please any input is greatly appreciated.
property myPDFpreset : missing value
set myPDFpreset to "Screen"
set versionLayers to {"A", "E", "D", "F"}
set the_choice to (choose from list versionLayers with prompt "What version do you need?" with multiple selections allowed) as text
set chosenVersionLayer to item 1 of the_choice
-->Activate versions Layers based in what was chosen
if the_choice is false then error number -128
if the_choice is "A" then
myA()
else if the_choice is "E" then
myE()
else if the_choice is "D" then
myD()
else if the_choice is "F" then
myF()
end if
on myA()
tell application "Adobe InDesign CS4"
tell active document
--Activate Layers
set properties of layer "Tive" to {visible:true}
set properties of layer "Logo" to {visible:true}
set properties of layer "Search" to {visible:true}
set properties of layer "Z1" to {visible:true}
--Hide Layers
set properties of layer "Z2" to {visible:false}
set properties of layer "Z3" to {visible:false}
set properties of layer "NS" to {visible:false}
set properties of layer "MD" to {visible:false}
end tell
display alert " A activated"
end tell
end myA
on myE()
tell application "Adobe InDesign CS4"
--set myDocument to active document
tell active document
--Activate Layers
set properties of layer "Tive" to {visible:true}
set properties of layer "Logo" to {visible:true}
set properties of layer "Search" to {visible:true}
set properties of layer "Z2" to {visible:true}
--Hide Layers
set properties of layer "Z1" to {visible:false}
set properties of layer "Z3" to {visible:false}
set properties of layer "NS" to {visible:false}
set properties of layer "MD" to {visible:false}
end tell
display alert " E activated"
end tell
end myE
on myD()
tell application "Adobe InDesign CS4"
--set myDocument to active document
tell active document
--Activate Layers
set properties of layer "Tive" to {visible:true}
set properties of layer "Logo" to {visible:true}
set properties of layer "Z3" to {visible:true}
--Hide Layers
set properties of layer "Z1" to {visible:false}
set properties of layer "Z2" to {visible:false}
set properties of layer "NS" to {visible:false}
set properties of layer "MD" to {visible:false}
set properties of layer "Search" to {visible:false}
end tell
display alert "D activated" giving up after 6
end tell
end myD
on myF()
tell application "Adobe InDesign CS4"
--set myDocument to active document
tell active document
--Activate Layers
set properties of layer "Tive" to {visible:true}
set properties of layer "Logo" to {visible:true}
set properties of layer "Z3" to {visible:true}
set properties of layer "NS" to {visible:true}
--Hide Layers
set properties of layer "Z1" to {visible:false}
set properties of layer "Z2" to {visible:false}
set properties of layer "MD" to {visible:false}
set properties of layer "Search" to {visible:false}
end tell
display alert "F activated" giving up after 6
end tell
end myF
---======================
tell application "Adobe InDesign CS4"
activate
set source_folder to file path of active document --Put the PDFs same folder as ID file
set theName to name of active document
set text item delimiters of AppleScript to {"_"}
set theShortName to text 1 thru text item -2 of theName
--text 1 thru text item -2 is every character from the first character to the second to last text item
set text item delimiters of AppleScript to ""
tell application "Finder"
if (exists folder "PDFs" of folder source_folder) is false then
make folder at source_folder with properties {name:"PDFs"}
end if
end tell
repeat with x from 1 to count pages of active document --single pages
set thePageName to name of page x of active document
set page range of PDF export preferences to thePageName
--section-page number M-U-S-T have 3 digits
set threeDigitPageName to text -3 thru -1 of ("00" & thePageName)
(* text 1 thru 3 are the first 3 characters
text -3 thru -1 are the last 3 characters*)
set theFilePath to source_folder & "PDFs:" & theShortName & "_" & threeDigitPageName & ".pdf" as string
----Export PDF as single pages
tell active document
export format PDF type to theFilePath using myPDFpreset without showing options
end tell
end repeat
end tellThe following script will activate/deactivate layers based on the letter {A, E, D, F} chosen from the list, then export single page (w 3 digits for the page number section) PDF. The problem I have I don't know to trap or cacth the results of whatever is chosen from the list & use it to name the pdf. If file name is ABC01_A_100.indd & the letter chosen from the list is "E" then final pdf should be ABC01_E_100.pdf. If the letter chosen from the list is D then final pdf is ABC_D_100.pdf. Basically what is changing whatever is between the two underscores _?_
I can see the results on the events window. How can I capture the results of whatever is chosen from list? I tried return statement but no success at all.
•Then the other question is if i use choose from list with multiple selection allowed in which I can select more letters: A", "E", "D", "F" how can I output different PDFs with whatever is chosen from the list (with the correct layers activated/deactivated) & file names; ABC01_E_100.pdf, ABC01_F_100.pdf, ABC01_F_100.pdf. See below. Please any input is greatly appreciated.
property myPDFpreset : missing value
set myPDFpreset to "Screen"
set versionLayers to {"A", "E", "D", "F"}
set the_choice to (choose from list versionLayers with prompt "What version do you need?" with multiple selections allowed) as text
set chosenVersionLayer to item 1 of the_choice
-->Activate versions Layers based in what was chosen
if the_choice is false then error number -128
if the_choice is "A" then
myA()
else if the_choice is "E" then
myE()
else if the_choice is "D" then
myD()
else if the_choice is "F" then
myF()
end if
on myA()
tell application "Adobe InDesign CS4"
tell active document
--Activate Layers
set properties of layer "Tive" to {visible:true}
set properties of layer "Logo" to {visible:true}
set properties of layer "Search" to {visible:true}
set properties of layer "Z1" to {visible:true}
--Hide Layers
set properties of layer "Z2" to {visible:false}
set properties of layer "Z3" to {visible:false}
set properties of layer "NS" to {visible:false}
set properties of layer "MD" to {visible:false}
end tell
display alert " A activated"
end tell
end myA
on myE()
tell application "Adobe InDesign CS4"
--set myDocument to active document
tell active document
--Activate Layers
set properties of layer "Tive" to {visible:true}
set properties of layer "Logo" to {visible:true}
set properties of layer "Search" to {visible:true}
set properties of layer "Z2" to {visible:true}
--Hide Layers
set properties of layer "Z1" to {visible:false}
set properties of layer "Z3" to {visible:false}
set properties of layer "NS" to {visible:false}
set properties of layer "MD" to {visible:false}
end tell
display alert " E activated"
end tell
end myE
on myD()
tell application "Adobe InDesign CS4"
--set myDocument to active document
tell active document
--Activate Layers
set properties of layer "Tive" to {visible:true}
set properties of layer "Logo" to {visible:true}
set properties of layer "Z3" to {visible:true}
--Hide Layers
set properties of layer "Z1" to {visible:false}
set properties of layer "Z2" to {visible:false}
set properties of layer "NS" to {visible:false}
set properties of layer "MD" to {visible:false}
set properties of layer "Search" to {visible:false}
end tell
display alert "D activated" giving up after 6
end tell
end myD
on myF()
tell application "Adobe InDesign CS4"
--set myDocument to active document
tell active document
--Activate Layers
set properties of layer "Tive" to {visible:true}
set properties of layer "Logo" to {visible:true}
set properties of layer "Z3" to {visible:true}
set properties of layer "NS" to {visible:true}
--Hide Layers
set properties of layer "Z1" to {visible:false}
set properties of layer "Z2" to {visible:false}
set properties of layer "MD" to {visible:false}
set properties of layer "Search" to {visible:false}
end tell
display alert "F activated" giving up after 6
end tell
end myF
---======================
tell application "Adobe InDesign CS4"
activate
set source_folder to file path of active document --Put the PDFs same folder as ID file
set theName to name of active document
set text item delimiters of AppleScript to {"_"}
set theShortName to text 1 thru text item -2 of theName
--text 1 thru text item -2 is every character from the first character to the second to last text item
set text item delimiters of AppleScript to ""
tell application "Finder"
if (exists folder "PDFs" of folder source_folder) is false then
make folder at source_folder with properties {name:"PDFs"}
end if
end tell
repeat with x from 1 to count pages of active document --single pages
set thePageName to name of page x of active document
set page range of PDF export preferences to thePageName
--section-page number M-U-S-T have 3 digits
set threeDigitPageName to text -3 thru -1 of ("00" & thePageName)
(* text 1 thru 3 are the first 3 characters
text -3 thru -1 are the last 3 characters*)
set theFilePath to source_folder & "PDFs:" & theShortName & "_" & threeDigitPageName & ".pdf" as string
----Export PDF as single pages
tell active document
export format PDF type to theFilePath using myPDFpreset without showing options
end tell
end repeat
end tell -
Chose from list in internal error?
Hi expert
i want to use chose from list from udf object.
Private Sub LoadingCFL(ByVal oForm As SAPbouiCOM.Form)
Try
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
'Dim oCons As SAPbouiCOM.Conditions
'Dim oCon As SAPbouiCOM.Condition
oCFLs = oForm.ChooseFromLists
Dim oCFL As SAPbouiCOM.ChooseFromList
Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
' Adding 2 CFL, one for the button and one for the edit text.
oCFLCreationParams.MultiSelection = False
oCFLCreationParams.ObjectType = "SM_TPR" ''''''17
'oCFLCreationParams.UniqueID = "CFL1"
'oCFL = oCFLs.Add(oCFLCreationParams)
oCFLCreationParams.UniqueID = "CFL2"
oCFL = oCFLs.Add(oCFLCreationParams)
Catch
' MsgBox(Err.Description)
End Try
End Sub
when i use object no 17..... its showing order chosefrom list.,but when i use user define field object" SM_TPR"
then its error message showing '''''''''''''' internal error-1033
please solve this problem......Hi John
U could have given the object type in the screen painter itself.
-Anto -
Choose from List in A matrix for choosing two or more rows at same time
Hi Friends,
Actually I m using choose from list to select Items in a row, i can select Two or more rows from the List but while clicking choose it is taking only one value.
The no of rows are not activated tat i m choosing from list.
Thanks in advance
VivekHi.
Here is a [link|https://forums.sdn.sap.com/click.jspa?searchID=12829558&messageID=5584893] where are you can find on of my example on CFL on matrix column.
I think, you need to made some changes in code from these lines...
Dim oDataTable As SAPbouiCOM.DataTable
oDataTable = oCFLEvento.SelectedObjects
for ...
end for
Reply if this guideline was usefull for you.
Bye -
i created a form and used validate from list property to TRUE for a particluar item which have LOV.But when table hav too many rows (here i hav 18000 rows) getting too slow....Is this problem is common...? If any one hve any idea about this Please help me...
Edited by: pms on Sep 11, 2011 10:31 PMBut when table hav too many rows (here i hav 18000 rows) getting too slow....Is this problem is common...? Yes, this is common when you have a lot of rows returned by your LOV query. In situations like this, it is best to try and reduce the size of the data returned by your LOV. One way of doing this is to enable the Filter Before Display property on the LOV. When enabled, it causes Forms to display a query criteria dialog before displaying the LOV. This too can cause slowness because this option could cause a full table scan to occur. Perhaps a better option would be to make your LOV dependent on other limiting values. For example, if your Form showed a list of all employees in a company you could make your user select limiting data like a department number to help reduce the number of employee records returned by your LOV.
Craig... -
Get cardname along with cardcode usuing Choose From List Button
Hi,
I am using Choose From List button in my form. If I click the button then I can see the matrix containing business partners list and if I choose any business partner from that list then I can see the business partners id or cardcode from ocrd table in the corresponding textbox.
But I want the business partner's name or cardname also should come simultaneously in the next textbox of my form. Can some one provide me any code help for this process.
Regards,
Sudeshna.Hi Sudesha,
You can get the CardName with the following code:
sCardCode = oDataTable.GetValue(0, 0)
sCardName = oDataTable.GetValue(1, 0)
Hope it helps,
Adele -
How can i install snow leopard on my mac G5 using a command line and booting from an external usb rom, since my disk i have is not a bootable media
Hi.
You simply can't. Snow Leopard is compiled in Intel binary only.
Good Luck. -
Hello,
I need your advise, please. My customer requires to print a specfic page from a pdf document they receive, using command line or 3rd party solution.
Anything you can advise, please? I have seen AcroRD32.exe options, but can only print the whole document.
Kind RegardsNot sure if there are any examples. The Acrobat SDK is a must, but it is best treated as documentation to study rather than examples to copy. The examples only illustrate a tiny fraction of the capabiliies.
(One other note: the solution must involve the client owning Acrobat; Acrobat is not for server use). -
How to use command line with acrobat to extract page(s) from pdf file?
I have adobe acrobat, and have a pdf file with over 500 pages. I need to extract small chunks of pages from it as seperate pdf files. I was hoping I could use command line interface to do this faster.
Something like:
acrobat src des start end
so for example
adobe file.pdf my_folder 3 5
Is this possible? There are many chunks and I don't want to manually do it for every chunk. Command line would be much easier...
ThanksI can't find any programs... sorry.
Can you create one for me please.
It should at least have these 5 arguments: (well the first one is not neccessary since were not using acrobat anymore...)
[program] [src path/src file] [destination path/file name] [start page (inclusive)] [end page (inclusive)]
for example:
acrobat ./my_file.pdf ./my_folder/chunk1.pdf 3 5
if start page == end page, then it only extracts that one page.
So this way I can just stack these comands on a .bat file or something (maybe like 100 commands), then run the bat file, and it will create all the files.
Thanks for doing this, it is appreciated. -
Trying to find a way to execute from command prompt using java....
I want to find a way to execute a command from the command line using a java program this is my code:
import java.io.*;
public class SQLHopefully
public static void main(String[] args)
try{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("cmd /k start cmd.exe");
OutputStream out = proc.getOutputStream();
System.out.println(out);
out.write("test.txt".getBytes()); //I THOUGHT THIS WOULD WORK
InputStream stdin = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stdin);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ( (line = br.readLine()) != null) {
System.out.println(line);
stdin = proc.getInputStream();
isr = new InputStreamReader(stdin);
br = new BufferedReader(isr);
line = null;
while ( (line = br.readLine()) != null) {
System.out.println(line);
int exitVal;
try {
exitVal = proc.waitFor();
} catch (InterruptedException e) {
throw new IOException(e.getMessage());
if (exitVal != 0) {
throw new IOException("Exit value was " + exitVal ");
}catch(IOException e)
{System.out.println("ummmmm");}
I hope my code is readable. I am trying to get the command prompt that comes up from the Runtime.exec() to run a file called "test.txt" I know it would be easier to just do it by executing it from java but I want to see if it is possible this way. I thought the out.write would do the trick but I was wrong. Somebody help please....
NateFirst read this article:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
Second, you should probably send the Enter key to the shell if you want anything to happen. (Not that I know whether it will work, but I do know it won't work if you don't press Enter.) -
Perform NetBeans build steps from command-line using Ant
If I build a project using NetBeans, it creates the lib directory and populates it with dependant .jar's. It also puts the class-path in the manifest file.
If I build using Ant ("ant jar" from build.xml folder), it creates the .jar without the class-path and without the lib folder.
I want to build a simple project from the command-line, using Ant (or anything else that can process the build.xml file without having to modify it outside of NetBeans), and have it produce the same output as NetBeans.
The project is a simple Swing app.
How do I do it?Yes, I'm aware of that - there doesn't seem to be much participation in the NetBeans forum. I did actually ask the same question there with no (timely) response, so I thought I'd ask here as there seems to be far more people here who could answer my question.
-
when trying to startup with install disc inserted,all i get is an apple logo.when using command v keys,it seems to see the cpu, but doesn't list any drivers.any idea what,s wrong?
That is the wrong system disc, the Mid 2007 Mac Mini's originally came with Tiger 10.4. You must have been sent the wrong disc, because that gray 10.6 system disc is obviously for a later Mac.
Mac mini (Mid 2007) - Technical Specifications
At this point I'm afraid that your options are very limited.
1. Call Apple, have your serial # handy and ask for a replacement Tiger disc set. Problem is that it wouldn't be of much use, except for maybe running the Apple Hardware Test.
Apple - Support - iMac - Service FAQ
2. Purchase a Retail Snow Leopard Upgrade disc.
Mac OS X 10.6 Snow Leopard - Apple Store (U.S.)
As for the RAM, if 2GB is shown in both Apple / About This Mac and in the Activity Monitor then there is a pretty good chance that's it OK. Of course it is hard to test without the original disc set and in your case may need to be done with a third party RAM checker like Memtest OS X -
Uninstalling bulk dll's from gac folder at one time using command prompt
Hi All,
I need to unistall bulk dll's at a time from the GAC folder using command prompt ,can any one suggest how to do this.Hi,
1. Create a batch file as "Uninstall.bat".
2. Edit this file and copy the below statements in it:
gacutil.exe /uf DLL1
gacutil.exe /uf DLL2
gacutil.exe /uf DLL3
gacutil.exe /uf DLL4
gacutil.exe /uf DLL5
replace DLL1 to DLL5 with your actual DLL names, which you want to uninstall.
3. Open Visual Studio Command Prompt as Administrator.
4. Browse to the location where you have placed the above batch file.
5. Run the batch file.
Hope this will help.
HTH,
Sumit
Sumit Verma - MCTS BizTalk 2006/2010 - Please indicate "Mark as Answer" or "Mark as Helpful" if this post has answered the question -
Using java from command prompt
Hi, I have used command prompts for a long time, though not recently. But this has never happenned to me, and I may have been using a different OS the last time I really used a command prompt. I am currently running Windows XP.
Anyways, when I try to simply change a directory, you know cd "filename", it tells me:
Parameter format not correct - "filename"
Basically, it won't accept any strings as a parameter. I'm really surprised at this. Is this normal? In any case, I got around this by using the short names for files. For example, I used the name docume~1 instead of "documents and settings".
Then, when I got to the folder where my java files were stored, it told me it was an invalid directory but nonetheless allowed me to use it. However, no commands worked except for cd..
Java did not work, nor did basic commands like dir or help. Do you have any idea what is wrong with my command prompt? I know this is not specifically a question about Java, but I can't use Java without this.
thanks.Basically, it won't accept any strings as a parameter.
I got around this by using the short names for files. For example, I
used the name docume~1 instead of "documents and settings".So it is accepting some strings.
Check that you are using cmd.exe not command.com. Ie, from
Start->Run... typecmdAnd not command.
Try the javac command and if the computer says'javac' is not recognized as an internal or external command,
operable program or batch file.then will have to set your OS path (not CLASSPATH - do not set
CLASSPATH at any time or the command prompt will likely never work
again).
Instructions for setting the OS path are [urlhttp://java.sun.com/j2se/1.5.0/install-windows.html]here. Scroll down to
point number 5 -
Adobe Reader importing XML data using command line reference
Financial Gonverment in Poland prepared new VAT declarations, which are protected from changing.
Restrictions summary is as follows: Printing, Commenting, Filling of form fields: Allowed; other restrictions are not allowed.
I am able to export xml data, using Acrobat Reader, change it to have desired data and than import it and everything works fine. In ERP program I need to fill this document with data from the system. Normally we were doing this using FDF printing channel, but for this document it shows an error with bad user password. We were talking with people from government and only answer was that it is not possible to change document restrictions... We find out the way to create xml document, but we want it now to open from the command line (UNIX commands). But we only find the way to open pdf file with specified fdf file... But when I'm trying to open PDF document with specified fdf URL (url is linked to xml file... i don't know if it is proper... if not than how to create fdf file with desired xml?)
Is there any possible to open a pdf with specified xml url to load to that PDF?I found the mistakes I made and I corrected them. The newly revised/corrected code is:
USE OPENXMLtesting1
GO
With XmlFile (Contents) AS (
SELECT CONVERT (XML, BulkColumn)
FROM OPENROWSET (BULK 'C:\Temp\books.xml', SINGLE_BLOB) AS XmlData
SELECT *
FROM XmlFile
GO
It worked: Results
Contents
1 <catalog><book.id="bk101"><author>Gambardella.M...
If I clicked on this, I got a listing of the whole book.xml!! I don't know what it means. Please comment and respond.
Thanks,
Scott Chang
Maybe you are looking for
-
I'm putting together a photo book of old photos that I have scanned and need to include a lot of annotations. The formal theme I have been using doesn't seem to allow additional text to be added once you fill the text box frame. Is there any way to e
-
HT204074 my new computer says it's already associated with another apple id
This 90-day timer is very frustrating, especially considering the fact that, when I try to sync my iPhone5 to iTunes on my new laptop, I get the message that it is already associated with another apple id...how can that be?? Must I really (really?) w
-
L675D Windows 8.1 Display Fix (Can't adjust brightness in settings charm)
I performed a clean install of Windows 8.1 Professional 64-bit (courtesy Dreamspark), and I noticed that I could not adjust the brightness setting using the "Settings" charm or in the control panel (in the charms-bar the brightness setting was greyed
-
MacBook Pro as second monitor for 27" iMac
Hello, Yesterday I purchased a 13" MacBook Pro and a Thunderbolt cable. I figured out how to use my 27" iMac as an extended display for the MacBook Pro by clicking cmnd F2 on the iMac's keyboard but how do you use MacBook Pro as an extended display f
-
Unable to insert properly the text in a already existing file
Hi Everyone, I am trying to read and write the text file using randomaccess class. When i am trying to update a line with string its over writing next line with the same number of bytes as my string which i am trying to insert. For example if my text