Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all 15028 articles
Browse latest View live

Need Urgent Help - Copy an Image and paste it to a Word Document and then re-size it - using Powershell

$
0
0

I am stuck with a task which requires me to copy an image (.jpg) and paste it into a MS word file using Powershell.

Please help me with a sample code.


LOGON script to force immediate LOGOFF

$
0
0

I know this is an odd question from the start, let me explain.

I am in a very large organization with a centralized helpdesk that supports several other sister organizations.  Users are comming and going at an extremely fast rate.  We have no way to force users to checkout.  Some users simply leave on organization and go to another.  Eventually, some accounts do end up in an OU named "Disabled" and we try to keep only disabled accounts in that OU.  The problem is that sometimes the user shows back up at one of the organizations, calls the HD, and gets his account re-enabled.  When this happens, most of the time the HD leaves the account in the Disabled OU, then when we do a clean-up that account gets deleted...

I am trying to keep this from happening, and the solution I am comming up with so far is to apply a GPO to the Disabled OU that runs a script.  I want the script to do 2 things;

1. Display a warning to the user that their account is in the wrong OU and to contact a local administrator to get it moved

2. 10 seconds after the warning is displayed, force a logoff.

Can someone give me a hand with how that script would look?

How to run PowerShell 3.0 "New-Object -COM InternetExplorer.application" unattended scheduled task

$
0
0

My PowerShell 3.0 script works when I run it logged on as an interactive user RDP to the server using the PowerShell command prompt/console.

