You can have multiple runspaces associated with a PowerShell session and each runspace can have a current directory. That's complicating factor #1.
Complicating factor #2 is that each provider in PowerShell can have a current directory (such as HKLM: or AD: etc.) Sometimes .\ may refer to a registry location. :) Anyway, you can always get the "real" current file directory that PowerShell is using from $ExecutionContext.SessionState.Path.CurrentFileSystemLocation. And the one that the process will use from [environment]::CurrentDirectory. Using join-path, test-path, and resolve-path, along with $pwd, to create absolute paths, are things I normally do as part of "safe coding". From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On Behalf Of Webster Sent: Wednesday, August 7, 2013 4:17 PM To: powershell@lists.myitforum.com Subject: [powershell] RE: GPO cmdlet question Yep. PS C:\webster> [environment]::CurrentDirectory C:\Users\Administrator PS C:\webster> dir c:\users\administrator Directory: C:\users\administrator Mode LastWriteTime Length Name ---- ------------- ------ ---- d-r-- 7/4/2013 7:18 PM Contacts d-r-- 7/16/2013 7:09 AM Desktop d-r-- 7/4/2013 7:18 PM Documents d-r-- 7/4/2013 7:18 PM Downloads d-r-- 7/4/2013 7:18 PM Favorites d-r-- 7/4/2013 7:18 PM Links d-r-- 7/4/2013 7:18 PM Music d-r-- 7/4/2013 7:18 PM Pictures d-r-- 7/4/2013 7:18 PM Saved Games d-r-- 7/4/2013 7:18 PM Searches d-r-- 7/4/2013 7:18 PM Videos -a--- 8/7/2013 3:14 PM 143160 GPOReport.html PS C:\webster> How is it getting there and not in the directory the script is run from? I thought that was what ".\" told PoSH to use? Thanks Webster From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Jim Truher Sent: Wednesday, August 07, 2013 3:05 PM To: powershell@lists.myitforum.com<mailto:powershell@lists.myitforum.com> Subject: [powershell] RE: GPO cmdlet question Try looking for the report in [environment]::CurrentDirectory From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Webster Sent: Wednesday, August 07, 2013 12:50 PM To: powershell@lists.myitforum.com<mailto:powershell@lists.myitforum.com> Subject: [powershell] GPO cmdlet question If I run this, I get no report. Get-GPOReport -Name 'Set PDCe as Authoritative Time Server' -ReportType Html -Path .\GPOReport.html If I run this, I get the report file created. Get-GPOReport -Name 'Set PDCe as Authoritative Time Server' -ReportType Html -Path c:\webster\GPOReport.html I am running this from c:\webster Thanks Webster ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1