Next step was to create a Scheduled Task and put this script to work. Everything is great except one function that calls Internet Explorer in order to load a web page (and cause the remote IIS server's .Net application to initialize). I think I can do this using VBS, but apparently something is wrong when using PowerShell! (The old VBS script is being retired, presumably it is working; the new PowerShell script in development for new version of application, new server.)

PowerShell 3.0 is on Windows Server 2008 R2. Symptom is that the IE process just does not run (if the user account defined in the Scheduled Task is a non-administrator) although the PowerShell script ends. The other symptom is IE process hangs (if the user is elevated to local administrator).

Example VBS code that works:

On Error Resume Next
Set objShell = CreateObject("Wscript.shell")
strURL1 = "http://localhost/appserver/service.asmx?op=Execute"
Set objHTTP = CreateObject("MSXML2.XMLHTTP") 
objHTTP.Open "GET", strURL1, FALSE
objHTTP.Send
Wscript.Echo(objHTTP.statusText)                    
Wscript.Echo(objHTTP.ResponseText)                  

 Example PowerShell code that is not working (as described above). The "hang" problem appears to be the test for $oIE.busy goes into an infinite loop waiting for the web server to respond.

Function OnBase-LoadPage {
	param([string]$URL,[string]$Logging)
	Add-Content -Path $Logging -Value("Loading Web Page")  
	$oIE=New-Object -COM InternetExplorer.application
	$oIE.Navigate($URL)
	$oIE.Visible=$false
	While ($oIE.busy) {
		Start-Sleep 1
		Add-Content -Path $Logging -Value("Internet Explorer is busy. Waiting for web page to load ... sleeping 1 second, retrying.") -PassThru
		}
	$oIEtempstring = $oIE.document.url
	Add-Content -Path $Logging -Value("$oIEtempstring `n") 
	$oIEtempstring = $oIE.document.title
	Add-Content -Path $Logging -Value("$oIEtempstring `n") 
	$oIE.Stop()
	$oIE.Quit()
	Return ( $Process.ExitCode )	
	}

There is an additional symptom if I attempt to run the PowerShell script unattended when the user is not a in the server's local Administrators' group. That is a message in the Windows System log on the server:

Log Name:      System
Source:        Microsoft-Windows-DistributedCOM
Date:          7/14/2014 3:14:20 PM
Event ID:      10016
Task Category: None
Level:         Error
Keywords:      Classic
User:          MYDOMAIN\sa_OBweb
Computer:      ADMGMT01-VM.mydomain.com
Description:
The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID 
{0002DF01-0000-0000-C000-000000000046}
 and APPID 
Unavailable
 to the user MYDOMAIN\sa_OBweb SID (S-1-5-21-823518204-789336058-682003330-28599) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.

Again, the PowerShell script works fine when I run it interactively.

Retrieving name from value in a hashtable....

$
0
0

Hi,

If I use a hastable that contains a name (unique) and value, how do I get that name by using a value?

TypeName: System.Collections.Hashtable

Name                           Value
----                           -----
1008                           xcelsius
1007                           WSUS Administration
1006                           wsil-wls
1005                           WebServicesSamples
1004                           WEB-INF

I've tried .ContainsValue and .ContainsKey, but that only returns TRUE/FALSE

I want to be able to get the name by providing the value.


Patrick de Rover

System.Windows.Forms.SaveFileDialog Replace file crashes dialog

$
0
0

Hello,

I'm having issues with the System.Windows.Forms.SaveFileDialog in that when I try to overwrite a file and I am prompted to replace the file it freezes and crashes powershell.

This seems to only occur in Powershell 2.   Unfortunately for my purpose I am restricted to Powershell 2

What I'm trying to do is create a config file of settings set in a Windows Form I developed.

The save seems to work, and open seems to work, but when I choose save overwriting a file with a different name it crashes powershell.

If I save over the file with the same name then it saves no problem.

Here is a snippet of the Function

Function save-FileName {

param
(
  [Parameter()]$initialdirectory,
  [Parameter()]$filetype = "Powershell (*.ps1) | *.ps1"
)

$saveFileDialog = New-Object System.Windows.Forms.SaveFileDialog
$saveFileDialog.ShowHelp = $True
$saveFileDialog.InitialDirectory = $initialdirectory
$saveFileDialog.filter = $filetype
$saveFileDialog.ShowDialog() | Out-Null
$saveFileDialog.FileName

$saveFileDialog.Dispose()

} # End function save-filename

Here is a reduced version of the Function save-config that calls save-filename

Function save-config {

param
(
    [switch]$saveas
)

IF ($objForm.text -eq "Untitled") {$saveas = $true}
Else {$Filename = $objForm.Text}

IF($saveas){$Filename = save-FileName -initialdirectory “$ScriptPath\Output” -filetype "XML (*.xml) | *.xml" }

IF ($Filename -ne "")
{

if (test-path $Filename) {clear-Content $Filename}

  Add-Content $Filename  ('<?xml version="1.0"?>')
  Add-Content $Filename "<config>"

  # Header

  Add-Content $Filename "<header>"
    Add-Content $Filename ("<opid>" + $OPIDTextbox.text + "</opid>")
    Add-Content $Filename ("<vbserial>" + $VBSerialTextBox.Text + "</vbserial>")
    Add-Content $Filename ("<company>" + $CompanyTextBox.Text + "</company>")
  Add-Content $Filename "</header>"

    # Settings

  Add-Content $Filename "<settings>"
     Add-Content $Filename ("<dns1>" + $dns1TextBox.Text + "</dns1>")
     Add-Content $Filename ("<dns2>" + $dns2TextBox.Text + "</dns2>")
     Add-Content $Filename ("<ntp1>" + $ntp1TextBox.Text + "</ntp1>")
     Add-Content $Filename ("<ntp2>" + $ntp2TextBox.Text + "</ntp2>")
     Add-Content $Filename ("<syslog1>" + $syslog1TextBox.Text + "</syslog1>")
     Add-Content $Filename ("<syslog2>" + $syslog2TextBox.Text + "</syslog2>")
     Add-Content $Filename ("<syslog3>" + $syslog3TextBox.Text + "</syslog3>")
     Add-Content $Filename ("<syslog4>" + $syslog4TextBox.Text + "</syslog4>")
     Add-Content $Filename ("<communities>" + $communityTextBox.Text + "</communities>")
     Add-Content $Filename ("<target1>" + $target1TextBox.Text + "</target1>")
     Add-Content $Filename ("<target2>" + $target2TextBox.Text + "</target2>")
     Add-Content $Filename ("<target3>" + $target3TextBox.Text + "</target3>")
  Add-Content $Filename "</settings>"

  Add-Content $Filename "</config>"

  $objForm.Text = $Filename
  $status.text = "Completed Save to $Filename"

} # End IF Statement

Else {$status.Text = "Cancelled Save"}

} # End of Save-Config


Walter

Upgrading from Powershell 1.0 to 2.0

$
0
0

Hello All,

Could anyone provide information to upgrade the Windows Powershell version from 1.0 to 2.0

Target OS which has Powershell 1.0 are Windows 2003 and 2008 and upgrade to 2.0. 

I have reference to below Article:

http://support.microsoft.com/kb/968929

Is it correct article ? Or anyone has additional information. 

Can we uninstall 1.0 and later need to install 2.0? Or, 2.0 can be installed over existing 1.0 without any issue?

what are requirements:.NET Framework 2.0 SP1, or anything else?

Thanks In Advance!


Software List

$
0
0

Hi , I have following script to search domain root for computer and list the installed applications, while output is to console having difficulty getting it to a CSV file. Can anyone please help ?

$datetime = Get-Date -Format "ddMMMyyyy"
$strCategory = "computer";

# Connect to root of domain
$objDomain = New-Object System.DirectoryServices.DirectoryEntry;
# AD Searcher object
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher;
# Set Search to root of domain
$objSearcher.SearchRoot = $objDomain;
# Search filter
$objSearcher.Filter = ("(objectCategory=$strCategory)");

$colProplist = "name";
foreach ($i in $colPropList)
{
$objSearcher.PropertiesToLoad.Add($i);
}

$colResults = $objSearcher.FindAll();


# Add column headers

Add-Content "$Env:USERPROFILE\Software_List $datetime.csv" "Computer,DisplayName,DisplayVersion,Publisher";

foreach ($objResult in $colResults)
{
$objComputer = $objResult.Properties;
$computer = $objComputer.name;

$ipAddress = $pingStatus.ProtocolAddress;
# Ping the computer
$pingStatus = Get-WmiObject -Class Win32_PingStatus -Filter "Address = '$computer'";

if($pingStatus.StatusCode -eq 0)
{
Write-Host -ForegroundColor Green "Ping Reply received from $computer.";

write-host "Connecting to $computer..."

$colItems = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* `
-Computername $computer

write-host "#############################"
write-host "Computer: " $computer
write-host "#############################"

foreach ($objItem in $colItems)
{
Write-Host "Computer: "$objComputer.name
$caption = $objItem.Computername;
write-host "Displayname: " $objItem.displayname
$caption = $objItem.Displayname;
write-host "Version: " $objItem.DisplayVersion
$caption = $objItem.Description;
write-host "Publisher: " $objItem.Publisher
$caption = $objItem.Publisher;
}
}

Add-Content "$Env:USERPROFILE\software_list $datetime.csv" "$Computername,$Displayname,$Displayversion"


}

else

{
Write-Host -ForegroundColor Red "No Ping Reply received from $computer"
}


Yasar

Data entry through scripting

$
0
0
The company I work for recently a week-long outage of a ticket system that resulted in a lot of wasted time and energy to recover the backlog of tickets. I have been tasked with implementing a system to allow the backlog to be dealt with more easily than our technicians writing their tickets in notepad during an outage and then copying them over when the system comes back up.

At a minimum I am expected to implement a means of creating temporary tickets and saving them until the system comes back online. Having a temporary ticket system with all of the same fields and information as the normal system would allowany user to input any other user's tickets, speeding up the process. That in itself isn't a huge challenge, it could be accomplished with Microsoft Access in a few hours. However, my ultimate goal at this point is to automate the input process once the system comes back up I'd like the user interaction to be as minimal as possible.

My first ideas concerning this were command line prompts into the ticket system. Unfortunately, due to the nature of our contract, I can't get or give users access to the back end of the ticket system, nor can any other software or drivers onto machines; so my options are vastly limited as far as how I can approach this. Being unable to access the back-end of the ticket system, the only thing that immediately springs to mind is to setup a basic macro to run which copies and pastes information from the script GUI into the ticket system. I'm just having trouble finding any means of doing this. PowerShell seems to have the most promise for developing this at the moment, but was hoping there may be some guidance more experienced users can offer concerning whether or not this is even possible with the tools I have available to me.

I appreciate your time.


VBScript: If value found in column A, show value in B

$
0
0

Hi,

I have tried for quite some time to make a vbscript which will allow me to search a excel sheet within a spesific column (A) for a spesific keyword. If there is a match in column A for the keyword, I want to be given the value belonging next to it (B). Like a VLOOKUP in Excel.

I have found out how to search for a given value in A, but it won't give me the value from B.

A snippet of my code is as following:

WHAT_TO_FIND = "something" 
File_Path = "C:\test\users.xls"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set oExcel = CreateObject("Excel.Application")
Set oData = oExcel.Workbooks.Open(File_Path)
Set FoundCell = oData.Worksheets("Ark1").Range("A2:B500").Find(WHAT_TO_FIND)


Should anyone feel the urge to give me some assistance, I would be grateful.


Reporting on a particular line of the object's Notes

$
0
0

Hi Scripting Guy,

Even though I refer to PowerCLI here, I do not believe this is PowerCLI limited question, please read on.

 

Is there a way to get a particular line from the Notes of a VM?

I get the Notes, but all of them - multiple lines of formatted text, something like this

 

CreatedBy: UserName

CreatedOn: DateCreatedOn

User: Conatct'sDisplayName

User Email: Conatct'sEmailAddress

 

Let's say I need just the "User". The Select-String does not seem to work - keeps giving me the whole thing.

The Get-Member on $vm.Notes lists all these methods, but not anything along the "select" lines.

 

So, once you have the Notes of the VM either in a variable, or better yet in $vm.Notes form, what would be the best way to get just the line that one needs?

 

Any advice, recommendation would be greatly appreciated.


BostonTea

How do I filter our parts of a string using powershell?

$
0
0

Hi all,

The goal I'm trying to accomplish is getting the DN of a user's object without any part of the CN= attribute using powershell.

For example, here's what I get for the DN of a user:

CN=Smith\, John (jsmith),OU=NewYork,OU=Users,DC=Example,DC=Com

I'm having trouble understanding how to filter out the text in the string in the beginning, which is the part that contains:

CN=Smith\, John (jsmith), 

All I want from the string is the OU=NewYork part.  I can handle stripping out the ,OU=Users,DC=Example,DC=Com using the replace function.  If all of my users had the same number of characters for their name, that would be easy.  But alas, that is obviously not the case.

The problem is that I have a csv file with many users, so the "prefix" where the CN= part is always going to be some variable length.  My idea was to somehow search the string for a match of  ), and then remove all text before that match.  But I don't know how to and apparently don't know the proper terminology to use to search on.

Any help would be greatly appreciated.

Pulling HTML elements from site

$
0
0

Thanks to the forums I have expanded on a basic script that goes out and searches a predefined listing of URL's for several keywords, returning those URLs which contain the defined keywords. 

What I cannot figure out how to do (I have mostly been trying to get Invoke-WebRequest to accomplish this) is go out to these same URL's and pull the HTML elements out and put them into a .csv.  So, for example, I am including a couple of elements from the target website.  From it, I want to pull out the "CVE-ID's", "Date Released" and "Proximity" from the page.  This is the source code from an example page:

    <tr class="t">
            <td class="status">CVE-ID's</td>
            <td>
                <p> CVE-2014-2389 CVE-2014-1956 </p>
            </td>
        </tr>
    <tr class="t">
        <td class="status">Date Released</td>
        <td>
            <p>03 Jul 2014</p>
        </td>
        </tr>
    <tr class="t">
            <td class="status">Proximity</td>
            <td>
                <p> From adjacent network </p>
            </td>
        </tr>

Parse User vs groups vs Permissions vs file

$
0
0

Office365 / Sharepoint Online

I am trying to write and powershell script to the following information:

1. Users and what groups they are in

2. Users and permissions of files and objects

What I would like to end up with is a list with the following

User     Member of    Access to file    UserRole   

Any ideas would be great

Wait for network connection - ping

$
0
0

I have a batch file that runs at startup that attempts to connect to a server and keeps trying until the wireless network connection is available (it connects about 60 seconds after login) then launches a link to a batch file on that server.

My script works but I want to do a "for /l" and only try 10 times before failing. I can't get it to work.

@echo off

echo CONNECTING TO SERVER. PLEASE WAIT...

:start
ping -n 1 someserver >NUL
if %errorlevel%==0 goto :continue

rem wait for 15 seconds before trying again
@echo Still waiting...
ping -n 15 127.0.0.1 >NUL 2>&1

rem loopback to start
goto :start

:continue
echo ***************************
echo *Network is now available.*
echo ***************************

call "C:\Program Files\Company\Software\Launch.lnk"

Error when loading XML document ("The input document has exceeded a limit set by MaxCharactersFromEntities.")

$
0
0

Hi.

Since PSVersion 3.0 I get the error "The input document has exceeded a limit set by MaxCharactersFromEntities."when loading an xml document with:

[xml]$c = gc "c:\temp\xmlfile.xml"


My XML FILE:

<?xml version="1.0" ?><!DOCTYPE Translators[<!ENTITY  MODULEBASE "C:/apl/s1/DispRoot/Module"><!ENTITY  JAVABIN "C:\apl\s1\jre7x64\bin"><!ENTITY  IDEAS "C:/UGS/IDEAS12"><!ENTITY  ORBIX "C:/ORBIX/Iona/asp/6.1/lib/"><!ENTITY  PROJTRANS "d:/ProjTrans"><!ENTITY  PT_JFV "_10000.1.0"><!ENTITY  UGSPKG "com.teamcenter.translator.ugs."><!ENTITY  WRAPPER "com.teamcenter.tstk.server.translator.ugs."><!ENTITY  EAIWRAPPER "&WRAPPER;EaiTranslator">
]><Translators><!-- Configuration of the Solid Works to JT translator --><SolidWorksToJt provider="X" service="swtojt" isactive="false"
                  wrapperclass="&EAIWRAPPER;"><TransExecutable dir="C:/progra~1/EAI/Translators/SolidWorks" name="Swtojt.exe"/><Options><Option name="configfile" string="-z" value="D:/apps/Translators/SWtoJt/SwtoJt.config"
              description="Path to the config file"/><Option name="outputdir" string="-o"
              description="Full path to the output directory."/><Option name="inputpath" string=""
              description="Full path to the input file."/></Options><FileExtensions><InputExtensions nitem="2"><InputExtension extension=".SLDASM"/><InputExtension extension=".SLDPRT"/></InputExtensions><OutputExtensions nitem="1"><OutputExtension extension=".jt"/></OutputExtensions></FileExtensions><Postprocess provider="X" service="previewservice"/></SolidWorksToJt><!-- Configuration of the Solid Edge to JT translator --><SolidEdgeToJt provider="X" service="setojt" isactive="false"><TransExecutable name="setranslations.bat" dir="&MODULEBASE;/Translators/setranslations"/><Options><Option name="inputpath" string="-i" description="Full path to the input file." /><Option name="vis" string="-v" value="false" description="visualization"/><Option name="clientoption" optionkey="TARGET" string="-t" value="" description="target extension"/><Option name="outputdir" string="-o" description="Full path to the output directory."/><Option name="clientoption" optionkey="TARGET_FILE" string="" value="" description="Target file name"/></Options><FileExtensions><InputExtensions nitem="5"><InputExtension extension=".par"/><InputExtension extension=".asm"/><InputExtension extension=".psm"/><InputExtension extension=".pwd"/><InputExtension extension=".dft"/></InputExtensions><OutputExtensions nitem="15"><OutputExtension extension=".jpg"/><OutputExtension extension=".jt"/><OutputExtension extension=".dwg"/><OutputExtension extension=".dxf"/><OutputExtension extension=".X_T"/><OutputExtension extension=".stp"/><OutputExtension extension=".igs"/><OutputExtension extension=".stl"/><OutputExtension extension=".emf"/><OutputExtension extension=".xgl"/><OutputExtension extension=".sat"/><OutputExtension extension=".plmxml"/><OutputExtension extension=".tif"/><OutputExtension extension=".bmp"/><OutputExtension extension=".pdf"/></OutputExtensions></FileExtensions></SolidEdgeToJt><!-- Configuration for queryscos translator --><QueryScos provider="X" service="queryscos" isactive="false"><TransExecutable name="queryscos.bat" dir="&MODULEBASE;/Translators/queryscos"/><Options><Option name="inputpath" string=""
              description="Full path to the input file which will contain user input for complete dispatcher service."/><Option name="outputdir" string=""
         description="Full path to the output directory."/><Option name="outputfile" string="queryscos_results.txt"
         description="Name of the output file containing results."/>     </Options><TransErrorStrings><TransInputStream string="ERROR"/><TransInputStream string="error"/><TransErrorStream string="ERROR"/><TransErrorStream string="error"/></TransErrorStrings><TransErrorExclStrings><TransErrorStreamExcl string="0 errors"/></TransErrorExclStrings>      <FileExtensions><OutputExtensions nitem="1"><OutputExtension extension=".txt"/></OutputExtensions></FileExtensions></QueryScos><!-- Configuration for RdvContextDBDownload translator --><RdvContextDBDownload provider="X" service="rdvcontextdbdownload" isactive="false"><TransExecutable name="rdvcontextdbdownload.bat" dir="&MODULEBASE;/Translators/rdvcontextdbdownload"/>     <Options><Option name="inputpath" string=""
              description="Full path to the input file which will contain user input for complete dispatcher service."/><Option name="outputdir" string=""
         description="Full path to the output directory."/><Option name="outputfile" string="sco_results"
              description="Name of the output file containing results."/></Options><TransErrorStrings><TransInputStream string="ERROR"/><TransInputStream string="error"/><TransErrorStream string="ERROR"/><TransErrorStream string="error"/></TransErrorStrings><TransErrorExclStrings><TransErrorStreamExcl string="0 errors"/></TransErrorExclStrings><FileExtensions><OutputExtensions nitem="1"><OutputExtension extension=".plmxml"/></OutputExtensions></FileExtensions> </RdvContextDBDownload><!-- Configuration for RdvContextDBDownload translator --><RdvContextNONDBDownload provider="X" service="rdvcontextnondbdownload" isactive="false"><TransExecutable name="rdvcontextnondbdownload.bat" dir="&MODULEBASE;/Translators/rdvcontextnondbdownload"/>     <Options><Option name="inputpath" string=""
              description="Full path to the input file which will contain user input for complete dispatcher service."/><Option name="outputdir" string=""
         description="Full path to the output directory."/><Option name="outputfile" string="sco_results"
        description="Name of the output file containing results."/></Options><TransErrorStrings><TransInputStream string="ERROR"/><TransInputStream string="error"/><TransErrorStream string="ERROR"/><TransErrorStream string="error"/></TransErrorStrings><TransErrorExclStrings><TransErrorStreamExcl string="0 errors"/></TransErrorExclStrings><FileExtensions><OutputExtensions nitem="1"><OutputExtension extension=".plmxml"/></OutputExtensions></FileExtensions><!--Invoke populatefsc Translator after generation of PLMXML file"--> <Postprocess provider="X" service="populatefsc"/>  </RdvContextNONDBDownload><!-- Configuration of the NX to PV Direct translator --><NxToPvDirect provider="X" service="nxtopvdirect" isactive="false" OutputNeeded="false"
       wrapperclass="&WRAPPER;ugtopvdirect.UgToPvDirect"><TransExecutable name="nxtopvdirect.bat" dir="&MODULEBASE;/Translators/nxtopvdirect"/><Options><!-- Option name="" string="" value="-single_part"/ --><Option name="ConfigMapFile" string="-configmap"
               value="&MODULEBASE;/Translators/nxtopvdirect/ConfigMap.properties"
               description="Property file which has the Map between Client passed in
                            Criteria and the location of config file to be used"/><Option name="inputpath" string=""
               description="Full path to the input file."/></Options><TransErrorStrings><TransInputStream string="Cannot"/><TransInputStream string="Error"/><TransInputStream string="exception"/><TransInputStream string="ERROR"/><TransErrorStream string="Errored"/><TransErrorStream string="failed"/></TransErrorStrings><!-- Postprocess provider="X" service="copyugrelstatus"/ --></NxToPvDirect><NxTransDirect provider="X" service="nxtransdirect" isactive="false" OutputNeeded="false"><TransExecutable name="nxtransdirect.bat" dir="&MODULEBASE;/Translators/nxtransdirect"/><Options><Option name="inputpath" string="-inputFile="
                    description="Full path to the input file."/><Option name="clientoption" optionkey="user" string="-u="
                               value=""
                               description="Specifies username for NX Translator login to Teamcenter."/><Option name="clientoption" optionkey="password" string="-p="
               value=""
               description="Specifies password for NX Translator login to Teamcenter."/><Option name="clientoption" optionkey="group" string="-g="
               value=""
               description="Specifies group for NX Translator login to Teamcenter."/><Option name="clientoption" optionkey="encrypted_password" string="-encrypt="
               value="true"
               description="Specifies whether or not password is encrypted for NX Translator login to Teamcenter."/><Option name="clientoption" optionkey="use_module_user" string="-autologin="
               value="true"
               description="Specifies whether  to auto login as module user."/>       <Option name="clientoption" optionkey="storeInSourceVolume" string="-storeInSourceVolume="
                               value="false"
               description="Specifies whether to store the translated data in the same volume as source."/> <Option name="clientoption" optionkey="updateExistingVisData" string="-updateExistingVisData="
                                       value="false"
               description="Specifies whether to update existing translated data."/><Option name="clientoption" optionkey="changeOwnerToCad" string="-changeOwnerToCad="
                                               value="false"
               description="Specifies whether to change the translated data to the same owner as source."/>  </Options><TransErrorStrings><TransInputStream string="Cannot"/><TransInputStream string="Error"/><TransInputStream string="exception"/><TransInputStream string="ERROR"/><TransErrorStream string="Errored"/><TransErrorStream string="failed"/></TransErrorStrings></NxTransDirect><CopyUgRelStatus provider="X" service="copyugrelstatus" isactive="false" OutputNeeded="false" wrapperclass="&WRAPPER;copyugrelstatus.CopyUgRelStatus"></CopyUgRelStatus><!-- Configuration of the UG Nx to PV translator --><NxToPv provider="X" service="nxtopv" isactive="false"><TransExecutable name="nxtopv.bat" dir="&MODULEBASE;/Translators/nxtopv"/><Options><Option name="inputpath" string=""
              description="Full path to the input file."/><Option name="StructOption" string="-honour_structure" value=""
              description=""/><Option name="Output_dir" string="-force_output_dir" value=""
              description=""/><Option name="outputdir" string=""
              description="Full path to the output directory."/><Option name="BOM_Indicator" string="-bom" value=""
              description=""/><Option name="BOM_FileName" string="nxtopv.bom" value=""
              description=""/></Options><FileExtensions><OutputExtensions nitem="1"><OutputExtension extension=".jt"/></OutputExtensions></FileExtensions><Postprocess provider="X" service="previewservice"/></NxToPv><!-- Configuration of the Visprint translator --><Visprint provider="X" service="visprint" isactive="false" OutputNeeded="false"><TransExecutable name="visprint.bat" dir="&MODULEBASE;/Translators/visprint"/><Options><Option name="inputpath" string="" description="Full path to the input file."/><Option name="clientoption" optionkey="PRINTER_NAME" string="" value="" description="Name of the Printer"/><Option name="clientoption" optionkey="STAMP" string="" value="" description="Watermerk to be printed"/></Options><FileExtensions><InputExtensions nitem="10"><!-- List of file extensions --><InputExtension extension=".doc"/><InputExtension extension=".xls"/><InputExtension extension=".ppt"/><InputExtension extension=".docx"/><InputExtension extension=".xlsx"/><InputExtension extension=".pptx"/><InputExtension extension=".dft"/><InputExtension extension=".prt"/><InputExtension extension=".dwg"/><InputExtension extension=".pdf"/></InputExtensions></FileExtensions></Visprint><!-- Configuration of the NX to Cgm Direct translator --><NxToCgmDirect provider="X" service="nxtocgmdirect" isactive="false" OutputNeeded="false"
       wrapperclass="&WRAPPER;ugtocgmdirect.UgToCgmDirect"><TransExecutable name="nxtocgmdirect.bat" dir="&MODULEBASE;/Translators/nxtocgmdirect"/><Options><Option name="inputpath" string="-i"
              description="Full path to the input file."/></Options><TransErrorStrings><TransInputStream string="Cannot"/><TransInputStream string="ERROR"/><TransInputStream string="exception"/><TransInputStream string="ERRORS"/><TransErrorStream string="Errored"/><TransErrorStream string="failed"/></TransErrorStrings></NxToCgmDirect><!-- Configuration for NX refile module --><NxRefile provider="X" service="nxrefile" isactive="false" OutputNeeded="false"><TransExecutable name="nxrefile.bat" dir="&MODULEBASE;/Translators/nxrefile"/><Options><Option name="inputpath" string=""
              description="Full path to the input file."/><Option name="outputdir" string=""
              description="Full path to the output directory."/><Option name="modulePath" string=""
               value="&MODULEBASE;/Translators/nxrefile"
               description="Dir where refile command is located"/><Option name="clientoption" optionkey="commandName" string=""
               value="refilenx"
               description="Refile command to launch. Do not include extension (.bat/.sh)"/><Option name="clientoption" optionkey="commandArgs" string=""
               description="arguments for refile command"/></Options><FileExtensions><InputExtensions nitem="2"><InputExtension extension=".bat"/><InputExtension extension=".txt"/></InputExtensions><OutputExtensions nitem="2"><OutputExtension extension=".log"/><OutputExtension extension=".syslog"/></OutputExtensions></FileExtensions></NxRefile><!-- Configuration for NX Clone module --><NxClone provider="X" service="nxclone" isactive="false" OutputNeeded="false"><TransExecutable name="nxclone.bat" dir="&MODULEBASE;/Translators/nxclone"/><Options><Option name="modulePath" string=""
               value="&MODULEBASE;/Translators/nxclone"
               description="Dir where clone command is located"/><Option name="inputpath" string=""
              description="Full path to the input file."/><Option name="outputdir" string=""
              description="Full path to the output directory."/><Option name="clientoption" optionkey="single_part" string=""
               value="no"
               description="Whether to use -part or -assembly option"/><Option name="clientoption" optionkey="user" string="-user="
               value=""
               description="Specifies username for NX Clone login to Teamcenter."/><Option name="clientoption" optionkey="password" string="-password="
               value=""
               description="Specifies password for NX Clone login to Teamcenter."/><Option name="clientoption" optionkey="group" string="-group="
               value=""
               description="Specifies group for NX Clone login to Teamcenter."/><Option name="clientoption" optionkey="encrypted_password" string="-encrypt="
               value="true"
               description="Specifies whether or not password is encrypted for NX Clone login to Teamcenter."/><Option name="clientoption" optionkey="operation" string="-operation="
               value="export"
               description="Default is export. Other modes are not currently supported"/><Option name="clientoption" optionkey="default_naming" string="-default_naming="
               value="autotranslate"
               description="Default naming"/><Option name="clientoption" optionkey="default_checkout" string="-default_checkout="
               value="no"
               description="Checkout parts"/><Option name="clientoption" optionkey="copy_associated_files" string="-copy_associated_files="
               value="no"
               description="Copy Teamcenter Associated files"/><Option name="clientoption" optionkey="copy_n_s" string="-copy_n="
               value="specification:yes"
               description="Copy non-master datasets of ItemRevision"/><Option name="clientoption" optionkey="copy_n_m" string="-copy_n="
               value="manifestation:yes"
               description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_a" string="-copy_n="
               value="altrep:yes"
               description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_c" string="-copy_n="
               value="scenario:yes"
               description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_e" string="-copy_n="
               value="simulation:yes"
               description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_l" string="-copy_n="
               value="motion:yes"
               description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_r" string="-copy_n="
               value="cae_solution:yes"
               description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_n" string="-copy_n="
               value="cae_mesh:yes"
               description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_g" string="-copy_n="
               value="cae_geometry:yes"
               description="Copy non-master datasets in ItemRevision"/></Options><TransErrorExclStrings><TransErrorStreamExcl string="0 errors"/></TransErrorExclStrings></NxClone><!-- Configuration for FMS Transfer --><FMSTransfer provider="X" service="fmstransfer" isactive="false"><TransExecutable name="fmstransfer.bat" dir="&MODULEBASE;/Translators/fmstransfer"/><Options><Option name="inputpath" string="-Dcom.teamcenter.fms.ts.task="
              description="Full path to the input file."/><Option name="outputpath" string="-Dcom.teamcenter.fms.ts.output="
              description="Full path to the output file."/></Options><FileExtensions><InputExtensions nitem="1"><InputExtension extension=".fmst"/></InputExtensions><OutputExtensions nitem="1"><OutputExtension extension=".fmstransferred"/></OutputExtensions></FileExtensions><TransErrorStrings><TransInputStream string="IgnoreErrorStrings"/><TransErrorStream string="IgnoreErrorStrings"/></TransErrorStrings></FMSTransfer><!-- Configuration for Populate FSC --><PopulateFSC provider="X" service="populatefsc" isactive="false"><TransExecutable name="populatefsc.bat" dir="&MODULEBASE;/Translators/populatefsc"/><Options><Option name="outputpath" string="-output_file="
              description="Full path to the output file."/><Option name="clientoption" optionkey="Username" string="-user="
                      value="" description="Username of the translation task"/><Option name="clientoption" optionkey="Group" string="-group="
                      value="" description="Group of the translation task"/><Option name="clientoption" optionkey="FSC_TARGETS" string="-targets="
               value=""
               description="Target FSC Server URI that has to be loaded"/><Option name="clientoption" optionkey="SCO_UID" string="-uid="
               value=""
          description="UID of the Structured Context Object(SCO)"/><Option name="clientoption" optionkey="RDV_plmxml_file" string="-RDV_plmxml_file="
               value=""
               description="To check if it is RDV generated plmxml or simply Bomwriter PLMXML file"/></Options></PopulateFSC><!-- Configuration for Store and Forward --><StoreAndForward  provider="X" service="store_and_forward" isactive="false"><TransExecutable name="store_and_forward.bat" dir="&MODULEBASE;/Translators/store_and_forward"/><Options><Option name="clientoption" optionkey="Username" string="-user="
                      value="" description="Username of the translation task"/><Option name="clientoption" optionkey="Group" string="-group="
                      value="" description="Group of the translation task"/><Option name="clientoption" optionkey="CleanupTicketsFile" string="-cleanup_tickets_file="
               value=""
               description="File listing cleanup fms tickets"/></Options></StoreAndForward><!-- Configuration of the Pro Engineer to DXF translator --><ProEToDxf provider="X" service="proetodxf" isactive="false"
       wrapperclass="&WRAPPER;proetodxf.ProEToDxf"><!-- Start the NameService daemon --><Daemon exec="C:/apl/s1/ProE/x86e_win64/nms/nmsd.exe" args="-noservice"/><TransExecutable name="ProEWildfireDXFExe.exe" dir="&MODULEBASE;/Translators/proetodxf/"/><Options><Option name="inputpath" string="-i"
              description="Full path to the input file"/><Option name="outputpath" string="-o"
              description="Full path to the output file."/></Options><FileExtensions><OutputExtensions nitem="1"><OutputExtension extension=".dxf"/></OutputExtensions></FileExtensions><!--Postprocess provider="X" service="previewservice"/--></ProEToDxf><!-- Configuration of the Teamcenter Project Schedule translator --><ProjectTrans provider="X" service="projecttrans" NoOfTries="5" WaitTimeForReTries="15" isactive="false"><SysExecutable name="&JAVABIN;\java"/><Options><Option name="classpath" string="-cp" system="java.class.path" append=";&PROJTRANS;/lib/scheduling_tstk&PT_JFV;.jar;&PROJTRANS;/lib/scheduling_strong_interface&PT_JFV;.jar;&PROJTRANS;/lib/scheduling&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaClient&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaCommon&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaCoreStrong&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaCoreTypes&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaProjectManagementStrong&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaProjectManagementTypes&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaStrongModel&PT_JFV;.jar;&PROJTRANS;/lib/commons-logging.jar;&PROJTRANS;/lib/commons-codec.jar;&PROJTRANS;/lib/commons-httpclient.jar;&PROJTRANS;/lib/xercesImpl.jar;&PROJTRANS;/lib/xerces.jar;&PROJTRANS;/lib/resolver.jar;&PROJTRANS;/lib/xml-apis.jar"
              description="Classpath to the java virtual machine." /><Option name="classname" string=""
              value="com.teamcenter.project.tstk.SchedulingTranslator"
              description="Teamcenter Project Schedule Translator class."/><Option name="inputpath" string="-i"
              description="Full path to the input file."/><Option name="outputdir" string="-d"
              description="Full path to the output directory."/><Option name="configfile" string="-conf"
              value="&PROJTRANS;/conf.properties"
              description="Full path to config file."/></Options></ProjectTrans><!-- Configuration of the Teamcenter Schedule Manager translator --><SchMgrTrans provider="X" service="schmgrtrans" isactive="false"><TransExecutable dir="d:/SchMgrTrans" name="schmgrtrans.bat"/><Options><Option name="jarversionextension" string="" value="&PT_JFV;" description="Version extension for jar."/><Option description="" name="clientoption" optionkey="readFromInputTicket" string="readFromInputTicket" value=""/><Option description="" name="clientoption" optionkey="readFromOutputTicket" string="readFromOutputTicket" value=""/><Option description="" name="clientoption" optionkey="writeToOutputTicket" string="writeToOutputTicket" value=""/></Options></SchMgrTrans ></Translators>

Does anyone know why?

(by the way: I managed to solve the problem with:

Function Get-XML
{
    param(
        [Parameter(Mandatory=$true)]
        [string]$filePath
    )
    $fileContent = New-Object System.Xml.XmlDocument
    $fileContent.XmlResolver = $null
    Try {
        $fileContent.Load($filePath)
    }
    Catch [system.exception] {
        write-host "Could not open file $filePath"
    }
    $fileContent
}

)


If you found this post helpful, please "Vote as Helpful". If it answered your question, remember to "Mark as Answer"
MCC & PowerShell enthusiast
http://oliver.lipkau.net/blog


ReturnCode handling? msi installation

$
0
0

Hi im currently trying to understand how to use returncode for error handling in a script.

Belov i have a script that install iff the registry key doenst exist.

The part i dont understand is this section. Anybody who could explain line by line what happening or point me to a site where i can read about this.

Thanks

ReturnCode = oShell.run (CHR(34) & sRunPath & "Prerequisite Components\Microsoft Report Viewer 2010\ReportViewer.exe" & CHR(34) & " /passive /norestart", 0, TRUE) If ReturnCode = 3010 Then ReturnCode = 0 If ReturnCode <> 0 Then Set oFSO = Nothing Set oShell = Nothing WScript.Quit(1)
End IF



' --- Microsoft Report Viewer 2010 x86 RegEntry = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{72DEBE5A-5667-3966-8E8D-2FD5FBCCB7DD}\UninstallString" If Not regEntryExists(RegEntry) Then ReturnCode = oShell.run (CHR(34) & sRunPath & "Prerequisite Components\Microsoft Report Viewer 2010\ReportViewer.exe" & CHR(34) & " /passive /norestart", 0, TRUE) If ReturnCode = 3010 Then ReturnCode = 0 If ReturnCode <> 0 Then Set oFSO = Nothing Set oShell = Nothing WScript.Quit(1) End If End If Function regEntryExists(RegEntry) Dim Entry On Error Resume Next 'set shell = CreateObject("WScript.Shell") Entry = oShell.RegRead(RegEntry) If Err.Number <> 0 then Err.Clear RegEntryExists = FALSE Else Err.Clear RegEntryExists = TRUE End If 'set oSshell = Nothing End Function




Helpdesk Supporter

Adding a filter

$
0
0

Hi

I'm a PowerShell newbie trying to filter the output of a ForEach-Object startement:

 $spItems | ForEach-Object { 

 $xml.WriteStartElement('item');

 $xml.WriteAttributeString("ID",$_['ID']);
 $xml.WriteAttributeString("Title",$_['Title']);
 $xml.WriteAttributeString("Start",$_['Start']);
 $xml.WriteAttributeString("End",$_['End']);
 

I need to add a filter that ensures that only list items where the "End" column is empty, will be written.

How do I do that?

Thanks,

Jakob

Windows script needed for the following tags

$
0
0

hi ,

I am currently automating a web task using windows script.

For the below source script , i need wsh script

<td title="Export Report" class="ui-pg-button ui-corner-all" style="cursor: pointer;" jQuery1404898744838="556">

     <div class="ui-pg-div">

             <span class="ui-icon ui-icon-newwin"/>

                        Text - Export

From the above script,

I need to click the "export"

Please anyone guide me to form a WSH script for clicking the "Export"

So far my code is

Set IE = CreateObject("InternetExplorer.Application")
Set WshShell = Wscript.CreateObject("Wscript.Shell")
IE.navigate "url"

IE.Visible = True
Wscript.sleep 10000
IE.Document.getElementbyID("ctl00_ContentPlaceHolder1_ddl_datefilter4").focus()
WScript.sleep 10000
IE.Document.getElementbyID("ctl00_ContentPlaceHolder1_ddl_datefilter").SelectedIndex=4
WScript.Sleep 10000
IE.Document.getElementbyID("ctl00_ContentPlaceHolder1_txt_fromdate").value = "30 Jun 2014"
WScript.Sleep 10000
IE.Document.getElementbyID("ctl00_ContentPlaceHolder1_txt_todate").value = "04 Jul 2014"
WScript.Sleep 10000
IE.Document.getElementbyID("a_genslasummary").click()
WScript.sleep 10000

Thanks in Advance

Naveen

Setting up PowerShell DSC on Win2008R2 Server can't find DSC-Service Feature

$
0
0
Hi,

I’m trying to set up a Win2008R2 (SP1) server as the Pull Server for DSC configuration, and I simply cannot get it to load the DSC-Service feature.

I’ve loaded .Net framework ver 4.5.1 and then WMF ver 4.0.

I did find a set of release notes for the preview of WMF 4.0 that included the command: dism /online /enable-feature:DSC-Service

While this seems to have ‘enabled’ the feature, it still refuses to allow the “Add-WindowsFeature Dsc-Service” command, or the push of the configuration from a client PC that should also add this service and set up the related IIS bits.

I’ve tried as many search combinations in Google as I can think of, but I’m still at a loss as to what I’m missing. I do see that it should work fine for Win2012, but I don’t have that option just at the moment.

What have I missed??

Many thanks in advance,
Mike

AD custom6 attribute and group memberships for shared mailboxes

$
0
0

I have 900 shared mailboxes that are in Exchange 2007. These mailboxes have no owners and are provided access to the users threw AD groups. I need a script that will produce Each users custom6 attribute (SID is there) along with the shared mailboxes they have rights to (Full. send As etc...)

This is a migration from 2007 to 2010 in different domains.

Charlesgiles@live.com

2142285476


Charles B. Giles

Viewing all 15028 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>